/** * Override this method in order to control the parsing of the incoming * request. For example, you may want to bypass the check of the Content-Type * and character encoding headers in the request, as some proxies re-write the * request headers. Note that bypassing these checks may expose the servlet to * some cross-site vulnerabilities. Your implementation should comply with the * HTTP/1.1 specification, which includes handling both requests which include * a Content-Length header and requests utilizing <code>Transfer-Encoding: * chuncked</code>. * * @param request the incoming request * @return the content of the incoming request encoded as a string. */ protected String readContent(HttpServletRequest request) throws ServletException, IOException { return RPCServletUtils.readContentAsGwtRpc(request); }
/** * Override this method in order to control the parsing of the incoming * request. For example, you may want to bypass the check of the Content-Type * and character encoding headers in the request, as some proxies re-write the * request headers. Note that bypassing these checks may expose the servlet to * some cross-site vulnerabilities. Your implementation should comply with the * HTTP/1.1 specification, which includes handling both requests which include * a Content-Length header and requests utilizing <code>Transfer-Encoding: * chuncked</code>. * * @param request the incoming request * @return the content of the incoming request encoded as a string. */ protected String readContent(HttpServletRequest request) throws ServletException, IOException { return RPCServletUtils.readContentAsGwtRpc(request); }
/** * Override this method in order to control the parsing of the incoming * request. For example, you may want to bypass the check of the Content-Type * and character encoding headers in the request, as some proxies re-write the * request headers. Note that bypassing these checks may expose the servlet to * some cross-site vulnerabilities. Your implementation should comply with the * HTTP/1.1 specification, which includes handling both requests which include * a Content-Length header and requests utilizing <code>Transfer-Encoding: * chuncked</code>. * * @param request the incoming request * @return the content of the incoming request encoded as a string. */ protected String readContent(HttpServletRequest request) throws ServletException, IOException { return RPCServletUtils.readContentAsGwtRpc(request); }
@Override protected String readContent(HttpServletRequest request) throws ServletException, IOException { if (request.getMethod() != null && request.getMethod().toLowerCase().equals("get")) { return request.getQueryString(); } return RPCServletUtils.readContentAsGwtRpc(request); }
@Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String requestURI = request.getRequestURI(); if (requestURI.endsWith("/junithost/error")) { String msg = RPCServletUtils.readContentAsGwtRpc(request); System.err.println("Warning: " + msg); } else if (requestURI.endsWith("/junithost/error/fatal")) { String msg = RPCServletUtils.readContentAsGwtRpc(request); System.err.println("Fatal error: " + msg); System.exit(1); } else if (requestURI.endsWith("/junithost/error/launch")) { String requestPayload = RPCServletUtils.readContentAsGwtRpc(request); JUnitResult result = new JUnitResult(); initResult(request, result); result.setException(new JUnitFatalLaunchException(requestPayload)); getHost().reportFatalLaunch(createNewClientInfo(request), result); } else { super.service(request, response); } }
@Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String requestURI = request.getRequestURI(); if (requestURI.endsWith("/junithost/error")) { String msg = RPCServletUtils.readContentAsGwtRpc(request); System.err.println("Warning: " + msg); } else if (requestURI.endsWith("/junithost/error/fatal")) { String msg = RPCServletUtils.readContentAsGwtRpc(request); System.err.println("Fatal error: " + msg); System.exit(1); } else if (requestURI.endsWith("/junithost/error/launch")) { String requestPayload = RPCServletUtils.readContentAsGwtRpc(request); JUnitResult result = new JUnitResult(); initResult(request, result); result.setException(new JUnitFatalLaunchException(requestPayload)); getHost().reportFatalLaunch(createNewClientInfo(request), result); } else { super.service(request, response); } }
@RequestMapping(value = "/commandService", method = RequestMethod.POST) public void processPostRpc(HttpServletRequest request, HttpServletResponse response) throws Throwable { try { String requestPayload = RPCServletUtils.readContentAsGwtRpc(request); RPCRequest rpcRequest = RPC.decodeRequest(requestPayload, CommandService.class, this); String responsePayload = RPC.invokeAndEncodeResponse(commandService, rpcRequest.getMethod(), rpcRequest.getParameters(), rpcRequest.getSerializationPolicy(), rpcRequest.getFlags()); boolean gzipEncode = RPCServletUtils.acceptsGzipEncoding(request) && RPCServletUtils.exceedsUncompressedContentLengthLimit(responsePayload); RPCServletUtils.writeResponse(null, response, responsePayload, gzipEncode); } catch (Exception e) { this.logger.error("Request processing failed", e); throw Throwables.propagate(e); } }