|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.google.gwt.user.server.rpc.RemoteServiceServlet
org.gwtwidgets.server.spring.GWTRPCServiceExporter
public class GWTRPCServiceExporter
This component publishes an object (see setService(Object)) as a
service to the GWT RPC protocol. Service targets can be:
setServiceInterfaces(Class[]))RemoteService
| Field Summary | |
|---|---|
static int |
COMPRESSION_AUTO
Leave default RPC response compression behavior. |
static int |
COMPRESSION_DISABLED
Disable RPC response compression. |
static int |
COMPRESSION_ENABLED
Force compression of all RPC responses. |
protected int |
compressResponse
|
protected org.apache.commons.logging.Log |
logger
|
protected java.util.Map<java.lang.reflect.Method,java.lang.reflect.Method> |
methodCache
|
protected java.lang.Object |
service
|
protected java.lang.Class<?>[] |
serviceInterfaces
|
protected javax.servlet.ServletContext |
servletContext
|
| Constructor Summary | |
|---|---|
GWTRPCServiceExporter()
|
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
|
protected java.lang.reflect.Method |
getMethodToInvoke(java.lang.reflect.Method decodedMethod)
Returns method to invoke on service. |
static javax.servlet.http.HttpServletRequest |
getRequest()
Deprecated. Use ServletUtils.getRequest() |
static javax.servlet.http.HttpServletResponse |
getResponse()
Deprecated. Use ServletUtils.getResponse() |
java.lang.Object |
getService()
Return target service. |
javax.servlet.ServletContext |
getServletContext()
|
protected java.lang.String |
handleExporterProcessingException(java.lang.Exception e)
Invoked by processCall(String) for an exception if no suitable
exception handler was found. |
protected java.lang.String |
handleIllegalAccessException(java.lang.IllegalAccessException e,
java.lang.Object service,
java.lang.reflect.Method targetMethod,
com.google.gwt.user.server.rpc.RPCRequest rpcRequest)
Handles an exception which is raised when a method access is attempted to a method which is not part of the RPC interface. |
protected java.lang.String |
handleIllegalArgumentException(java.lang.IllegalArgumentException e,
java.lang.Object service,
java.lang.reflect.Method targetMethod,
com.google.gwt.user.server.rpc.RPCRequest rpcRequest)
Handles an exception which is raised when a method invocation with bad arguments is attempted. |
protected java.lang.String |
handleIncompatibleRemoteServiceException(com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException e)
Invoked by processCall(String) when RPC throws an
IncompatibleRemoteServiceException. |
protected java.lang.String |
handleInvocationTargetException(java.lang.reflect.InvocationTargetException e,
java.lang.Object service,
java.lang.reflect.Method targetMethod,
com.google.gwt.user.server.rpc.RPCRequest rpcRequest)
Handles exceptions thrown by the target service, which are wrapped in InvocationTargetExceptions due to invocation by reflection. |
void |
handleRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
protected java.lang.String |
handleServiceException(java.lang.Exception e,
java.lang.Object service,
java.lang.reflect.Method targetMethod,
com.google.gwt.user.server.rpc.RPCRequest rpcRequest)
Handles exceptions thrown during a service invocation that are not handled by other exception handlers. |
protected java.lang.String |
handleUndeclaredThrowableException(java.lang.Exception e,
java.lang.Object service,
java.lang.reflect.Method targetMethod,
com.google.gwt.user.server.rpc.RPCRequest rpcRequest)
Handles UndeclaredThrowableExceptions which are thrown by the
target service. |
protected java.lang.String |
invokeMethodOnService(java.lang.Object service,
java.lang.reflect.Method targetMethod,
java.lang.Object[] targetParameters,
com.google.gwt.user.server.rpc.RPCRequest rpcRequest)
Handles method invocation on a service and is invoked by processCall(String). |
protected void |
onAfterResponseSerialized(java.lang.String serializedResponse)
|
protected void |
onBeforeRequestDeserialized(java.lang.String serializedRequest)
|
java.lang.String |
processCall(java.lang.String payload)
Overridden from RemoteServiceServlet and invoked by the servlet
code. |
protected void |
setCompressResponse(int compressResponse)
Enables or disables compression of RPC output. |
void |
setService(java.lang.Object service)
Set the service service. |
void |
setServiceInterfaces(java.lang.Class<?>[] serviceInterfaces)
Specifies the interfaces which must be implemented by the service bean. |
void |
setServletContext(javax.servlet.ServletContext servletContext)
Implementation of ServletContextAware, is invoked by the Spring
application context. |
protected boolean |
shouldCompressResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String responsePayload)
|
| Methods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServlet |
|---|
doGetSerializationPolicy, doPost, doUnexpectedFailure, getSerializationPolicy, getThreadLocalRequest, getThreadLocalResponse |
| 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, getServletInfo, getServletName, init, init, log, log |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int COMPRESSION_DISABLED
public static final int COMPRESSION_AUTO
public static final int COMPRESSION_ENABLED
protected org.apache.commons.logging.Log logger
protected java.lang.Class<?>[] serviceInterfaces
protected java.lang.Object service
protected javax.servlet.ServletContext servletContext
protected int compressResponse
protected java.util.Map<java.lang.reflect.Method,java.lang.reflect.Method> methodCache
| Constructor Detail |
|---|
public GWTRPCServiceExporter()
| Method Detail |
|---|
public void setServletContext(javax.servlet.ServletContext servletContext)
ServletContextAware, is invoked by the Spring
application context.
setServletContext in interface org.springframework.web.context.ServletContextAwareservletContext - public javax.servlet.ServletContext getServletContext()
getServletContext in interface javax.servlet.ServletConfiggetServletContext in class javax.servlet.GenericServletpublic static javax.servlet.http.HttpServletRequest getRequest()
ServletUtils.getRequest()
public static javax.servlet.http.HttpServletResponse getResponse()
ServletUtils.getResponse()
protected void onAfterResponseSerialized(java.lang.String serializedResponse)
onAfterResponseSerialized in class com.google.gwt.user.server.rpc.RemoteServiceServletprotected void onBeforeRequestDeserialized(java.lang.String serializedRequest)
onBeforeRequestDeserialized in class com.google.gwt.user.server.rpc.RemoteServiceServlet
protected java.lang.String invokeMethodOnService(java.lang.Object service,
java.lang.reflect.Method targetMethod,
java.lang.Object[] targetParameters,
com.google.gwt.user.server.rpc.RPCRequest rpcRequest)
throws java.lang.Exception
processCall(String).
service - Service to invoke method ontargetMethod - Method to invoke.targetParameters - Parameters to pass to method. Can be null for no arguments.rpcRequest - RPCRequest instance for this request
java.lang.Exception
protected java.lang.String handleIllegalArgumentException(java.lang.IllegalArgumentException e,
java.lang.Object service,
java.lang.reflect.Method targetMethod,
com.google.gwt.user.server.rpc.RPCRequest rpcRequest)
SecurityException. For details on arguments please consult
invokeMethodOnService(Object, Method, Object[], RPCRequest).
e - Exception thrownservice - targetMethod -
protected java.lang.String handleIllegalAccessException(java.lang.IllegalAccessException e,
java.lang.Object service,
java.lang.reflect.Method targetMethod,
com.google.gwt.user.server.rpc.RPCRequest rpcRequest)
processCall(String). This implementation throws a
SecurityException. For details on arguments please consult
invokeMethodOnService(Object, Method, Object[], RPCRequest).
e - Exception thrownservice - targetMethod -
protected java.lang.String handleInvocationTargetException(java.lang.reflect.InvocationTargetException e,
java.lang.Object service,
java.lang.reflect.Method targetMethod,
com.google.gwt.user.server.rpc.RPCRequest rpcRequest)
throws java.lang.Exception
InvocationTargetExceptions due to invocation by reflection. This
method is invoked by processCall(String). This implementation
encodes exceptions as RPC errors and returns them. For details on
arguments please consult
invokeMethodOnService(Object, Method, Object[], RPCRequest).
e - Exception thrownservice - targetMethod - rpcRequest -
java.lang.Exception
protected java.lang.String handleServiceException(java.lang.Exception e,
java.lang.Object service,
java.lang.reflect.Method targetMethod,
com.google.gwt.user.server.rpc.RPCRequest rpcRequest)
throws java.lang.Exception
processCall(String) on
exceptions which have escaped the other exception handlers such as
handleIllegalAccessException(IllegalAccessException, Object, Method, RPCRequest)
etc. This implementation re-casts 'e'. For details on arguments please
consult
invokeMethodOnService(Object, Method, Object[], RPCRequest).
e - Exception thrownservice - targetMethod - rpcRequest -
java.lang.Exception
protected java.lang.String handleUndeclaredThrowableException(java.lang.Exception e,
java.lang.Object service,
java.lang.reflect.Method targetMethod,
com.google.gwt.user.server.rpc.RPCRequest rpcRequest)
throws java.lang.Exception
UndeclaredThrowableExceptions which are thrown by the
target service. This method This method is invoked by
processCall(String). This implementation re-casts 'e'. For
details on arguments please consult
invokeMethodOnService(Object, Method, Object[], RPCRequest).
e - Exception thrownservice - targetMethod - rpcRequest -
java.lang.Exception
protected java.lang.reflect.Method getMethodToInvoke(java.lang.reflect.Method decodedMethod)
throws java.lang.NoSuchMethodException
ReflectionUtils.getRPCMethod(Object, Class[], Method)
decodedMethod - Method as determined by RPC
java.lang.NoSuchMethodException
public java.lang.String processCall(java.lang.String payload)
throws com.google.gwt.user.client.rpc.SerializationException
RemoteServiceServlet and invoked by the servlet
code.
processCall in class com.google.gwt.user.server.rpc.RemoteServiceServletcom.google.gwt.user.client.rpc.SerializationException
protected java.lang.String handleIncompatibleRemoteServiceException(com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException e)
throws com.google.gwt.user.client.rpc.SerializationException
processCall(String) when RPC throws an
IncompatibleRemoteServiceException. This implementation
propagates the exception back to the client via RPC.
e - Exception thrown
com.google.gwt.user.client.rpc.SerializationExceptionprotected java.lang.String handleExporterProcessingException(java.lang.Exception e)
processCall(String) for an exception if no suitable
exception handler was found. This is the outermost exception handler,
catching any exceptions not caught by other exception handlers or even
thrown by those handlers. This implementation wraps 'e' in a
RuntimeException which is then thrown.
e -
public void setService(java.lang.Object service)
service -
public void handleRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
handleRequest in interface org.springframework.web.HttpRequestHandlerjavax.servlet.ServletException
java.io.IOExceptionpublic void setServiceInterfaces(java.lang.Class<?>[] serviceInterfaces)
RemoteService which
is implemented by the service bean is assumed.
serviceInterfaces -
public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionpublic java.lang.Object getService()
GWTRPCServiceExporter has a single
target service which it redirects RPC to.
protected boolean shouldCompressResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String responsePayload)
shouldCompressResponse in class com.google.gwt.user.server.rpc.RemoteServiceServletprotected void setCompressResponse(int compressResponse)
COMPRESSION_AUTO. Allowed values are
COMPRESSION_ENABLED, COMPRESSION_DISABLED and
COMPRESSION_AUTO.
compressResponse -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||