Class Result

java.lang.Object
dev.voidframework.web.http.Result

public final class Result extends Object
An HTTP result.
  • Constructor Details

    • Result

      public Result()
      Build an empty new instance. This constructor is useful during deserialize process
  • Method Details

    • badRequest

      public static Result badRequest()
      Bad request (400).
      Returns:
      A result
    • badRequest

      public static Result badRequest(String content)
      Bad request (400).
      Parameters:
      content - The content
      Returns:
      A result
    • badRequest

      public static Result badRequest(byte[] content, String contentType)
      Bad request (400).
      Parameters:
      content - The content
      contentType - The content type
      Returns:
      A result
    • badRequest

      public static Result badRequest(com.fasterxml.jackson.databind.JsonNode content)
      Bad request (400).
      Parameters:
      content - The JSON content
      Returns:
      A result
    • badRequest

      public static Result badRequest(TemplateResult templateResult)
      Bad request (400).
      Parameters:
      templateResult - The template to render
      Returns:
      A result
    • created

      public static Result created()
      Created (201).
      Returns:
      A result
    • created

      public static Result created(String content)
      Created (201).
      Parameters:
      content - The content
      Returns:
      A result
    • created

      public static Result created(byte[] content, String contentType)
      Created (201).
      Parameters:
      content - The content
      contentType - The content type
      Returns:
      A result
    • created

      public static Result created(com.fasterxml.jackson.databind.JsonNode content)
      Created (201).
      Parameters:
      content - The JSON content
      Returns:
      A result
    • created

      public static Result created(TemplateResult templateResult)
      Created (201).
      Parameters:
      templateResult - The template to render
      Returns:
      A result
    • forbidden

      public static Result forbidden()
      Forbidden (403).
      Returns:
      A result
    • forbidden

      public static Result forbidden(String content)
      Forbidden (403).
      Parameters:
      content - The content
      Returns:
      A result
    • forbidden

      public static Result forbidden(byte[] content, String contentType)
      Forbidden (403).
      Parameters:
      content - The content
      contentType - The content type
      Returns:
      A result
    • forbidden

      public static Result forbidden(com.fasterxml.jackson.databind.JsonNode content)
      Forbidden (403).
      Parameters:
      content - The JSON content
      Returns:
      A result
    • forbidden

      public static Result forbidden(TemplateResult templateResult)
      Forbidden (403).
      Parameters:
      templateResult - The template to render
      Returns:
      A result
    • internalServerError

      public static Result internalServerError()
      Internal Server Error (500).
      Returns:
      A result
    • internalServerError

      public static Result internalServerError(String content)
      Internal Server Error (500).
      Parameters:
      content - The content
      Returns:
      A result
    • internalServerError

      public static Result internalServerError(byte[] content, String contentType)
      Internal Server Error (500).
      Parameters:
      content - The content
      contentType - The content type
      Returns:
      A result
    • internalServerError

      public static Result internalServerError(com.fasterxml.jackson.databind.JsonNode content)
      Internal Server Error (500).
      Parameters:
      content - The JSON content
      Returns:
      A result
    • internalServerError

      public static Result internalServerError(TemplateResult templateResult)
      Internal Server Error (500).
      Parameters:
      templateResult - The template to render
      Returns:
      A result
    • noContent

      public static Result noContent()
      No Content (204).
      Returns:
      A result
    • notFound

      public static Result notFound()
      Not Found (404).
      Returns:
      A result
    • notFound

      public static Result notFound(String content)
      Not Found (404).
      Parameters:
      content - The content
      Returns:
      A result
    • notFound

      public static Result notFound(byte[] content, String contentType)
      Not Found (404).
      Parameters:
      content - The content
      contentType - The content type
      Returns:
      A result
    • notFound

      public static Result notFound(com.fasterxml.jackson.databind.JsonNode content)
      Not Found (404).
      Parameters:
      content - The JSON content
      Returns:
      A result
    • notFound

      public static Result notFound(TemplateResult templateResult)
      Not Found (404).
      Parameters:
      templateResult - The template to render
      Returns:
      A result
    • notImplemented

      public static Result notImplemented()
      Not Implemented (501).
      Returns:
      A result
    • notImplemented

      public static Result notImplemented(String content)
      Not Implemented (501).
      Parameters:
      content - The content
      Returns:
      A result
    • notImplemented

      public static Result notImplemented(byte[] content, String contentType)
      Not Implemented (501).
      Parameters:
      content - The content
      contentType - The content type
      Returns:
      A result
    • notImplemented

      public static Result notImplemented(com.fasterxml.jackson.databind.JsonNode content)
      Not Implemented (501).
      Parameters:
      content - The JSON content
      Returns:
      A result
    • notImplemented

      public static Result notImplemented(TemplateResult templateResult)
      Not Implemented (501).
      Parameters:
      templateResult - The template to render
      Returns:
      A result
    • ok

      public static Result ok()
      Ok (200).
      Returns:
      A result
    • ok

      public static Result ok(String content)
      Ok (200).
      Parameters:
      content - The content
      Returns:
      A result
    • ok

      public static Result ok(String content, String contentType)
      Ok (200).
      Parameters:
      content - The content
      contentType - The content type
      Returns:
      A result
    • ok

      public static Result ok(byte[] content, String contentType)
      Ok (200).
      Parameters:
      content - The content
      contentType - The content type
      Returns:
      A result
    • ok

      public static Result ok(InputStream content, String contentType)
      Ok (200).
      Parameters:
      content - The input stream content
      contentType - The content type
      Returns:
      A result
    • ok

      public static Result ok(com.fasterxml.jackson.databind.JsonNode content)
      Ok (200).
      Parameters:
      content - The JSON content
      Returns:
      A result
    • ok

      public static Result ok(TemplateResult templateResult)
      Ok (200).
      Parameters:
      templateResult - The template to render
      Returns:
      A result
    • redirectMovedPermanently

      public static Result redirectMovedPermanently(String uri)
      Moved Permanently (301). GET methods unchanged. Others may or may not be changed to GET.
      Parameters:
      uri - The URL to redirect to
      Returns:
      A result
    • redirectPermanentRedirect

      public static Result redirectPermanentRedirect(String uri)
      Permanent Redirect (308). Method and body not changed.
      Parameters:
      uri - The URL to redirect to
      Returns:
      A result
    • redirectFound

      public static Result redirectFound(String uri)
      Found (302). GET methods unchanged. Others may or may not be changed to GET.
      Parameters:
      uri - The URL to redirect to
      Returns:
      A result
    • redirectSeeOther

      public static Result redirectSeeOther(String uri)
      See other (303). GET methods unchanged. Others changed to GET.
      Parameters:
      uri - The URL to redirect to
      Returns:
      A result
    • redirectTemporaryRedirect

      public static Result redirectTemporaryRedirect(String uri)
      See other (307). Method and body not changed.
      Parameters:
      uri - The URL to redirect to
      Returns:
      A result
    • withCookie

      public Result withCookie(Cookie cookie)
      Assigns a new cookie.
      Parameters:
      cookie - The cookie to assign
      Returns:
      The current result
    • withoutCookie

      public Result withoutCookie(Cookie cookie)
      Removes a cookie.
      Parameters:
      cookie - The cookie to remove
      Returns:
      The current result
    • withoutCookie

      public Result withoutCookie(String cookieName)
      Removes a cookie.
      Parameters:
      cookieName - Name of the cookie to remove
      Returns:
      The current result
    • withHeader

      public Result withHeader(String headerName, String value)
      Assigns a new header.
      Parameters:
      headerName - Name of the header
      value - Value to assign
      Returns:
      The current result
    • withHeaders

      public Result withHeaders(Map<String,String> headerMap)
      Assigns a multiple headers.
      Parameters:
      headerMap - headers to assign
      Returns:
      The current result
    • withoutHeader

      public Result withoutHeader(String headerName)
      Removes a header.
      Parameters:
      headerName - Name of the header to remove
      Returns:
      The current result
    • getCookies

      public Map<String,Cookie> getCookies()
      Gets all cookies.
      Returns:
      All cookies
    • getHeaders

      public Map<String,String> getHeaders()
      Gets all headers.
      Returns:
      All headers
    • getHttpCode

      public int getHttpCode()
      Gets the HTTP return code.
      Returns:
      The HTTP return code
    • getContentType

      public String getContentType()
      Gets the content type.
      Returns:
      The content type
    • getResultProcessor

      public ResultProcessor getResultProcessor()
      Get tje result processor.
      Returns:
      The result processor