Class ResponseWrapper

java.lang.Object
spark.Response
spark.http.matching.ResponseWrapper

class ResponseWrapper extends Response
  • Field Details

    • delegate

      private Response delegate
    • redirected

      private boolean redirected
  • Constructor Details

    • ResponseWrapper

      private ResponseWrapper()
  • Method Details

    • create

      static ResponseWrapper create()
    • setDelegate

      public void setDelegate(Response delegate)
    • getDelegate

      Response getDelegate()
    • status

      public void status(int statusCode)
      Description copied from class: Response
      Sets the status code for the
      Overrides:
      status in class Response
      Parameters:
      statusCode - the status code
    • status

      public int status()
      Description copied from class: Response
      Returns the status code
      Overrides:
      status in class Response
      Returns:
      the status code
    • body

      public void body(String body)
      Description copied from class: Response
      Sets the body
      Overrides:
      body in class Response
      Parameters:
      body - the body
    • body

      public String body()
      Description copied from class: Response
      returns the body
      Overrides:
      body in class Response
      Returns:
      the body
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • raw

      public javax.servlet.http.HttpServletResponse raw()
      Overrides:
      raw in class Response
      Returns:
      the raw response object handed in by Jetty
    • redirect

      public void redirect(String location)
      Description copied from class: Response
      Trigger a browser redirect
      Overrides:
      redirect in class Response
      Parameters:
      location - Where to redirect
    • redirect

      public void redirect(String location, int httpStatusCode)
      Description copied from class: Response
      Trigger a browser redirect with specific http 3XX status code.
      Overrides:
      redirect in class Response
      Parameters:
      location - Where to redirect permanently
      httpStatusCode - the http status code
    • isRedirected

      boolean isRedirected()
      Returns:
      true if redirected has been done
    • header

      public void header(String header, String value)
      Description copied from class: Response
      Adds/Sets a response header
      Overrides:
      header in class Response
      Parameters:
      header - the header
      value - the value
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • type

      public void type(String contentType)
      Description copied from class: Response
      Sets the content type for the response
      Overrides:
      type in class Response
      Parameters:
      contentType - the content type
    • type

      public String type()
      Description copied from class: Response
      Returns the content type
      Overrides:
      type in class Response
      Returns:
      the content type
    • cookie

      public void cookie(String name, String value)
      Description copied from class: Response
      Adds not persistent cookie to the response. Can be invoked multiple times to insert more than one cookie.
      Overrides:
      cookie in class Response
      Parameters:
      name - name of the cookie
      value - value of the cookie
    • cookie

      public void cookie(String name, String value, int maxAge)
      Description copied from class: Response
      Adds cookie to the response. Can be invoked multiple times to insert more than one cookie.
      Overrides:
      cookie in class Response
      Parameters:
      name - name of the cookie
      value - value of the cookie
      maxAge - max age of the cookie in seconds (negative for the not persistent cookie, zero - deletes the cookie)
    • cookie

      public void cookie(String name, String value, int maxAge, boolean secured)
      Description copied from class: Response
      Adds cookie to the response. Can be invoked multiple times to insert more than one cookie.
      Overrides:
      cookie in class Response
      Parameters:
      name - name of the cookie
      value - value of the cookie
      maxAge - max age of the cookie in seconds (negative for the not persistent cookie, zero - deletes the cookie)
      secured - if true : cookie will be secured
    • cookie

      public void cookie(String path, String name, String value, int maxAge, boolean secured)
      Description copied from class: Response
      Adds cookie to the response. Can be invoked multiple times to insert more than one cookie.
      Overrides:
      cookie in class Response
      Parameters:
      path - path of the cookie
      name - name of the cookie
      value - value of the cookie
      maxAge - max age of the cookie in seconds (negative for the not persistent cookie, zero - deletes the cookie)
      secured - if true : cookie will be secured
    • cookie

      public void cookie(String path, String name, String value, int maxAge, boolean secured, boolean httpOnly)
      Description copied from class: Response
      Adds cookie to the response. Can be invoked multiple times to insert more than one cookie.
      Overrides:
      cookie in class Response
      Parameters:
      path - path of the cookie
      name - name of the cookie
      value - value of the cookie
      maxAge - max age of the cookie in seconds (negative for the not persistent cookie, zero - deletes the cookie)
      secured - if true : cookie will be secured
      httpOnly - if true: cookie will be marked as http only
    • cookie

      public void cookie(String domain, String path, String name, String value, int maxAge, boolean secured, boolean httpOnly)
      Description copied from class: Response
      Adds cookie to the response. Can be invoked multiple times to insert more than one cookie.
      Overrides:
      cookie in class Response
      Parameters:
      domain - domain of the cookie
      path - path of the cookie
      name - name of the cookie
      value - value of the cookie
      maxAge - max age of the cookie in seconds (negative for the not persistent cookie, zero - deletes the cookie)
      secured - if true : cookie will be secured
      httpOnly - if true: cookie will be marked as http only
    • removeCookie

      public void removeCookie(String name)
      Description copied from class: Response
      Removes the cookie.
      Overrides:
      removeCookie in class Response
      Parameters:
      name - name of the cookie
    • removeCookie

      public void removeCookie(String path, String name)
      Description copied from class: Response
      Removes the cookie with given path and name.
      Overrides:
      removeCookie in class Response
      Parameters:
      path - path of the cookie
      name - name of the cookie