Try

@Inject
private RequestGlobals requestGlobals;

requestGlobals.getHttpServletRequest().getContextPath()

regards
Taha


On Mon, Apr 25, 2011 at 6:37 AM, Bryan Lewis <jbryanle...@gmail.com> wrote:

> One way to do it:
>
>
>    @Inject private Request request;
>
>    ...
>        int port = request.getServerPort();
>        String serverName = request.getServerName();
>
>
>
> On Sun, Apr 24, 2011 at 7:28 PM, Mark <mark-li...@xeric.net> wrote:
>
> > What is the best way to get the url of the root of a web application? In
> > other words, If I'm on a page like:
> > http://server:8080/appname/mypage?showAll=true
> >
> > I want to get:
> > http://server:8080/appname
> >
> > I tried using:
> > pageRenderLinkSource.createPageRenderLink("Index").toAbsoluteURI();
> >
> > But that seems to retain the Request Parameters.  I could use a regex to
> > strop them off, but I'm guessing that I'm missing a better way to do it.
> >
> > Mark
> >
>

Reply via email to