[jboss-user] [JBoss Seam] - Re: ServletRequest in Seam

petemuir do-not-reply at jboss.com
Tue Dec 12 06:41:45 EST 2006


I use this in a phase listener:

protected String getExternalApplicationRoot(FacesContext ctx) {
  |    if (ctx.getExternalContext().getRequest() instanceof HttpServletRequest) {
  |       HttpServletRequest request = (HttpServletRequest) ctx.getExternalContext().getRequest();
  |       return "http://" + request.getServerName() + ":" + request.getServerPort() + ctx.getExternalContext().getRequestContextPath() + "/";
  |    } else {
  |       return null;
  |    }
  | }

If the user was viewing http://foo.bar.com:1234/myApp/management/editUser.jsf the String returned from the function would be http://foo.bar.com:1234/myApp.  Does that help?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993032#3993032

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993032



More information about the jboss-user mailing list