Hans Sausage Hans Sausage - 9 months ago 39
Java Question

ServletRequest get name of actual page

I am using a

and the
-Function. I would like to know which site is being requested. Some function giving me something like
would be perfect.

What is the way to go here? Using the context will be the right way, but I can't find any good method :-(



request.getRequestURI() should return the part of the URL after the domain.

From there, you can strip the request.getContextPath()

(You'd have to cast the ServletRequest to HttpServletRequest first)