Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 21566 invoked from network); 30 Jul 2008 16:52:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Jul 2008 16:52:40 -0000 Received: (qmail 32587 invoked by uid 500); 30 Jul 2008 16:52:28 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 32561 invoked by uid 500); 30 Jul 2008 16:52:28 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 32550 invoked by uid 99); 30 Jul 2008 16:52:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jul 2008 09:52:28 -0700 X-ASF-Spam-Status: No, hits=3.7 required=10.0 tests=DNS_FROM_OPENWHOIS,FORGED_HOTMAIL_RCVD2,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG,WHOIS_NETSOLPR X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jul 2008 16:51:32 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1KOEu5-0006j0-TQ for users@tomcat.apache.org; Wed, 30 Jul 2008 09:51:57 -0700 Message-ID: <18737761.post@talk.nabble.com> Date: Wed, 30 Jul 2008 09:51:57 -0700 (PDT) From: RocketRonz To: users@tomcat.apache.org Subject: Adding contextPath to request using a Valve MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: ronnybatty@hotmail.com X-Virus-Checked: Checked by ClamAV on apache.org I'm trying to automatically assign a context path to requests from a specific URL using a Valve, so in the following example code requests to the URL http://www.site2.com should hit my in server.xml with the path "/site2" : public void invoke(Request request, Response response) throws java.io.IOException, javax.servlet.ServletException { if(request.getRequestURL().indexOf("www.site2.com") != -1) { request.setContextPath("/site2"); System.out.println("Context path set to " + request.getContextPath()); } getNext().invoke(request, response); } The system out is being called so I would have expected the same behaviour that I get when I type http://www.site2.com/site2 into the browser. However, the default is being hit. Is this something anyone has tried to do using a Valve or is there any better way to achieve this kind of behaviour. Any advice would be very much appreciated. Ronny. -- View this message in context: http://www.nabble.com/Adding-contextPath-to-request-using-a-Valve-tp18737761p18737761.html Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org