/** * The servlet path may either be the application name or /. For test purposes we always return * the servlet name. * * @return The servlet path */ public String getServletPath() { return getContextPath(); }
/** * The servlet path may either be the application name or /. For test purposes we always return * the servlet name. * * @return The servlet path */ public String getServletPath() { return getContextPath(); }
/** * Returns context path and servlet path concatenated, typically * /applicationClassName/applicationClassName * * @return The path value * @see javax.servlet.http.HttpServletRequest#getRequestURI() */ public String getRequestURI() { if (url == null) { return getContextPath() + getServletPath(); } return url; }
/** * Returns context path and servlet path concatenated, typically * /applicationClassName/applicationClassName * * @return The path value * @see javax.servlet.http.HttpServletRequest#getRequestURI() */ public String getRequestURI() { if (url == null) { return getContextPath() + getServletPath(); } else { int index = url.indexOf("?"); if (index != -1) { return url.substring(0, index); } } return url; }
if (url.startsWith(getContextPath())) url = url.substring(getContextPath().length());
/** * Try to build a rough URL. * * @return The url */ public StringBuffer getRequestURL() { final StringBuffer buf = new StringBuffer(); buf.append("http://localhost"); buf.append(getContextPath()); if (getPathInfo() != null) { buf.append(getPathInfo()); } final String query = getQueryString(); if (query != null) { buf.append('?'); buf.append(query); } return buf; }
/** * Try to build a rough URL. * * @return The url */ public StringBuffer getRequestURL() { final StringBuffer buf = new StringBuffer(); buf.append("http://localhost"); buf.append(getContextPath()); if (getPathInfo() != null) { buf.append(getPathInfo()); } final String query = getQueryString(); if (query != null) { buf.append('?'); buf.append(query); } return buf; }
url = getContextPath() + getServletPath() + "/" + url; if (url.startsWith(getContextPath())) url = url.substring(getContextPath().length());
/** * Initialize the request parameters from the given redirect string that redirects back to a * particular component for display. * * @param redirect * The redirect string to display from */ public void setRequestToRedirectString(final String redirect) { parameters.clear(); int queryStringPos = redirect.indexOf('?'); // Decode the parameters if (queryStringPos != -1) { final String queryString = redirect.substring(queryStringPos + 1); RequestUtils.decodeParameters(queryString, parameters); } // We need to absolutize the redirect URL as we are not as smart as a web-browser // (WICKET-702) url = redirect; if ((url.length() == 0) || (url.charAt(0) != '/')) { url = getContextPath() + getServletPath() + "/" + redirect; } // Remove occurrences of ".." from the path url = RequestUtils.removeDoubleDots(url); log.info("Redirecting to " + url); }
/** * Initialize the request parameters from the given redirect string that redirects back to a * particular component for display. * * @param redirect * The redirect string to display from */ public void setRequestToRedirectString(final String redirect) { parameters.clear(); int queryStringPos = redirect.indexOf('?'); // Decode the parameters if (queryStringPos != -1) { final String queryString = redirect.substring(queryStringPos + 1); RequestUtils.decodeParameters(queryString, parameters); } // We need to absolutize the redirect URL as we are not as smart as a web-browser // (WICKET-702) url = getContextPath() + getServletPath() + "/" + redirect; // Remove occurrences of ".." from the path url = RequestUtils.removeDoubleDots(url); log.info("Redirecting to " + url); }