Solved

servlet filters and  multiple applications in tomcat

Posted on 2004-08-10
4
209 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This is an explanation of a simple data model to help parse a JSON feed
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.

860 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