List of usage examples for org.apache.wicket.protocol.http.servlet ServletWebRequest getFilterPrefix
public String getFilterPrefix()
From source file:fiftyfive.wicket.util.HttpUtils.java
License:Apache License
/** * Returns the entire URL that was used to render the current page, * which should match what the user sees in the browser location bar. * Includes protocol, host, port absolute path and query string. * <p>//from w ww . ja v a2 s .c o m * <b>If the current request is an ajax one, this URL will not match * the actual ajax HTTP request being handled by the server.</b> Instead * this URL will be most recent non-ajax request, as observed in the * browser location bar. * * @see org.apache.wicket.request.Request#getClientUrl * @since 3.0 */ public static String getAbsolutePageUrl() { String absolute = null; RequestCycle rc = RequestCycle.get(); Url url = rc.getRequest().getClientUrl(); HttpServletRequest http = getHttpServletRequest(); if (url != null && http != null) { ServletWebRequest webRequest = (ServletWebRequest) rc.getRequest(); String port = ":" + http.getServerPort(); if (http.getServerPort() == 80 && http.getScheme().equals("http")) { port = ""; } absolute = Strings.join("/", http.getScheme() + "://" + http.getServerName() + port, http.getServerName(), http.getContextPath(), webRequest.getFilterPrefix(), url.toString()); } return absolute; }