Solved

servlet filters and  multiple applications in tomcat

Posted on 2004-08-10
4
206 Views
Last Modified: 2013-11-24
Is there a way to configure tomcat so i can reference one application from within another?  specifically I want a servlet filter to catch a request to a resource in tomcat_home/webapps/app_A and have it handled by a servlet in tomcat_home/webapps/app_B.

Any ideas?

Thanks,
John
0
Comment
Question by:deriggi
4 Comments
 
LVL 2

Accepted Solution

by:
beermequik earned 125 total points
ID: 11777142
You could forward the request to app_B
//in the doGet or doPost of servet in App-a

String returnUrl =
  response.encodeUrl(/* full url path to servlet in App-B */);
ServletConfig servletConfig = getServletConfig();
ServletContext context = servletConfig.getServletContext();
RequestDispatcher dispatcher = context.getRequestDispatcher( returnUrl );
     
dispatcher.forward(request, response);


// that should do it.
0
 
LVL 3

Assisted Solution

by:kumvjuec
kumvjuec earned 125 total points
ID: 11786808
you would want to use response.encodeURL instead of response.encodeUrl
The later is deprecated :D
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
eclipse shortcuts 9 56
print map entry 34 69
Cygwin - GNU GPL License 1 25
Java: The Public Class Main 4 17
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question