ASF Bugzilla – Attachment 23796 Details for
Bug 47298
enabled emptysessionpath not checking if route replacement is needed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Work around for undocumented behavior of emptySessionPath
RewriteJvmRouteValve.java (text/plain), 2.72 KB, created by
Filip Hanik
on 2009-06-11 09:29:56 UTC
(
hide
)
Description:
Work around for undocumented behavior of emptySessionPath
Filename:
MIME Type:
Creator:
Filip Hanik
Created:
2009-06-11 09:29:56 UTC
Size:
2.72 KB
patch
obsolete
>/* > * Licensed to the Apache Software Foundation (ASF) under one or more > * contributor license agreements. See the NOTICE file distributed with > * this work for additional information regarding copyright ownership. > * The ASF licenses this file to You under the Apache License, Version 2.0 > * (the "License"); you may not use this file except in compliance with > * the License. You may obtain a copy of the License at > * > * http://www.apache.org/licenses/LICENSE-2.0 > * > * Unless required by applicable law or agreed to in writing, software > * distributed under the License is distributed on an "AS IS" BASIS, > * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > * See the License for the specific language governing permissions and > * limitations under the License. > */ >package org.apache.catalina.valves; > >import java.io.IOException; > >import javax.servlet.ServletException; > >import org.apache.catalina.Manager; >import org.apache.catalina.connector.Request; >import org.apache.catalina.connector.Response; >import org.apache.catalina.session.ManagerBase; > >public class RewriteJvmRouteValve extends ValveBase { > > public RewriteJvmRouteValve() { > > } > > @Override > public void invoke(Request request, Response response) throws IOException,ServletException { > String localRoute = getLocalJvmRoute(request); > String id = request.getRequestedSessionId(); > if (localRoute!=null && id!=null) { > rewriteJvmRoute(request,response,id,localRoute); > } > getNext().invoke(request, response); > } > > /** > * Copied from JvmRouteBinderValve > */ > protected Manager getManager(Request request) { > Manager manager = request.getContext().getManager(); > return manager; > } > > /** > * Copied from JvmRouteBinderValve > * get jvmroute from engine > * > * @param request current request > * @return return jvmRoute from ManagerBase or null > */ > protected String getLocalJvmRoute(Request request) { > Manager manager = getManager(request); > if(manager!=null && manager instanceof ManagerBase) > return ((ManagerBase) manager).getJvmRoute(); > else > return null ; > } > > protected void rewriteJvmRoute(Request request, Response response, String sessionId, String localRoute) { > // get requested jvmRoute. > String requestedJvmRoute = null; > int index = sessionId.indexOf("."); > > if (index > 0) > requestedJvmRoute = sessionId.substring(index + 1, sessionId.length()); > > if (requestedJvmRoute != null && !requestedJvmRoute.equals(localRoute)) { > String id = sessionId.substring(0, index); > String newSessionID = id + "." + localRoute; > request.setRequestedSessionId(newSessionID); > } > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 47298
: 23796