servlet filters and  multiple applications in tomcat

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

Question by:deriggi
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

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.

Assisted Solution

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

Featured Post

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

This is an explanation of a simple data model to help parse a JSON feed
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

688 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