Example usage for org.apache.wicket.request IRequestParameters getParameterNames

List of usage examples for org.apache.wicket.request IRequestParameters getParameterNames

Introduction

In this page you can find the example usage for org.apache.wicket.request IRequestParameters getParameterNames.

Prototype

Set<String> getParameterNames();

Source Link

Document

Returns immutable set of all available parameter names.

Usage

From source file:com.gitblit.wicket.GitBlitWebSession.java

License:Apache License

/**
 * Cache the requested protected resource pending successful authentication.
 *
 * @param pageClass/*from   w w  w.  j  a va  2 s .  c om*/
 */
public void cacheRequest(Class<? extends Page> pageClass) {
    // build absolute url with correctly encoded parameters?!
    Request req = RequestCycle.get().getRequest();
    IRequestParameters params = req.getRequestParameters();
    PageParameters pageParams = new PageParameters();
    params.getParameterNames().forEach(name -> {
        pageParams.add(name, params.getParameterValue(name));
    });
    requestUrl = GitBlitRequestUtils.toAbsoluteUrl(pageClass, pageParams);

    if (isTemporary()) {
        // we must bind the temporary session into the session store
        // so that we can re-use this session for reporting an error message
        // on the redirected page and continuing the request after
        // authentication.
        bind();
    }
}

From source file:com.pushinginertia.wicket.core.form.behavior.FormInputSaveDraftBehavior.java

License:Open Source License

@Override
protected void respond(final AjaxRequestTarget target) {
    // prevent focus change
    target.focusComponent(null);//from w w w  .  ja va2  s.  c  o  m

    // fire callback for any changes sent from the client
    final IRequestParameters parameters = RequestCycle.get().getRequest().getRequestParameters();
    final Set<String> parameterNames = parameters.getParameterNames();
    for (final FormComponent<String> component : components) {
        final String id = component.getMarkupId();
        if (parameterNames.contains(id)) {
            final StringValue value = parameters.getParameterValue(id);
            callback.saveDraft(component, value.toString());
        }
    }
}

From source file:com.romeikat.datamessie.core.base.ui.page.AbstractDocumentsFilterPage.java

License:Open Source License

private StringValue getParameterValue(final IRequestParameters requestParameters, final String parameterName) {
    final Set<String> requestParameterNames = requestParameters.getParameterNames();
    if (!requestParameterNames.contains(parameterName)) {
        return null;
    }//from  w ww. j a v a  2 s .c  o  m
    final StringValue parameterValue = requestParameters.getParameterValue(parameterName);
    if (parameterValue.isNull()) {
        return null;
    }
    return parameterValue;
}

From source file:com.smarthome.utilities.ApplicationUtilities.java

public static String parseRequestParams(IRequestParameters params) {
    Set<String> paramSet = params.getParameterNames();
    String ret = "";
    String paramPair;//from ww  w .  j  av  a2s  .  co  m

    for (String param : paramSet) {
        if (!param.equals("pass")) {
            String paramValue = nvl(params.getParameterValue(param).toString());
            paramPair = "|" + param + "=" + paramValue + "|";

            ret += paramPair;
        }
    }
    return ret;
}

From source file:com.userweave.module.methoden.iconunderstandability.page.survey.IconMatchingTestUI.java

License:Open Source License

