Author: dkulp
Date: Thu Jul 29 21:15:26 2010
New Revision: 980581
URL: http://svn.apache.org/viewvc?rev=980581&view=rev
Log:
Merged revisions 980573 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r980573 | dkulp | 2010-07-29 17:07:48 -0400 (Thu, 29 Jul 2010) | 2 lines
[CXF-2911] This can affect the http-jetty transport as well. Move it
into the method that is designed to cache the request.
........
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpServletRequestSnapshot.java
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=980581&r1=980580&r2=980581&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
(original)
+++
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Thu Jul 29 21:15:26 2010
@@ -275,13 +275,23 @@ public abstract class AbstractHTTPDestin
setupMessage(inMessage, null, context, req, resp);
}
- protected void setupMessage(Message inMessage,
+ protected void setupMessage(final Message inMessage,
final ServletConfig config,
final ServletContext context,
final HttpServletRequest req,
final HttpServletResponse resp) throws
IOException {
- DelegatingInputStream in = new
DelegatingInputStream(req.getInputStream());
+ DelegatingInputStream in = new
DelegatingInputStream(req.getInputStream()) {
+ public void cacheInput() {
+ if (!cached) {
+ //we need to cache the values of the HttpServletRequest
+ //so they can be queried later for things like paths and
schemes
+ //and such like that
+ inMessage.put(HTTP_REQUEST, new
HttpServletRequestSnapshot(req));
+ }
+ super.cacheInput();
+ }
+ };
inMessage.setContent(DelegatingInputStream.class, in);
inMessage.setContent(InputStream.class, in);
inMessage.put(HTTP_REQUEST, req);
Modified:
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpServletRequestSnapshot.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpServletRequestSnapshot.java?rev=980581&r1=980580&r2=980581&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpServletRequestSnapshot.java
(original)
+++
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpServletRequestSnapshot.java
Thu Jul 29 21:15:26 2010
@@ -37,7 +37,6 @@ public class HttpServletRequestSnapshot
private Cookie[] cookies;
private String localAddr;
private Locale local;
- @SuppressWarnings("unchecked")
private Enumeration locals;
private String localName;
private int localPort = -1;
@@ -63,7 +62,6 @@ public class HttpServletRequestSnapshot
new java.util.concurrent.ConcurrentHashMap<String,
Enumeration<String>>();
private String requestedSessionId;
- @SuppressWarnings("unchecked")
public HttpServletRequestSnapshot(HttpServletRequest request) {
super(request);
authType = request.getAuthType();
@@ -98,7 +96,9 @@ public class HttpServletRequestSnapshot
serverName = request.getServerName();
serverPort = request.getServerPort();
servletPath = request.getServletPath();
- session = request.getSession();
+ if (request.isRequestedSessionIdValid()) {
+ session = request.getSession();
+ }
principal = request.getUserPrincipal();
}
Modified:
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java?rev=980581&r1=980580&r2=980581&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
(original)
+++
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
Thu Jul 29 21:15:26 2010
@@ -35,7 +35,6 @@ import org.apache.cxf.service.model.Endp
import org.apache.cxf.transport.ConduitInitiator;
import org.apache.cxf.transport.http.AbstractHTTPDestination;
import org.apache.cxf.transport.http.HTTPSession;
-import org.apache.cxf.transport.http.HttpServletRequestSnapshot;
public class ServletDestination extends AbstractHTTPDestination {
@@ -90,10 +89,7 @@ public class ServletDestination extends
context,
req,
resp);
- //the HttpServletRequest will be recycled in another thread when the
operation
- //is oneway and WSA enabled. This SNAPSHOT request will be used in
tihs case.
-
- inMessage.put("HTTP.REQUEST.SNAPSHOT", new
HttpServletRequestSnapshot(req));
+
ExchangeImpl exchange = new ExchangeImpl();
exchange.setInMessage(inMessage);
exchange.setSession(new HTTPSession(req));
Modified:
cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?rev=980581&r1=980580&r2=980581&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
(original)
+++
cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
Thu Jul 29 21:15:26 2010
@@ -412,14 +412,7 @@ public final class ContextUtils {
// has been sent (i.e. to a oneway, or a partial
response
// to a decoupled twoway)
- //In tomcat container, the httpServletRequest will be
recycled/cleared in the
- //servlet thread. The values in request can not be
retrieved in the new created
- //thread after that . Replace it with
httpServletRequest snaphost.
- if (inMessage.get("HTTP.REQUEST") != null
- && inMessage.get("HTTP.REQUEST.SNAPSHOT") != null)
{
- inMessage.put("HTTP.REQUEST",
inMessage.get("HTTP.REQUEST.SNAPSHOT"));
-
- }
+
// pause dispatch on current thread ...
inMessage.getInterceptorChain().pause();