Expose delegate constructor.
Review by: jat@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9991 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/server/rpc/AbstractXsrfProtectedServiceServlet.java b/user/src/com/google/gwt/user/server/rpc/AbstractXsrfProtectedServiceServlet.java
index b925019..ad716d8 100644
--- a/user/src/com/google/gwt/user/server/rpc/AbstractXsrfProtectedServiceServlet.java
+++ b/user/src/com/google/gwt/user/server/rpc/AbstractXsrfProtectedServiceServlet.java
@@ -42,6 +42,24 @@
public abstract class AbstractXsrfProtectedServiceServlet extends
RemoteServiceServlet {
+ /**
+ * The default constructor used by service implementations that
+ * extend this class. The servlet will delegate AJAX requests to
+ * the appropriate method in the subclass.
+ */
+ public AbstractXsrfProtectedServiceServlet() {
+ super();
+ }
+
+ /**
+ * 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.
+ */
+ public AbstractXsrfProtectedServiceServlet(Object delegate) {
+ super(delegate);
+ }
+
@Override
protected void onAfterRequestDeserialized(RPCRequest rpcRequest) {
if (shouldValidateXsrfToken(rpcRequest.getMethod())) {
diff --git a/user/src/com/google/gwt/user/server/rpc/XsrfProtectedServiceServlet.java b/user/src/com/google/gwt/user/server/rpc/XsrfProtectedServiceServlet.java
index 0986340..5a6c062 100644
--- a/user/src/com/google/gwt/user/server/rpc/XsrfProtectedServiceServlet.java
+++ b/user/src/com/google/gwt/user/server/rpc/XsrfProtectedServiceServlet.java
@@ -64,6 +64,16 @@
this.sessionCookieName = sessionCookieName;
}
+ public XsrfProtectedServiceServlet(Object delegate) {
+ this(delegate, null);
+ }
+
+ public XsrfProtectedServiceServlet(Object delegate,
+ String sessionCookieName) {
+ super(delegate);
+ this.sessionCookieName = sessionCookieName;
+ }
+
@Override
public void init() throws ServletException {
super.init();
diff --git a/user/src/com/google/gwt/user/server/rpc/XsrfTokenServiceServlet.java b/user/src/com/google/gwt/user/server/rpc/XsrfTokenServiceServlet.java
index dc631ca..fa5343d 100644
--- a/user/src/com/google/gwt/user/server/rpc/XsrfTokenServiceServlet.java
+++ b/user/src/com/google/gwt/user/server/rpc/XsrfTokenServiceServlet.java
@@ -94,7 +94,7 @@
* public void onSuccess(XsrfToken result) {
* MyRpcServiceAsync rpc = (MyRpcServiceAsync)GWT.create(MyRpcService.class);
* ((HasRpcToken) rpc).setRpcToken(result);
- * // make XSRF protection RPC calls using
+ * // make XSRF protected RPC call
* rpc.doStuff(new AsyncCallback<Void>() {
* // ...
* });