Author: heiko.braun(a)jboss.com
Date: 2008-02-28 14:06:49 -0500 (Thu, 28 Feb 2008)
New Revision: 5854
Modified:
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java
Log:
Enforce EndpointAssociation within RequestHandler
Modified:
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java
===================================================================
---
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java 2008-02-28
19:04:24 UTC (rev 5853)
+++
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java 2008-02-28
19:06:49 UTC (rev 5854)
@@ -61,20 +61,29 @@
ServletAdapter target = endpoint.getAttachment(ServletAdapter.class);
if(null == target)
throw new IllegalArgumentException("Cannot obtain ServletAdapter");
-
- String method = req.getMethod();
- if (method.equals("POST"))
+
+
+ EndpointAssociation.setEndpoint(endpoint);
+ try
{
- doPost(target, context, req, res);
+ String method = req.getMethod();
+ if (method.equals("POST"))
+ {
+ doPost(target, context, req, res);
+ }
+ else if(method.equals("GET"))
+ {
+ doGet(target, req, context, res);
+ }
+ else
+ {
+ throw new WebServiceException("Unsupported method: " + method);
+ }
}
- else if(method.equals("GET"))
+ finally
{
- doGet(target, req, context, res);
+ EndpointAssociation.removeEndpoint();
}
- else
- {
- throw new WebServiceException("Unsupported method: " + method);
- }
}
private void doGet(ServletAdapter target, HttpServletRequest req, ServletContext
context, HttpServletResponse res)
@@ -160,7 +169,7 @@
for(Object o : props.keySet())
{
String key = (String)o;
- streamContext.getRequestContext().put(key, props.getProperty(key));
+ streamContext.getRequestContext().put(key, props.getProperty(key));
}
}
@@ -173,7 +182,7 @@
}
finally
{
- EndpointAssociation.setEndpoint(null);
+ EndpointAssociation.removeEndpoint();
}
}