[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/transport/servlet ...
Ron Sigal
ron_sigal at yahoo.com
Tue Oct 9 18:24:16 EDT 2007
User: rsigal
Date: 07/10/09 18:24:16
Modified: src/main/org/jboss/remoting/transport/servlet Tag:
remoting_2_2_0_GA ServletServerInvoker.java
Log:
JBREM-813: Added code that allows returning an actual exception.
Revision Changes Path
No revision
No revision
1.8.4.2.4.2 +36 -1 JBossRemoting/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ServletServerInvoker.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java,v
retrieving revision 1.8.4.2.4.1
retrieving revision 1.8.4.2.4.2
diff -u -b -r1.8.4.2.4.1 -r1.8.4.2.4.2
--- ServletServerInvoker.java 9 May 2007 08:40:18 -0000 1.8.4.2.4.1
+++ ServletServerInvoker.java 9 Oct 2007 22:24:16 -0000 1.8.4.2.4.2
@@ -23,6 +23,7 @@
package org.jboss.remoting.transport.servlet;
import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvocationResponse;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.Version;
import org.jboss.remoting.marshal.MarshalFactory;
@@ -234,8 +235,18 @@
{
log.debug("Error thrown calling invoke on server invoker.", ex);
invocationResponse = ex;
+
+ if (checkForExceptionReturn(metadata))
+ {
+ String sessionId = invocationRequest.getSessionId();
+ ServletThrowable st = new ServletThrowable(ex);
+ invocationResponse = new InvocationResponse(sessionId, st, true, null);
+ }
+ else
+ {
isError = true;
}
+ }
//Start with response code of 204 (no content), then if is a return from handler, change to 200 (ok)
int status = 204;
@@ -301,4 +312,28 @@
return retval;
}
+
+ private boolean checkForExceptionReturn(Map headers)
+ {
+ boolean flag = false;
+
+ if(headers != null)
+ {
+ Object val = headers.get(HTTPMetadataConstants.RETURN_EXCEPTION);
+ if (val != null)
+ {
+ if (val instanceof String)
+ {
+ flag = Boolean.valueOf((String) val).booleanValue();
+ }
+ else if (val instanceof String[])
+ {
+ String param = ((String[]) val)[0];
+ flag = Boolean.valueOf(param).booleanValue();
+ }
+ }
+ }
+
+ return flag;
+ }
}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list