I just created a sample project using Spring 3.x, Jetty 9.x, GWT 2.5.1 and Gradle here. It's a slightly modified version of the 'Greeting' GWT application from Google, the only change being that RPC calls are handled by a spring controller. It would be really great if someone can review it, I am particularly apprehensive of injecting the GwtRpcController into the GreetingServiceImpl. Should I be worried about any thread safety issues?Main Controller@Controllerpublic class GwtRpcController extends RemoteServiceServlet {@Autowired private ServletContext servletContext;@Autowiredprivate RemoteService remoteService;private Class<?> remoteServiceClass;private HttpServletRequest request;@RequestMapping(value = /jettygwtspringsampleapp/*.rpc)public ModelAndView handleRequest( HttpServletRequest request, HttpServletResponse response ) throws Exception {    super.doPost( request, response );    return null;}@Overridepublic String processCall( String payload ) throws SerializationException {    try {        RPCRequest rpcRequest = RPC.decodeRequest( payload, this.remoteServiceClass );        // delegate work to the spring injected service        return RPC.invokeAndEncodeResponse( this.remoteService, rpcRequest.getMethod(), rpcRequest.getParameters() );    } catch ( IncompatibleRemoteServiceException ex ) {        getServletContext().log( An IncompatibleRemoteServiceException was thrown while processing this call., ex );        return RPC.encodeResponseForFailure( null, ex );    }}@Overridepublic ServletContext getServletContext() {    return servletContext;}public void setServletContext( ServletContext servletContext ) {    this.servletContext = servletContext;}public void setRemoteService( RemoteService remoteService ) {    this.remoteService = remoteService;    this.remoteServiceClass = this.remoteService.getClass();}public HttpServletRequest getThreadLocalHttpRequest() {    return getThreadLocalRequest();}}Service implementation@Configurationpublic class GreetingServiceImpl implements GreetingService {@AutowiredGwtRpcController rpcController;public String greetServer( String input ) throws IllegalArgumentException {    // Verify that the input is valid.    if ( !FieldVerifier.isValidName( input ) ) {        // If the input is not valid, throw an IllegalArgumentException back to        // the client.        throw new IllegalArgumentException( Name must be at least 4 characters long );    }    String serverInfo = rpcController.getServletContext().getServerInfo();    String userAgent = rpcController.getThreadLocalHttpRequest().getHeader( User-Agent );    // Escape data from the client to avoid cross-site script vulnerabilities.    input = escapeHtml( input );    userAgent = escapeHtml( userAgent );    return Hello,  + input + !<br><br>I am running  + serverInfo + .<br><br>It looks like you are using:<br> + userAgent;}..........
JettyGwtSpringSample web application
java;thread safety;spring;gradle;gwt