private void addTermsView() {
    terms = getConfiguration().getTerms();
    termsV = new ArrayList<ItmTerm>();

    initTermsV();//from  w  w  w  .  j  a v  a2 s.  co  m

    RefreshingView rv;

    add(rv = new RefreshingView("term_content") {

        @Override
        protected Iterator getItemModels() {
            return new ModelIteratorAdapter(termsV.iterator()) {

                @Override
                protected IModel model(Object object) {
                    return new CompoundPropertyModel(object);
                }
            };
        }

        @Override
        protected void populateItem(Item item) {
            final String termValue = LocalizationUtils.getValue(getTermValue(item));

            DropComponent dropComponent = new DropComponent("drop_component");

            dropComponent.add(new AttributeAppender("style",
                    new Model("width:" + Integer.toString(TILE_WIDTH + 4) + "px;"), " "));

            dropComponent.add(new WebMarkupContainer("dropFieldCenter") {
                {
                    add(new AttributeAppender("style",
                            new Model("height:" + Integer.toString(TILE_HEIGHT - 13 - 6) + "px;"), " "));
                }
            });

            item.add(dropComponent);

            AbstractDefaultAjaxBehavior dropCallbackBehavior = new AbstractDefaultAjaxBehavior() {
                @Override
                protected void respond(AjaxRequestTarget target) {
                    IRequestParameters parameters = RequestCycle.get().getRequest().getRequestParameters();

                    //                     ValueMap parameterMap = 
                    //                        new ValueMap(RequestCycle.get().getRequest().getParameterMap());

                    Iterator<String> i = parameters.getParameterNames().iterator();

                    boolean found = false;

                    while (i.hasNext()) {
                        if (i.next().equals(IMAGE_ID_PARAMETER)) {
                            int imageIndex = parameters.getParameterValue(IMAGE_ID_PARAMETER).toInt();

                            if (imageIndex != -1) {
                                ITMImage image = imagesV.get(imageIndex);
                                String imageId = image.getId().toString();
                                matchingResult.put(termValue, imageId);
                            } else {
                                matchingResult.remove(termValue);
                            }

                            found = true;
                            break;
                        }
                    }

                    if (!found) {
                        matchingResult.remove(termValue);
                    }

                    getSurveyStepTimer().setEndTimeNow();
                }
            };

            dropComponent.add(dropCallbackBehavior);

            String dropComponentId = createId(item.getIndex());
            dropComponent.add(new AttributeModifier(DROP_COMPONENT_ID_PARAMETER, new Model(dropComponentId)));

            // um js-callbacks pro behaviour und dispatch anhand componentId zu erzeugen
            id2Behaviour.put(dropComponentId, dropCallbackBehavior);

            WebMarkupContainer wmc;

            item.add(wmc = new WebMarkupContainer("table_content") {
                {
                    add(new AttributeAppender("style",
                            new Model<String>("height:" + Integer.toString(TILE_HEIGHT - 2 - 6) + "px;"), " "));
                }
            });
            wmc.add(new Label("text", termValue));

            item.add(new WebMarkupContainer("drop_end_center") {
                {
                    add(new AttributeAppender("style",
                            new Model<String>("height:" + Integer.toString(TILE_HEIGHT - 8 - 6) + "px;"), " "));
                }
            });
        }

        private LocalizedString getTermValue(Item item) {
            return ((ItmTerm) item.getModel().getObject()).getValue();
        }
    });
}

From source file:de.alpharogroup.wicket.base.util.parameter.PageParametersExtensions.java

License:Apache License

/**
 * Adds the given parameters to the given map.
 *
 * @param parameters//from w  w w  .j  a v a 2s  .  c o  m
 *            The parameters to add to the map.
 * @param parameterMap
 *            The map to add the parameters.
 */
public static void addParameters(final IRequestParameters parameters,
        final Map<String, String[]> parameterMap) {
    final Set<String> parameterNames = parameters.getParameterNames();
    for (final String parameterName : parameterNames) {
        final List<StringValue> parameterValues = parameters.getParameterValues(parameterName);
        String[] stringArray = {};
        if ((parameterValues != null) && !parameterValues.isEmpty()) {
            stringArray = new String[parameterValues.size()];
            for (int i = 0; i < parameterValues.size(); i++) {
                stringArray[i] = parameterValues.get(i).toString();
            }
            if (parameterMap.containsKey(parameterName)) {
                stringArray = ArrayUtils.addAll(parameterMap.get(parameterName), stringArray);
            }
        }
        parameterMap.put(parameterName, stringArray);
    }
}

From source file:de.alpharogroup.wicket.base.util.parameter.PageParametersExtensions.java

License:Apache License

/**
 * Adds the given parameters to the given map.
 *
 * @param parameters//from w ww . jav a 2 s .  co m
 *            The parameters to add to the map.
 * @param parameterMap
 *            The map to add the parameters.
 */
public static void addToParameters(final IRequestParameters parameters,
        final Map<String, List<StringValue>> parameterMap) {
    for (final String parameterName : parameters.getParameterNames()) {
        final List<StringValue> parameterValues = parameters.getParameterValues(parameterName);
        parameterMap.put(parameterName, parameterValues);
    }
}

From source file:de.inren.service.picture.PictureResource.java

License:Apache License

private File getImageFile(IRequestParameters params) {
    log.info("injecting getImageFile");
    Injector.get().inject(this);
    if (params.getParameterNames().contains(ID)) {
        final String digest = params.getParameterValue(ID).toString();
        log.info("digest=" + digest);
        log.info("pictureModificationService=" + pictureModificationService);
        if (isThumbnail(params)) {
            return pictureModificationService.getThumbnailImage(digest);
        } else {/*from   w  w w .j  a  v  a2 s  .c  o m*/
            if (isLayout(params)) {
                return pictureModificationService.getLayoutImage(digest);
            } else {
                return pictureModificationService.getImage(digest);
            }
        }
    }
    return null;
}

From source file:de.inren.service.picture.PictureResource.java

License:Apache License

private boolean isThumbnail(IRequestParameters params) {
    return params.getParameterNames().contains(THUMB);
}

From source file:de.inren.service.picture.PictureResource.java

License:Apache License

private boolean isLayout(IRequestParameters params) {
    return params.getParameterNames().contains(LAYOUT);
}