protected String getFlavor() { String queryString = context.getRequest().getQueryString(); if (queryString != null) { Map<String, String> params = URIUtils.getRequestParameters(queryString); if (params != null && params.containsKey("flavor")) { return params.get("flavor"); } } return null; }
public static String addParametersToURIQuery(String uriString, Map<String, String> parameters) { if (uriString == null || parameters == null || parameters.isEmpty()) { return uriString; } String uriPath = getURIPath(uriString); Map<String, String> existingParams = getRequestParameters(uriString.substring(uriPath.length())); if (existingParams == null) { existingParams = new LinkedHashMap<>(); } existingParams.putAll(parameters); String res; if (!existingParams.isEmpty()) { String newQuery = getURIQuery(existingParams); res = uriPath + '?' + newQuery; } else { res = uriPath; } return res; }
@Override public void sendRedirect(String location) throws IOException { Map<String, String> parameters = URIUtils.getRequestParameters(location); // failed form authentication, fragment is already stored if (parameters.containsKey(LOGIN_MISSING) || parameters.containsKey(LOGIN_FAILED)) { super.sendRedirect(location); return; } HttpServletResponse response = (HttpServletResponse) getResponse(); StringBuilder sb = new StringBuilder(); sb.append("<script type=\"text/javascript\">\n"); sb.append("document.cookie = '" + NXAuthConstants.START_PAGE_FRAGMENT_KEY + "=' + encodeURIComponent(window.location.hash.substring(1) || '') + '; path=/';\n"); sb.append("window.location = '" + location + "';\n"); sb.append("</script>"); String script = sb.toString(); response.setStatus(SC_UNAUTHORIZED); response.setContentType("text/html;charset=UTF-8"); response.setContentLength(script.length()); response.getWriter().write(script); } };
@Override public CacheKey create(HttpServletRequest request) { notNull(request); // this requires a type to be detected for now CacheKey key = super.create(request); if (key != null) { // add additional attributes for request-related info Map<String, String> params = URIUtils.getRequestParameters(request.getQueryString()); if (params != null) { for (Map.Entry<String, String> entry : params.entrySet()) { key.addAttribute(entry.getKey(), entry.getValue()); } } } if (log.isDebugEnabled()) { log.debug(String.format("Cache key for request '%s' '%s': %s", request.getRequestURL(), request.getQueryString(), key)); } return key; }
if (m.groupCount() > 6) { String query = m.group(7); params = URIUtils.getRequestParameters(query);
/** * Extracts document location from a Zope-like URL, eg: server/path_or_docId/view_id/tab_id . */ @Override public DocumentView getDocumentViewFromUrl(String url) { final Pattern pattern = Pattern.compile(getPrefix() + URL_PATTERN); Matcher m = pattern.matcher(url); if (m.matches()) { final String server = m.group(1); String path = m.group(2); if (path != null) { // add leading slash to make it absolute if it's not the root path = "/" + URIUtils.unquoteURIPathComponent(path); } final DocumentRef docRef = path != null ? new PathRef(path) : null; String viewId = m.group(3); int jsessionidIndex = viewId.indexOf(";jsessionid"); if (jsessionidIndex != -1) { viewId = viewId.substring(0, jsessionidIndex); } // get other parameters String query = m.group(4); Map<String, String> params = URIUtils.getRequestParameters(query); final DocumentLocation docLoc = new DocumentLocationImpl(server, docRef); return new DocumentViewImpl(docLoc, viewId, params); } return null; }
Map<String, String> requestParams = URIUtils.getRequestParameters(query); if (requestParams != null) { params.putAll(requestParams);
Map<String, String> params = URIUtils.getRequestParameters(query); if (params == null) { params = new HashMap<>();
Map<String, String> params = URIUtils.getRequestParameters(request.getQueryString()); if (params != null) { for (Map.Entry<String, String> entry : params.entrySet()) {
Map<String, String> params = URIUtils.getRequestParameters(requestPage); params.remove(FORCE_ANONYMOUS_LOGIN); if (!params.isEmpty()) {