List of usage examples for org.apache.wicket.request Request getRequestParameters
public IRequestParameters getRequestParameters()
From source file:au.com.scds.chats.webapp.SimpleApplication.java
License:Apache License
@Override public Session newSession(final Request request, final Response response) { if (!DEMO_MODE_USING_CREDENTIALS_AS_QUERYARGS) { return super.newSession(request, response); }//from ww w .j a v a 2 s. c om // else demo mode final AuthenticatedWebSessionForIsis s = (AuthenticatedWebSessionForIsis) super.newSession(request, response); IRequestParameters requestParameters = request.getRequestParameters(); final org.apache.wicket.util.string.StringValue user = requestParameters.getParameterValue("user"); final org.apache.wicket.util.string.StringValue password = requestParameters.getParameterValue("pass"); s.signIn(user.toString(), password.toString()); return s; }
From source file:com.ecom.web.components.gmap.api.GMarker.java
License:Apache License
@Override protected void updateOnAjaxCall(AjaxRequestTarget target, GEvent overlayEvent) { Request request = RequestCycle.get().getRequest(); latLng = GLatLng.parse(request.getRequestParameters().getParameterValue("overlay.latLng").toString()); }
From source file:com.ecom.web.components.gmap.event.ClickListener.java
License:Apache License
@Override protected void onEvent(AjaxRequestTarget target) { Request request = RequestCycle.get().getRequest(); GOverlay overlay = null;/* ww w. j av a 2s . com*/ GLatLng latLng = null; String markerParameter = request.getRequestParameters().getParameterValue("argument0").toString(); if (markerParameter != null) { for (GOverlay ovl : getGMap2().getOverlays()) { if (ovl.getId().equals(markerParameter)) { overlay = ovl; break; } } } String latLngParameter = request.getRequestParameters().getParameterValue("argument1").toString(); if (latLngParameter != null) { latLng = GLatLng.parse(latLngParameter); } onClick(target, latLng, overlay); }
From source file:com.ecom.web.components.gmap.event.DblClickListener.java
License:Apache License
@Override protected final void onEvent(AjaxRequestTarget target) { Request request = RequestCycle.get().getRequest(); GLatLng latLng = null;/*www .ja va 2 s . c o m*/ String latLngParameter = request.getRequestParameters().getParameterValue("argument1").toString(); if (latLngParameter != null) { latLng = GLatLng.parse(latLngParameter); } onDblClick(target, latLng); }
From source file:com.ecom.web.components.gmap.event.ZoomEndListener.java
License:Apache License
@Override protected void onEvent(AjaxRequestTarget target) { Request request = RequestCycle.get().getRequest(); int oldLevel = 0; int newLevel = 0; StringValue oldZoomLevelParameter = request.getRequestParameters().getParameterValue("argument0"); StringValue newZoomLevelParameter = request.getRequestParameters().getParameterValue("argument1"); if (oldZoomLevelParameter.isNull() || newZoomLevelParameter.isNull()) { return;//w w w . j a v a 2 s. c o m } oldLevel = oldZoomLevelParameter.toInt(); newLevel = newZoomLevelParameter.toInt(); onZoomEnd(target, oldLevel, newLevel); }
From source file:com.ecom.web.components.gmap.GMap2.java
License:Apache License
/** * Update state from a request to an AJAX target. *//* w w w . j av a 2 s. co m*/ public void update(AjaxRequestTarget target) { Request request = RequestCycle.get().getRequest(); // Attention: don't use setters as this will result in an endless // AJAX request loop bounds = GLatLngBounds.parse(request.getRequestParameters().getParameterValue("bounds").toString()); center = GLatLng.parse(request.getRequestParameters().getParameterValue("center").toString()); zoom = request.getRequestParameters().getParameterValue("zoom").toInt(); mapType = GMapType.valueOf(request.getRequestParameters().getParameterValue("currentMapType").toString()); infoWindow.update(target); }
From source file:com.gitblit.wicket.GitBlitWebSession.java
License:Apache License
/** * Cache the requested protected resource pending successful authentication. * * @param pageClass/*from ww w . ja v a 2 s . c o m*/ */ 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.mylab.wicket.jpa.ui.pages.select2.AbstractSelect2Choice.java
License:Apache License
@Override public void onResourceRequested() { // this is the callback that retrieves matching choices used to populate // the dropdown Request request = getRequestCycle().getRequest(); IRequestParameters params = request.getRequestParameters(); // retrieve choices matching the search term String term = params.getParameterValue("q").toOptionalString(); int page = params.getParameterValue("page").toInt(1); // select2 uses 1-based paging, but in wicket world we are used to // 0-based//from w w w . ja va 2 s .co m page -= 1; Response<T> response = new Response<>(); getProvider().query(term, page, response); // jsonize and write out the choices to the response WebResponse webResponse = (WebResponse) getRequestCycle().getResponse(); webResponse.setContentType("application/json"); OutputStreamWriter out = new OutputStreamWriter(webResponse.getOutputStream(), getRequest().getCharset()); JSONWriter json = new JSONWriter(out); try { json.object(); json.key("items").array(); for (T item : response) { json.object(); getProvider().toJson(item, json); json.endObject(); } json.endArray(); json.key("more").value(response.getHasMore()).endObject(); } catch (JSONException e) { throw new RuntimeException("Could not write Json response", e); } try { out.flush(); } catch (IOException e) { throw new RuntimeException("Could not write Json to servlet response", e); } }
From source file:com.vaynberg.wicket.select2.AbstractSelect2Choice.java
License:Apache License
@Override public void onResourceRequested() { // this is the callback that retrieves matching choices used to populate the dropdown Request request = getRequestCycle().getRequest(); IRequestParameters params = request.getRequestParameters(); // retrieve choices matching the search term String term = params.getParameterValue("term").toOptionalString(); int page = params.getParameterValue("page").toInt(1); // select2 uses 1-based paging, but in wicket world we are used to // 0-based// w ww .ja v a2s. c o m page -= 1; Response<T> response = new Response<T>(); provider.query(term, page, response); // jsonize and write out the choices to the response WebResponse webResponse = (WebResponse) getRequestCycle().getResponse(); webResponse.setContentType("application/json"); OutputStreamWriter out = new OutputStreamWriter(webResponse.getOutputStream(), getRequest().getCharset()); JSONWriter json = new JSONWriter(out); try { json.object(); json.key("results").array(); for (T item : response) { json.object(); provider.toJson(item, json); json.endObject(); } json.endArray(); json.key("more").value(response.getHasMore()).endObject(); } catch (JSONException e) { throw new RuntimeException("Could not write Json response", e); } try { out.flush(); } catch (IOException e) { throw new RuntimeException("Could not write Json to servlet response", e); } }
From source file:de.alpharogroup.wicket.base.util.parameter.PageParametersExtensions.java
License:Apache License
/** * Gets a map with all parameters. Looks in the query, request and post parameters. * * @param request//from www . j a v a2 s. c om * the request * @return a map with all parameters. */ public static Map<String, List<StringValue>> getPageParametersMap(final Request request) { final Map<String, List<StringValue>> map = new HashMap<>(); addToParameters(request.getRequestParameters(), map); addToParameters(request.getQueryParameters(), map); addToParameters(request.getPostParameters(), map); return map; }