Class Result

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

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

    • 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(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(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(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(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(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(String content)
      Ok (200).
      Parameters:
      content - The content
      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
    • redirectPermanentlyTo

      public static Result redirectPermanentlyTo(String uri)
      Redirect Permanently (301).
      Parameters:
      uri - The URL to redirect to
      Returns:
      A result
    • redirectTemporaryTo

      public static Result redirectTemporaryTo(String uri)
      Redirect Temporary (302).
      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
    • 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 Result.ResultProcessor getResultProcessor()
      Get tje result processor.
      Returns:
      The result processor