Java Code Examples for org.apache.wicket.request.mapper.parameter.PageParameters#getNamedKeys()
The following examples show how to use
org.apache.wicket.request.mapper.parameter.PageParameters#getNamedKeys() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WicketUtil.java From yes-cart with Apache License 2.0 | 6 votes |
/** * Transform wicket 1.5 page parameter to more traditional map. Expensive operation. * * @param pageParameters given parameters to transform. * @return parameters transformed to map */ public Map<String, List<String>> pageParametersAsMultiMap(final PageParameters pageParameters) { final Map<String, List<String>> map = new LinkedHashMap<>(); if (pageParameters != null) { for (String key : pageParameters.getNamedKeys()) { if (!commandConfig.isInternalCommandKey(key)) { final List<String> vals = new ArrayList<>(); for (final StringValue value : pageParameters.getValues(key)) { vals.add(value.toString()); } map.put(key, vals); } } } return map; }
Example 2
Source File: WicketUtil.java From yes-cart with Apache License 2.0 | 6 votes |
/** * Get the filtered, from commands, request parameters, * that not contains given set of request parameter names * * @param parameters original request parameters * @return new filtered {@link PageParameters} */ public PageParameters getFilteredRequestParameters(final PageParameters parameters) { if (parameters != null) { final PageParameters rez = new PageParameters(parameters); for (final String key : parameters.getNamedKeys()) { if (commandConfig.isCommandKey(key)) { rez.remove(key); } } return rez; } return new PageParameters(); }
Example 3
Source File: WicketUtil.java From yes-cart with Apache License 2.0 | 5 votes |
/** * Transform wicket 1.5 page parameter to more traditional map. Expensive operation. * * @param pageParameters given parameters to transform. * @return parameters transformed to map */ public Map<String, String> pageParametersAsMap(final PageParameters pageParameters) { final Map<String, String> map = new LinkedHashMap<>(); if (pageParameters != null) { for (String key : pageParameters.getNamedKeys()) { if (!commandConfig.isInternalCommandKey(key)) { map.put(key, pageParameters.get(key).toString()); } } } return map; }
Example 4
Source File: WicketUtil.java From yes-cart with Apache License 2.0 | 5 votes |
/** * Get the retained request parameters, that not contains given set of request parameter names * * @param pageParameters original request parameters * @param nameFilter set of parameter name to retain * @return new filtered {@link PageParameters} */ public PageParameters getRetainedRequestParameters(final PageParameters pageParameters, final Set<String> nameFilter) { final PageParameters rez = getFilteredRequestParameters(pageParameters); for (String keyName : rez.getNamedKeys()) { if (!nameFilter.contains(keyName)) { rez.remove(keyName); } } return rez; }
Example 5
Source File: SeoBookmarkablePageParametersEncoder.java From yes-cart with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public PageParameters decodePageParameters(final Url url) { final PageParameters parameters = new PageParameters(); String name = null; for (String segment : url.getSegments()) { if (name == null) { name = segment; } else { decodeSegment(parameters, name, segment); name = null; } } // enhance the page parameters to understand which page we are currently on final Set<String> namedKeys = parameters.getNamedKeys(); if (namedKeys.contains(WebParametersKeys.SKU_ID)) { parameters.set(WebParametersKeys.PAGE_TYPE, WebParametersKeys.SKU_ID); } else if (namedKeys.contains(WebParametersKeys.PRODUCT_ID)) { parameters.set(WebParametersKeys.PAGE_TYPE, WebParametersKeys.PRODUCT_ID); } else if (namedKeys.contains(WebParametersKeys.CONTENT_ID)) { parameters.set(WebParametersKeys.PAGE_TYPE, WebParametersKeys.CONTENT_ID); } else if (namedKeys.contains(WebParametersKeys.CATEGORY_ID)) { parameters.set(WebParametersKeys.PAGE_TYPE, WebParametersKeys.CATEGORY_ID); } else { parameters.set(WebParametersKeys.PAGE_TYPE, ""); } return parameters; }