public class CustomRequestCycle extends WebRequestCycle{ public CustomRequestCycle(WebApplication application, WebRequest request, Response response){ super(application, request, response); String headerValue = request.getHttpServletRequest().getHeader("foo"); ((MyCustomSession)Session.get()).setFoo(headerValue); } }
/** * You may subclass this method in case you don't want to show up the window on normal page * refresh. * * @return true, if the window shall be shown */ protected boolean makeContentVisible() { // if user is refreshing whole page, the window will not be shown if (getWebRequest().isAjax() == false) { return false; } else { return shown; } }
Cookie cookie = getWebRequest().getCookie(name); if (log.isDebugEnabled()) getWebRequest().getHttpServletRequest().getRequestURI()); getWebRequest().getHttpServletRequest().getRequestURI());
if (!requestCycle.getWebRequest().isAjax()) HttpServletRequest req = requestCycle.getWebRequest().getHttpServletRequest(); if (req instanceof MockHttpServletRequest)
if (lockedRequest.isAjax() == true) if (IResourceListener.INTERFACE.equals(lockedRequest.getRequestParameters().getInterface())) WebRequest currentRequest = (WebRequest)currentRequestCycle.getRequest(); if (currentRequest.isAjax() == false) String lockedPageId = Strings.firstPathComponent(lockedRequest.getRequestParameters() .getComponentPath(), Component.PATH_SEPARATOR); String currentPageId = Strings.firstPathComponent(currentRequestCycle.getRequest() .getComponentPath(), Component.PATH_SEPARATOR); int lockedVersion = lockedRequest.getRequestParameters().getVersionNumber(); int currentVersion = currentRequest.getRequestParameters().getVersionNumber();
/** * * @return WebRequestCycle */ protected WebRequestCycle resolveRequestCycle() { // initialize the request only if needed to allow the user to pass // request parameters, see WICKET-254 WebRequestCycle requestCycle; if (RequestCycle.get() == null) { requestCycle = setupRequestAndResponse(); } else { requestCycle = (WebRequestCycle)RequestCycle.get(); // If a ajax request is requested but the existing is not, than we // still need to create // a new one if ((requestCycle.getWebRequest().isAjax() == false) && (isCreateAjaxRequest() == true)) { setParametersForNextRequest(requestCycle.getWebRequest().getParameterMap()); requestCycle = setupRequestAndResponse(); } } return requestCycle; }
if (multiPart && !((WebRequest)getRequest()).isAjax()) final WebRequest multipartWebRequest = ((WebRequest)getRequest()).newMultipartWebRequest(getMaxSize()); getRequestCycle().setRequest(multipartWebRequest);
/** * Get the requests' cookie by name * * @param name * The name of the cookie to be looked up * * @return A cookie, null if not found. * @since 1.3.0-beta4 */ public Cookie getCookie(String name) { Cookie[] cookies = getCookies(); if (cookies != null && cookies.length > 0) { for (int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equals(name)) { return cookies[i]; } } } return null; }
final Map<String, String[]> parameters = request.getParameterMap(); final int x = Integer.parseInt(parameters.get("x")[0]); final int y = Integer.parseInt(parameters.get("y")[0]);
/** * Gets any cookies for request. * * @param name * The name of the cookie to be looked up * * @return Any cookies for this request */ private Cookie getCookie(String name) { try { return getWebRequest().getCookie(name); } catch (NullPointerException ex) { // Ignore any app server problem here } return null; }
if (lockedRequest.isAjax() == true) WebRequest currentRequest = (WebRequest)currentRequestCycle.getRequest(); if (currentRequest.isAjax() == false) String lockedPageId = Strings.firstPathComponent(lockedRequest.getRequestParameters() .getComponentPath(), Component.PATH_SEPARATOR); String currentPageId = Strings.firstPathComponent(currentRequestCycle.getRequest() .getRequestParameters().getComponentPath(), Component.PATH_SEPARATOR); int lockedVersion = lockedRequest.getRequestParameters().getVersionNumber(); int currentVersion = currentRequest.getRequestParameters().getVersionNumber();
/** * Get the requests' cookie by name * * @param name * The name of the cookie to be looked up * * @return A cookie, null if not found. * @since 1.3.0-beta4 */ public Cookie getCookie(String name) { Cookie[] cookies = getCookies(); if (cookies != null && cookies.length > 0) { for (int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equals(name)) { return cookies[i]; } } } return null; }
resource.setParameters(request.getParameterMap());
WebRequest req = (WebRequest)RequestCycle.get().getRequest(); HttpSession session = req.getHttpServletRequest().getSession();
/** * If it's an ajax request we always redirect. * * @see org.apache.wicket.RequestCycle#isRedirect() */ @Override public final boolean isRedirect() { if (getWebRequest().isAjax()) { return true; } else { return super.isRedirect(); } }
/** * * * @return The client's navigator.cookieEnabled property. */ public boolean isCookiesEnabled() { if (!cookiesEnabled && RequestCycle.get() != null) { Cookie[] cookies = ((WebRequest)RequestCycle.get().getRequest()).getCookies(); cookiesEnabled = cookies != null ? cookies.length > 0 : false; } return cookiesEnabled; }
/** * Get the requests' cookies * * @return Cookies */ public Cookie[] getCookies() { return getHttpServletRequest().getCookies(); }
/** * If it's an ajax request we always redirect. * * @see org.apache.wicket.RequestCycle#isRedirect() */ public final boolean isRedirect() { if (getWebRequest().isAjax()) { return true; } else { return super.isRedirect(); } } }
/** * * * @return The client's navigator.cookieEnabled property. */ public boolean isCookiesEnabled() { if (!cookiesEnabled && RequestCycle.get() != null) { Cookie[] cookies = ((WebRequest)RequestCycle.get().getRequest()).getCookies(); cookiesEnabled = cookies != null ? cookies.length > 0 : false; } return cookiesEnabled; }
/** * Get the requests' cookies * * @return Cookies */ public Cookie[] getCookies() { return getHttpServletRequest().getCookies(); }