Package com.google.gwt.user.server.rpc
Class AbstractXsrfProtectedServiceServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
com.google.gwt.user.server.rpc.RemoteServiceServlet
com.google.gwt.user.server.rpc.AbstractXsrfProtectedServiceServlet
- All Implemented Interfaces:
SerializationPolicyProvider,Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
- Direct Known Subclasses:
XsrfProtectedServiceServlet
An abstract class for XSRF protected RPC service implementations, which
decides if XSRF protection should be enforced on a method invocation based
on the following logic:
- RPC interface or method can be annotated with either
XsrfProtectorNoXsrfProtectannotation to enable or disable XSRF protection on all methods of an RPC interface or a single method correspondingly. - RPC interface level annotation can be overridden by a method level annotation.
- If no annotations are present and RPC interface contains method that
returns
RpcTokenor its implementation, then XSRF token validation is performed on all methods of that interface except for the method returningRpcToken.
- See Also:
-
Field Summary
Fields inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
perThreadRequest, perThreadResponse -
Constructor Summary
ConstructorsConstructorDescriptionThe default constructor used by service implementations that extend this class.AbstractXsrfProtectedServiceServlet(Object delegate) The wrapping constructor used by service implementations that are separate from this class. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidonAfterRequestDeserialized(RPCRequest rpcRequest) Override this method to examine the deserialized version of the request before the call to the servlet method is made.protected booleanshouldValidateXsrfToken(Method method) Override this method to change default XSRF enforcement logic.protected abstract voidvalidateXsrfToken(RpcToken token, Method method) Override this method to perform XSRF token verification.Methods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServlet
checkPermutationStrongName, doGetSerializationPolicy, getCodeServerPolicyUrl, getRequestModuleBasePath, getSerializationPolicy, init, loadPolicyFromCodeServer, loadSerializationPolicy, onAfterResponseSerialized, onBeforeRequestDeserialized, processCall, processCall, processPost, shouldCompressResponseMethods inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
doPost, doUnexpectedFailure, getPermutationStrongName, getThreadLocalRequest, getThreadLocalResponse, readContentMethods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service, serviceMethods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
AbstractXsrfProtectedServiceServlet
public AbstractXsrfProtectedServiceServlet()The default constructor used by service implementations that extend this class. The servlet will delegate AJAX requests to the appropriate method in the subclass. -
AbstractXsrfProtectedServiceServlet
The wrapping constructor used by service implementations that are separate from this class. The servlet will delegate AJAX requests to the appropriate method in the given object.
-
-
Method Details
-
onAfterRequestDeserialized
Description copied from class:AbstractRemoteServiceServletOverride this method to examine the deserialized version of the request before the call to the servlet method is made. The default implementation does nothing and need not be called by subclasses.- Overrides:
onAfterRequestDeserializedin classAbstractRemoteServiceServlet- Parameters:
rpcRequest-
-
shouldValidateXsrfToken
Override this method to change default XSRF enforcement logic.- Parameters:
method- Method being invoked- Returns:
trueif XSRF token should be verified,falseotherwise
-
validateXsrfToken
Override this method to perform XSRF token verification.- Parameters:
token-RpcTokenincluded with an RPC request.method- method being invoked via this RPC call.- Throws:
RpcTokenException- if token verification failed.
-