Solved

servlet filters and  multiple applications in tomcat

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
File.WriteAllLines problem at random C# ASP.NET 6 53
json format text only 4 65
mapBully challenge 6 88
mapAB Challlenge 35 84
A short article about a problem I had getting the GPS LocationListener working.
This is about my first experience with programming Arduino.
The viewer will learn how to implement Singleton Design Pattern in Java.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now