public class HybridServiceServlet extends RpcServlet implements SerializationPolicyProvider
This RemoteServiceServlet provides support for both legacy and deRPC clients at the cost of additional runtime overhead and API complexity.
CLIENT_ORACLE_EXTENSION
perThreadRequest, perThreadResponse
Constructor and Description |
---|
HybridServiceServlet() |
Modifier and Type | Method and Description |
---|---|
protected SerializationPolicy |
doGetSerializationPolicy(javax.servlet.http.HttpServletRequest request,
String moduleBaseURL,
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(String moduleBaseURL,
String strongName)
Returns a
SerializationPolicy for a given module base URL and
serialization policy strong name. |
protected void |
onAfterResponseSerialized(String serializedResponse) |
void |
processCall(ClientOracle clientOracle,
String payload,
OutputStream stream)
Process a call originating from the given request.
|
String |
processCall(String payload) |
allowHostedModeConnections, findClientOracleData, getRequestModuleBasePath, processPost, shouldCompressResponse
doPost, doUnexpectedFailure, getPermutationStrongName, getThreadLocalRequest, getThreadLocalResponse, onAfterRequestDeserialized, readContent
doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service, service
public ClientOracle getClientOracle()
null
instead of throwing an exception.getClientOracle
in class RpcServlet
public final SerializationPolicy getSerializationPolicy(String moduleBaseURL, String strongName)
SerializationPolicyProvider
SerializationPolicy
for a given module base URL and
serialization policy strong name.getSerializationPolicy
in interface SerializationPolicyProvider
moduleBaseURL
- the URL for the modulestrongName
- strong name of the serialization
policy for the specified module URLSerializationPolicy
for a given module base URL and RPC
strong name; must not return null
public void processCall(ClientOracle clientOracle, String payload, OutputStream stream) throws SerializationException
RpcServlet
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.
processCall
in class RpcServlet
clientOracle
- the ClientOracle that will be used to interpret the
requestpayload
- the UTF-8 request payloadstream
- the OutputStream that will receive the encoded responseSerializationException
- if we cannot serialize the responsepublic String processCall(String payload) throws SerializationException
SerializationException
protected SerializationPolicy doGetSerializationPolicy(javax.servlet.http.HttpServletRequest request, String moduleBaseURL, String strongName)
SerializationPolicy
for given module base URL and strong
name if there is one.
Override this method to provide a SerializationPolicy
using an
alternative approach.request
- the HTTP request being servicedmoduleBaseURL
- as specified in the incoming payloadstrongName
- a strong name that uniquely identifies a serialization
policy fileSerializationPolicy
for the given module base URL and
strong name, or null
if there is noneprotected void onAfterResponseSerialized(String serializedResponse)
serializedResponse
- Copyright © 2018. All rights reserved.