ultraslan7
ultraslan7

Reputation: 3

How can I get the current context of webapplication without HttpRequest?

I have a question because of the context of my application.

I work currently on a project and I need the current context URL from my web application to call another application? If possible without HTTP Request. I need this because I use different Tomcats and environments for this application. I don't like hard coding paths in properties or java code.

Upvotes: 0

Views: 437

Answers (2)

BalusC
BalusC

Reputation: 1108722

It's since Servlet 2.5 (e.g. Tomcat 6 and newer) also available by ServletContext#getContextPath().

Upvotes: 0

ra2085
ra2085

Reputation: 804

How about a sendRedirect in the HTTPServletResponse? Once you're done with your first request, your servlet is going to tell the client to go and call your "other application".

Upvotes: 1

Related Questions