[jboss-cvs] jboss-seam/src/remoting/org/jboss/seam/remoting/gwt ...
Shane Bryzak
sbryzak at redhat.com
Mon Oct 1 22:53:33 EDT 2007
User: sbryzak2
Date: 07/10/01 22:53:33
Modified: src/remoting/org/jboss/seam/remoting/gwt
GWTRemoteService.java
Log:
JBSEAM-1965 create session before writing response
Revision Changes Path
1.6 +63 -33 jboss-seam/src/remoting/org/jboss/seam/remoting/gwt/GWTRemoteService.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: GWTRemoteService.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/remoting/org/jboss/seam/remoting/gwt/GWTRemoteService.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- GWTRemoteService.java 22 Jun 2007 15:46:53 -0000 1.5
+++ GWTRemoteService.java 2 Oct 2007 02:53:33 -0000 1.6
@@ -22,6 +22,7 @@
import org.jboss.seam.annotations.Startup;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.remoting.gwt.GWTToSeamAdapter.ReturnedObject;
+import org.jboss.seam.servlet.ContextualHttpServletRequest;
import org.jboss.seam.web.AbstractResource;
import com.google.gwt.user.client.rpc.SerializableException;
@@ -159,15 +160,27 @@
* This is called internally.
*/
@Override
- public final void getResource(HttpServletRequest request,
- HttpServletResponse response) {
- Throwable caught;
- try {
+ public final void getResource(final HttpServletRequest request,
+ final HttpServletResponse response) throws ServletException, IOException
+ {
+ // We have to call getSession() before the response is written, as per the
+ // servlet API docs.
+ request.getSession(true);
+
+ try
+ {
// Store the request & response objects in thread-local storage.
- //
perThreadRequest.set(request);
perThreadResponse.set(response);
+ new ContextualHttpServletRequest(request)
+ {
+ @Override
+ public void process() throws Exception
+ {
+
+ Throwable caught;
+ try {
// Read the request fully.
//
String requestPayload = readPayloadAsUtf8(request);
@@ -194,6 +207,23 @@
respondWithFailure(response, caught);
}
+ @Override
+ protected void restoreConversationId()
+ {
+ // no conversation support for gwt requests
+ }
+
+ @Override
+ protected void handleConversationPropagation() {}
+ }.run();
+ }
+ finally
+ {
+ perThreadRequest.remove();
+ perThreadResponse.remove();
+ }
+ }
+
/**
* This is public so that it can be unit tested easily without HTTP.
*/
More information about the jboss-cvs-commits
mailing list