Search in sources :

Example 6 with IRequestParameters

use of org.apache.wicket.request.IRequestParameters in project wicket by apache.

the class WicketTesterTest method setMultiValueQueryParameter.

/**
 * Asserting that multiple parameters added in request and PageParameters get processed
 */
@Test
public void setMultiValueQueryParameter() {
    PageParameters parameters = new PageParameters();
    parameters.add("q_1", "q_1_value_1");
    parameters.add("q_1", "q_1_value_2");
    IPageProvider testPageProvider = new PageProvider(MockPageParametersAware.class, parameters);
    IRequestHandler pageRequestHandler = new BookmarkablePageRequestHandler(testPageProvider);
    Url url = tester.getApplication().getRootRequestMapper().mapHandler(pageRequestHandler);
    tester.getRequest().addParameter("q_2", "q_2_value_1");
    tester.getRequest().addParameter("q_2", "q_2_value_2");
    tester.getRequest().setUrl(url);
    tester.processRequest();
    MockPageParametersAware page = (MockPageParametersAware) tester.getLastRenderedPage();
    IRequestParameters lastQueryParameter = page.getLastQueryParameters();
    List<StringValue> q1ParameterValues = lastQueryParameter.getParameterValues("q_1");
    assertTrue(q1ParameterValues.contains(StringValue.valueOf("q_1_value_1")));
    assertTrue(q1ParameterValues.contains(StringValue.valueOf("q_1_value_2")));
    List<StringValue> q2ParameterValues = lastQueryParameter.getParameterValues("q_2");
    assertTrue(q2ParameterValues.contains(StringValue.valueOf("q_2_value_1")));
    assertTrue(q2ParameterValues.contains(StringValue.valueOf("q_2_value_2")));
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) PageProvider(org.apache.wicket.core.request.handler.PageProvider) IPageProvider(org.apache.wicket.core.request.handler.IPageProvider) BookmarkablePageRequestHandler(org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler) MockPageParametersAware(org.apache.wicket.MockPageParametersAware) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) IPageProvider(org.apache.wicket.core.request.handler.IPageProvider) StringValue(org.apache.wicket.util.string.StringValue) Url(org.apache.wicket.request.Url) IRequestParameters(org.apache.wicket.request.IRequestParameters) Test(org.junit.Test)

Example 7 with IRequestParameters

use of org.apache.wicket.request.IRequestParameters in project wicket by apache.

the class AjaxClientInfoBehavior method onTimer.

@Override
protected final void onTimer(AjaxRequestTarget target) {
    stop(target);
    RequestCycle requestCycle = RequestCycle.get();
    IRequestParameters requestParameters = requestCycle.getRequest().getRequestParameters();
    WebClientInfo clientInfo = newWebClientInfo(requestCycle);
    clientInfo.getProperties().read(requestParameters);
    Session.get().setClientInfo(clientInfo);
    onClientInfo(target, clientInfo);
}
Also used : WebClientInfo(org.apache.wicket.protocol.http.request.WebClientInfo) RequestCycle(org.apache.wicket.request.cycle.RequestCycle) IRequestParameters(org.apache.wicket.request.IRequestParameters)

Aggregations

IRequestParameters (org.apache.wicket.request.IRequestParameters)7 StringValue (org.apache.wicket.util.string.StringValue)3 Test (org.junit.Test)2 UrlParametersReceivingBehavior (de.tudarmstadt.ukp.clarin.webanno.support.wicketstuff.UrlParametersReceivingBehavior)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 AuthenticatedWebSessionForIsis (org.apache.isis.viewer.wicket.viewer.integration.wicket.AuthenticatedWebSessionForIsis)1 MockPageParametersAware (org.apache.wicket.MockPageParametersAware)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 BookmarkablePageRequestHandler (org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler)1 IPageProvider (org.apache.wicket.core.request.handler.IPageProvider)1 PageProvider (org.apache.wicket.core.request.handler.PageProvider)1 WebClientInfo (org.apache.wicket.protocol.http.request.WebClientInfo)1 IRequestHandler (org.apache.wicket.request.IRequestHandler)1 Url (org.apache.wicket.request.Url)1 RequestCycle (org.apache.wicket.request.cycle.RequestCycle)1 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)1 IComplexOption (org.odlabs.wiquery.core.options.IComplexOption)1