Author: kkolinko
Date: Sun Jun 22 13:46:58 2014
New Revision: 1604574
URL: http://svn.apache.org/r1604574
Log:
Simplify code, no functional change.
This makes it clear that setting "mapRequired = true;" and
"getMappingData().recycle();" call are always performed together.
Backport of r1604484, r1604496 from tomcat/trunk.
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1604484-1604496
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=1604574&r1=1604573&r2=1604574&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
Sun Jun 22 13:46:58 2014
@@ -717,11 +717,6 @@ public class CoyoteAdapter implements Ad
request.setContext((Context) request.getMappingData().context);
request.setWrapper((Wrapper) request.getMappingData().wrapper);
- // Single contextVersion therefore no possibility of remap
- if (request.getMappingData().contexts == null) {
- mapRequired = false;
- }
-
// If there is no context at this point, it is likely no ROOT
context
// has been deployed
if (request.getContext() == null) {
@@ -739,7 +734,7 @@ public class CoyoteAdapter implements Ad
// Now we have the context, we can parse the session ID from the
URL
// (if any). Need to do this before we redirect in case we need to
// include the session id in the redirect
- String sessionID = null;
+ String sessionID;
if (request.getServletContext().getEffectiveSessionTrackingModes()
.contains(SessionTrackingMode.URL)) {
@@ -760,32 +755,27 @@ public class CoyoteAdapter implements Ad
sessionID = request.getRequestedSessionId();
if (mapRequired) {
- if (sessionID == null) {
- // No session means no possibility of needing to remap
- mapRequired = false;
- } else {
+ mapRequired = false;
+ Object[] contexts = request.getMappingData().contexts;
+ // Single contextVersion means no need to remap
+ // No session ID means no possibility of remap
+ if (contexts != null && sessionID != null) {
// Find the context associated with the session
- Object[] objs = request.getMappingData().contexts;
- for (int i = (objs.length); i > 0; i--) {
- Context ctxt = (Context) objs[i - 1];
+ for (int i = (contexts.length); i > 0; i--) {
+ Context ctxt = (Context) contexts[i - 1];
if (ctxt.getManager().findSession(sessionID) != null) {
// Was the correct context already mapped?
- if (ctxt.equals(request.getMappingData().context))
{
- mapRequired = false;
- } else {
+ if
(!ctxt.equals(request.getMappingData().context)) {
// Set version so second time through mapping
the
// correct context is found
version = ctxt.getWebappVersion();
// Reset mapping
request.getMappingData().recycle();
+ mapRequired = true;
break;
}
}
}
- if (version == null) {
- // No matching context found. No need to re-map
- mapRequired = false;
- }
}
}
if (!mapRequired && request.getContext().getPaused()) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]