/** * @param relativePagePath * @return * @see RequestUtils#toAbsolutePath(String, String) * @see URLHelper#removeJSessionId(String) */ public final static String toAbsolutePath(final String requestUrl, final String relativePagePath) { final String absoluteUrl = RequestUtils.toAbsolutePath(requestUrl, relativePagePath); return URLHelper.removeJSessionId(absoluteUrl); }
/** * Construct. * * @param realRequest * @param url */ public FormDispatchRequest(final Request realRequest, final String url) { this.realRequest = realRequest; this.url = realRequest.decodeURL(url); String queryString = this.url.substring(this.url.indexOf("?") + 1); RequestUtils.decodeParameters(queryString, params); }
@Override public Charset getCharset() { return RequestUtils.getCharset(httpServletRequest); }
/** * Decode the provided queryString as a series of key/ value pairs and set them in the provided * value map. * * @param queryString * string to decode, uses '&' to separate parameters and '=' to separate key from * value * @param params * parameters map to write the found key/ value pairs to */ public static void decodeParameters(String queryString, PageParameters params) { decodeParameters(queryString, params, getCurrentCharset()); }
/** * 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); }
@Override protected void respond(AjaxRequestTarget target) { final Request req = RequestCycle.get().getRequest(); final Map<String, String[]> params = new HashMap<String, String[]>(); RequestUtils.decodeUrlParameters(req.getQueryString(), params); final String handleId = params.get("handleId") != null ? params.get("handleId")[0] : null; final int newValue = params.get("value") != null ? Integer.parseInt(params.get("value")[0]) : -1; getSlider().onChange(target, handleId, newValue); }
/** * Indicate sending of a redirectLocation to a particular named resource. This implementation * just keeps hold of the redirectLocation info and makes it available for query. * * @param location * The location to redirectLocation to * @throws IOException * Not used */ public void sendRedirect(String location) throws IOException { // If the location starts with ../ if (location.startsWith("../")) { // Test if the current url has a / in it. (a mount) String url = getURL(); int index = url.lastIndexOf("/"); if (index != -1) { // Then we have to recalculate what the real redirect is for the next request // which is just getContext() + getServletPath() + "/" + location; url = url.substring(0, index + 1) + location; url = RequestUtils.removeDoubleDots(url); // strip the servlet path again from it. index = url.indexOf("/"); location = url.substring(index + 1); } } redirectLocation = location; }
/** * 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); }
/** * Decode the provided queryString as a series of key/ value pairs and set them in the provided * value map. * * @param queryString * string to decode, uses '&' to separate parameters and '=' to separate key from * value * @param params * parameters map to write the found key/ value pairs to */ public static void decodeParameters(String queryString, PageParameters params) { decodeParameters(queryString, params, getCurrentCharset()); }
RequestUtils.decodeUrlParameters(queryString, params); parameters.putAll(params);
/** * Indicate sending of a redirectLocation to a particular named resource. This implementation * just keeps hold of the redirectLocation info and makes it available for query. * * @param location * The location to redirectLocation to * @throws IOException * Not used */ public void sendRedirect(String location) throws IOException { // If the location starts with ../ if (location.startsWith("../")) { // Test if the current url has a / in it. (a mount) String url = getURL(); int index = url.lastIndexOf("/"); if (index != -1) { // Then we have to recalculate what the real redirect is for the next request // which is just getContext() + getServletPath() + "/" + location; url = url.substring(0, index + 1) + location; url = RequestUtils.removeDoubleDots(url); // stril the servlet path again from it. index = url.indexOf("/"); location = url.substring(index + 1); } } redirectLocation = location; }
/** * replacement for {@link RequestUtils}.toAbsolutePath(String) * * Calculates absolute path to url relative to another absolute url. * * @param relativePagePath * path, relative to requestPath * @return absolute path for given url */ public final static String toAbsolutePath(final String relativePagePath) { return RequestUtils.toAbsolutePath(getHttpServletRequest().getRequestURL().toString(), relativePagePath); }
RequestUtils.decodeParameters(queryString, pageParameters); infoPath = reference.substring(0, queryStringPos);
@Override public Charset getCharset() { return RequestUtils.getCharset(httpServletRequest); }
public static String toAbsolutePath(final String relativePagePath) { HttpServletRequest req = getHttpServletRequest(); return RequestUtils.toAbsolutePath(req.getRequestURL().toString(), relativePagePath); }
RequestUtils.decodeParameters(queryString, pageParameters); infoPath = reference.substring(0, queryStringPos);
@Override public Charset getCharset() { // called from the super constructor, when wrappedRequest is still null if (wrappedRequest == null) return RequestUtils.getCharset(super.getContainerRequest()); return wrappedRequest.getCharset(); }
public static CharSequence toAbsoluteUrl(String url) { // make relative links absolute if (url.startsWith("../../")) { HttpServletRequest req = ((WebRequest)RequestCycle.get().getRequest()).getHttpServletRequest(); return req.getContextPath() + "/" + url.substring("../../".length()); } else { return RequestUtils.toAbsolutePath(url); } }
RequestUtils.decodeParameters(queryString, parameters);
@Override public Charset getCharset() { // called from the super constructor, when wrappedRequest is still null if (wrappedRequest == null) return RequestUtils.getCharset(super.getContainerRequest()); return wrappedRequest.getCharset(); }