GWT 2.0.3

com.google.gwt.user.server.rpc
Class HybridServiceServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
              extended by com.google.gwt.rpc.server.RpcServlet
                  extended by com.google.gwt.user.server.rpc.HybridServiceServlet
All Implemented Interfaces:
SerializationPolicyProvider, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class HybridServiceServlet
extends RpcServlet
implements SerializationPolicyProvider

EXPERIMENTAL and subject to change. Do not use this in production code.

This RemoteServiceServlet provides support for both legacy and deRPC clients at the cost of additional runtime overhead and API complexity.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.google.gwt.rpc.server.RpcServlet
CLIENT_ORACLE_EXTENSION
 
Fields inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
perThreadRequest, perThreadResponse
 
Constructor Summary
HybridServiceServlet()
           
 
Method Summary
protected  SerializationPolicy doGetSerializationPolicy(javax.servlet.http.HttpServletRequest request, java.lang.String moduleBaseURL, java.lang.String strongName)
          Gets the SerializationPolicy for given module base URL and strong name if there is one.
 ClientOracle getClientOracle()
          This method will return null instead of throwing an exception.
 SerializationPolicy getSerializationPolicy(java.lang.String moduleBaseURL, java.lang.String strongName)
          Returns a SerializationPolicy for a given module base URL and serialization policy strong name.
protected  void onAfterResponseSerialized(java.lang.String serializedResponse)
           
 void processCall(ClientOracle clientOracle, java.lang.String payload, java.io.OutputStream stream)
          Process a call originating from the given request.
 java.lang.String processCall(java.lang.String payload)
           
 
Methods inherited from class com.google.gwt.rpc.server.RpcServlet
allowHostedModeConnections, findClientOracleData, getRequestModuleBasePath, processPost, shouldCompressResponse
 
Methods inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
doPost, doUnexpectedFailure, getPermutationStrongName, getThreadLocalRequest, getThreadLocalResponse, onAfterRequestDeserialized, readContent
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HybridServiceServlet

public HybridServiceServlet()
Method Detail

getClientOracle

public ClientOracle getClientOracle()
This method will return null instead of throwing an exception.

Overrides:
getClientOracle in class RpcServlet

getSerializationPolicy

public final SerializationPolicy getSerializationPolicy(java.lang.String moduleBaseURL,
                                                        java.lang.String strongName)
Description copied from interface: SerializationPolicyProvider
Returns a SerializationPolicy for a given module base URL and serialization policy strong name.

Specified by:
getSerializationPolicy in interface SerializationPolicyProvider
Parameters:
moduleBaseURL - the URL for the module
strongName - strong name of the serialization policy for the specified module URL
Returns:
a SerializationPolicy for a given module base URL and RPC strong name; must not return null

processCall

public void processCall(ClientOracle clientOracle,
                        java.lang.String payload,
                        java.io.OutputStream stream)
                 throws SerializationException
Description copied from class: RpcServlet
Process a call originating from the given request. Uses the RPC.invokeAndStreamResponse(Object, java.lang.reflect.Method, Object[], ClientOracle, OutputStream) method to do the actual work.

Subclasses may optionally override this method to handle the payload in any way they desire (by routing the request to a framework component, for instance). The HttpServletRequest and HttpServletResponse can be accessed via the AbstractRemoteServiceServlet.getThreadLocalRequest() and AbstractRemoteServiceServlet.getThreadLocalResponse() methods.

This is public so that it can be unit tested easily without HTTP.

Overrides:
processCall in class RpcServlet
Parameters:
clientOracle - the ClientOracle that will be used to interpret the request
payload - the UTF-8 request payload
stream - the OutputStream that will receive the encoded response
Throws:
SerializationException - if we cannot serialize the response

processCall

public java.lang.String processCall(java.lang.String payload)
                             throws SerializationException
Throws:
SerializationException

doGetSerializationPolicy

protected SerializationPolicy doGetSerializationPolicy(javax.servlet.http.HttpServletRequest request,
                                                       java.lang.String moduleBaseURL,
                                                       java.lang.String strongName)
Gets the SerializationPolicy for given module base URL and strong name if there is one. Override this method to provide a SerializationPolicy using an alternative approach.

Parameters:
request - the HTTP request being serviced
moduleBaseURL - as specified in the incoming payload
strongName - a strong name that uniquely identifies a serialization policy file
Returns:
a SerializationPolicy for the given module base URL and strong name, or null if there is none

onAfterResponseSerialized

protected void onAfterResponseSerialized(java.lang.String serializedResponse)
Parameters:
serializedResponse -

GWT 2.0.3