How to redirect a request to different servlets by identifying URL patterns in JBoss


I am working on writing a Servlet that will route requests to appropriate servers received from differnt clients based on URLs received in request. Target deployment environment is JBoss for Servlet. Client can be a WebService response (XML Text). Any one can provide a sample code or base code for reference.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlps_umeshAuthor Commented:
Just spelling mistake in earlier question..:)
I'm not familiar with JBOSS, but I presume it uses web.xml like any other J2EE server. If so, you can use servlet mappings, such as below. This example sends any URL of the form to the servlet class specified by the name "My Silly Little Servlet".
	<servlet id="myservlet123">
		<servlet-name>My Silly Little Servlet</servlet-name>
		<servlet-name>My Silly Little Servlet</servlet-name>

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mlps_umeshAuthor Commented:
Thanks bpmurray for reply. As you pointed out, JBOSS web.xml is confirmed to J2EE standards for Web Deployment and change in web.xml will resolve routing issue. My problems was bit different. In real word, I am getting a response from WebService as XML. XML will contain different URLs that, I need to redirect. My approach for this problem is to write a servlet that will actually do pattern matching to take out URL's in response and route them to differnt servers. Instead of doing any parsing and redirection manually (thr' servlet code), can any one provide better approach which will give a portable solution like  use of JBOSS feature like RewriteValve or similar.

May be, I was not very clear with question.
Ahh - now I see. Have you considered using redirect or forward? There's a nice technote on this here:
mlps_umeshAuthor Commented:
Yah...Solution I got was not exactly I was looking for. But definately pointing me to right direction.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.