AnsweredAssumed Answered

Get server - URL

Question asked by webdesigner on Aug 4, 2007
Latest reply on Aug 8, 2007 by kevinr
Hello,

I do following to obtain server URL like http://localhost:8080:

HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
//Request URL
final String requestURL = request.getRequestURL().toString();
//Context path
final String requestcontextPath = request.getContextPath();
//Server - URL
this.serverUrl = requestURL.substring(0,
   requestURL.indexOf(requestcontextPath));

But it looks like dirty hack (from servlet programming time).

Is there another way to get the same? (From subclass of BaseWizardBean)

Outcomes