Class WebRequest


  • public abstract class WebRequest
    extends Request
    Base class for request that provides additional web-related information.
    Author:
    Matej Knopp, Igor Vaynberg
    • Field Detail

      • PARAM_AJAX

        public static final java.lang.String PARAM_AJAX
        marker for Ajax requests
        See Also:
        Constant Field Values
      • HEADER_AJAX

        public static final java.lang.String HEADER_AJAX
        marker for Ajax requests
        See Also:
        Constant Field Values
      • PARAM_AJAX_BASE_URL

        public static final java.lang.String PARAM_AJAX_BASE_URL
        marker for Ajax-relative url
        See Also:
        Constant Field Values
      • HEADER_AJAX_BASE_URL

        public static final java.lang.String HEADER_AJAX_BASE_URL
        marker for Ajax-relative url
        See Also:
        Constant Field Values
      • PARAM_AJAX_REQUEST_ANTI_CACHE

        public static final java.lang.String PARAM_AJAX_REQUEST_ANTI_CACHE
        anti-cache query parameter added by Wicket.Ajax.Request at its URL
        See Also:
        Constant Field Values
      • HEADER_ORIGIN

        public static final java.lang.String HEADER_ORIGIN
        Origin http header
        See Also:
        Constant Field Values
      • HEADER_REFERER

        public static final java.lang.String HEADER_REFERER
        Referer http header
        See Also:
        Constant Field Values
    • Constructor Detail

      • WebRequest

        public WebRequest()
    • Method Detail

      • getCookies

        public abstract java.util.List<javax.servlet.http.Cookie> getCookies()
        Returns:
        request cookies
      • getCookie

        public javax.servlet.http.Cookie getCookie​(java.lang.String cookieName)
        Parameters:
        cookieName -
        Returns:
        cookie with specified name or null if the cookie does not exist
      • getHeaders

        public abstract java.util.List<java.lang.String> getHeaders​(java.lang.String name)
        Returns all the values of the specified request header.
        Parameters:
        name -
        Returns:
        unmodifiable list of header values
      • getHeader

        public abstract java.lang.String getHeader​(java.lang.String name)
        Returns the value of the specified request header as a String
        Parameters:
        name -
        Returns:
        string value of request header
      • getDateHeader

        public abstract org.apache.wicket.util.time.Time getDateHeader​(java.lang.String name)
        Returns the value of the specified request header as a long value that represents a Date object. Use this method with headers that contain dates, such as If-Modified-Since.
        Parameters:
        name -
        Returns:
        date value of request header or null if not found
      • getIfModifiedSinceHeader

        public final org.apache.wicket.util.time.Time getIfModifiedSinceHeader()
        Convenience method for retrieving If-Modified-Since header.
        Returns:
        date representing the header or null if not set
      • isAjax

        public boolean isAjax()
        Returns whether this request is an Ajax request. This implementation checks for values of "wicket-ajax" url parameter or the "Wicket-Ajax" header. Subclasses can use other approaches.
        Returns:
        true if this request is an ajax request, false otherwise.
      • shouldPreserveClientUrl

        public boolean shouldPreserveClientUrl()
        Signals whether or not request processing should preserve the current client url - in other words, handle this request without redirecting. By default, this method returns false . For example, this method can be used to preserve the url that caused a 404 in the browser if Wicket is also responsible for rendering the 404 page. If this method returns the default value of false then Wicket will redirect to the bookmarkable url of the error page, instead of preserving the url that caused the 404 in the browser.
        Returns:
        true if current client url should be preserved
      • cloneWithUrl

        public WebRequest cloneWithUrl​(Url url)
        Returns request with specified URL and same POST parameters as this request.
        Overrides:
        cloneWithUrl in class Request
        Parameters:
        url - Url instance
        Returns:
        request with specified URL.