Package play.mvc

Class Call


  • public abstract class Call
    extends Object
    Defines a 'call', describing an HTTP request. For example used to create links or populate redirect data.

    These values are usually generated by the reverse router.

    • Constructor Detail

      • Call

        public Call()
    • Method Detail

      • url

        public abstract String url()
        The request URL.
        Returns:
        the url
      • method

        public abstract String method()
        The request HTTP method.
        Returns:
        the http method (e.g. "GET")
      • fragment

        public abstract String fragment()
        The fragment of the URL.
        Returns:
        the fragment (without leading '#' character)
      • unique

        public Call unique()
        Append a unique identifier to the URL.
        Returns:
        a copy if this call with a unique identifier to this url
      • uniquify

        protected final String uniquify​(String url)
      • withFragment

        public Call withFragment​(String fragment)
        Returns a new Call with the given fragment.
        Parameters:
        fragment - the URL fragment
        Returns:
        a copy of this call that contains the fragment
      • appendFragment

        protected String appendFragment()
        Returns the fragment (including the leading "#") if this call has one.
        Returns:
        the fragment, with leading "#"
      • absoluteURL

        public String absoluteURL​(Http.Request request)
        Transform this call to an absolute URL.
        Parameters:
        request - used to identify the host and protocol that should base this absolute URL
        Returns:
        the absolute URL string
      • absoluteURL

        public String absoluteURL​(Http.Request request,
                                  boolean secure)
        Transform this call to an absolute URL.
        Parameters:
        request - used to identify the host that should base this absolute URL
        secure - true if the absolute URL should use HTTPS protocol
        Returns:
        the absolute URL string
      • absoluteURL

        public String absoluteURL​(boolean secure,
                                  String host)
        Transform this call to an absolute URL.
        Parameters:
        secure - true if the absolute URL should use HTTPS protocol instead of HTTP
        host - the absolute URL's domain
        Returns:
        the absolute URL string
      • webSocketURL

        public String webSocketURL​(Http.Request request)
        Transform this call to an WebSocket URL.
        Parameters:
        request - used as the base for forming the WS url
        Returns:
        the websocket url string
      • webSocketURL

        public String webSocketURL​(Http.Request request,
                                   boolean secure)
        Transform this call to an WebSocket URL.
        Parameters:
        request - used to identify the host for the absolute URL
        secure - true if it should be a wss rather than ws URL
        Returns:
        the websocket URL string
      • webSocketURL

        public String webSocketURL​(boolean secure,
                                   String host)
        Transform this call to an WebSocket URL.
        Parameters:
        host - the host for the absolute URL.
        secure - true if it should be a wss rather than ws URL
        Returns:
        the url string
      • relativeTo

        public String relativeTo​(Http.RequestHeader requestHeader)
        Transform this call to a relative path.
        Parameters:
        requestHeader - used to identify the current URL to make this Call relative to.
        Returns:
        the relative path string
      • relativeTo

        public String relativeTo​(String startPath)
        Transform this call to a relative path.
        Parameters:
        startPath - the URL to make this Call relative to.
        Returns:
        the relative path string
      • canonical

        public String canonical()
        Transform this path into its canonical form.
        Returns:
        the canonical path.