Package dev.voidframework.web.http
Class Result
java.lang.Object
dev.voidframework.web.http.Result
An HTTP result.
- Since:
- 1.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ResultBad request (400).static ResultbadRequest(byte[] content, String contentType) Bad request (400).static ResultbadRequest(byte[] content, String contentType, Charset charset) Bad request (400).static ResultbadRequest(com.fasterxml.jackson.databind.JsonNode content) Bad request (400).static ResultbadRequest(TemplateResult templateResult) Bad request (400).static ResultbadRequest(String content) Bad request (400).static ResultbadRequest(String content, String contentType) Bad request (400).static ResultbadRequest(String content, String contentType, Charset charset) Bad request (400).static Resultcreated()Created (201).static ResultCreated (201).static ResultCreated (201).static Resultcreated(com.fasterxml.jackson.databind.JsonNode content) Created (201).static Resultcreated(TemplateResult templateResult) Created (201).static ResultCreated (201).static ResultCreated (201).static ResultCreated (201).static ResultForbidden (403).static ResultForbidden (403).static ResultForbidden (403).static Resultforbidden(com.fasterxml.jackson.databind.JsonNode content) Forbidden (403).static Resultforbidden(TemplateResult templateResult) Forbidden (403).static ResultForbidden (403).static ResultForbidden (403).static ResultForbidden (403).Gets the content type.Gets all cookies.Gets all headers.intGets the HTTP return code.Returns the result processor.static ResultInternal Server Error (500).static ResultinternalServerError(byte[] content, String contentType) Internal Server Error (500).static ResultinternalServerError(byte[] content, String contentType, Charset charset) Internal Server Error (500).static ResultinternalServerError(com.fasterxml.jackson.databind.JsonNode content) Internal Server Error (500).static ResultinternalServerError(TemplateResult templateResult) Internal Server Error (500).static ResultinternalServerError(String content) Internal Server Error (500).static ResultinternalServerError(String content, String contentType) Internal Server Error (500).static ResultinternalServerError(String content, String contentType, Charset charset) Internal Server Error (500).static ResultNo Content (204).static ResultnotFound()Not Found (404).static ResultNot Found (404).static ResultNot Found (404).static ResultnotFound(com.fasterxml.jackson.databind.JsonNode content) Not Found (404).static ResultnotFound(TemplateResult templateResult) Not Found (404).static ResultNot Found (404).static ResultNot Found (404).static ResultNot Found (404).static ResultNot Implemented (501).static ResultnotImplemented(byte[] content, String contentType) Not Implemented (501).static ResultnotImplemented(byte[] content, String contentType, Charset charset) Not Implemented (501).static ResultnotImplemented(com.fasterxml.jackson.databind.JsonNode content) Not Implemented (501).static ResultnotImplemented(TemplateResult templateResult) Not Implemented (501).static ResultnotImplemented(String content) Not Implemented (501).static ResultnotImplemented(String content, String contentType) Not Implemented (501).static ResultnotImplemented(String content, String contentType, Charset charset) Not Implemented (501).static Resultok()Ok (200).static ResultOk (200).static ResultOk (200).static Resultok(com.fasterxml.jackson.databind.JsonNode content) Ok (200).static Resultok(TemplateResult templateResult) Ok (200).static Resultok(InputStream content, String contentType) Ok (200).static ResultOk (200).static ResultOk (200).static ResultOk (200).static ResultredirectFound(String uri) Found (302).static ResultMoved Permanently (301).static ResultPermanent Redirect (308).static ResultredirectSeeOther(String uri) See other (303).static ResultSee other (307).withCookie(Cookie cookie) Assigns a new cookie.withHeader(String headerName, String value) Assigns a new header.withHeaders(Map<String, String> headerMap) Assigns a multiple headers.withoutCookie(Cookie cookie) Removes a cookie.withoutCookie(String cookieName) Removes a cookie.withoutHeader(String headerName) Removes a header.
-
Constructor Details
-
Result
public Result()Build an empty new instance. This constructor is useful during deserialize process- Since:
- 1.1.0
-
-
Method Details
-
badRequest
Bad request (400).- Returns:
- A result
- Since:
- 1.2.0
-
badRequest
Bad request (400).- Parameters:
content- The content- Returns:
- A result
- Since:
- 1.0.0
-
badRequest
Bad request (400).- Parameters:
content- The contentcontentType- The content type- Returns:
- A result
- Since:
- 1.7.0
-
badRequest
Bad request (400).- Parameters:
content- The contentcontentType- The content typecharset- The content charset- Returns:
- A result
- Since:
- 1.5.0
-
badRequest
Bad request (400).- Parameters:
content- The contentcontentType- The content type- Returns:
- A result
- Since:
- 1.0.0
-
badRequest
Bad request (400).- Parameters:
content- The contentcontentType- The content typecharset- The content charset- Returns:
- A result
- Since:
- 1.5.0
-
badRequest
Bad request (400).- Parameters:
content- The JSON content- Returns:
- A result
- Since:
- 1.0.0
-
badRequest
Bad request (400).- Parameters:
templateResult- The template to render- Returns:
- A result
- Since:
- 1.0.0
-
created
Created (201).- Returns:
- A result
- Since:
- 1.2.0
-
created
Created (201).- Parameters:
content- The content- Returns:
- A result
- Since:
- 1.0.0
-
created
Created (201).- Parameters:
content- The contentcontentType- The content type- Returns:
- A result
- Since:
- 1.5.0
-
created
Created (201).- Parameters:
content- The contentcontentType- The content typecharset- The content charset- Returns:
- A result
- Since:
- 1.5.0
-
created
Created (201).- Parameters:
content- The contentcontentType- The content type- Returns:
- A result
- Since:
- 1.0.0
-
created
Created (201).- Parameters:
content- The contentcontentType- The content typecharset- The content charset- Returns:
- A result
- Since:
- 1.5.0
-
created
Created (201).- Parameters:
content- The JSON content- Returns:
- A result
- Since:
- 1.0.0
-
created
Created (201).- Parameters:
templateResult- The template to render- Returns:
- A result
- Since:
- 1.0.0
-
forbidden
Forbidden (403).- Returns:
- A result
- Since:
- 1.2.0
-
forbidden
Forbidden (403).- Parameters:
content- The content- Returns:
- A result
- Since:
- 1.0.0
-
forbidden
Forbidden (403).- Parameters:
content- The contentcontentType- The content type- Returns:
- A result
- Since:
- 1.5.0
-
forbidden
Forbidden (403).- Parameters:
content- The contentcontentType- The content typecharset- The content charset- Returns:
- A result
- Since:
- 1.5.0
-
forbidden
Forbidden (403).- Parameters:
content- The contentcontentType- The content type- Returns:
- A result
- Since:
- 1.0.0
-
forbidden
Forbidden (403).- Parameters:
content- The contentcontentType- The content typecharset- The content charset- Returns:
- A result
- Since:
- 1.5.0
-
forbidden
Forbidden (403).- Parameters:
content- The JSON content- Returns:
- A result
- Since:
- 1.0.0
-
forbidden
Forbidden (403).- Parameters:
templateResult- The template to render- Returns:
- A result
- Since:
- 1.0.0
-
internalServerError
Internal Server Error (500).- Returns:
- A result
- Since:
- 1.2.0
-
internalServerError
Internal Server Error (500).- Parameters:
content- The content- Returns:
- A result
- Since:
- 1.0.0
-
internalServerError
Internal Server Error (500).- Parameters:
content- The contentcontentType- The content type- Returns:
- A result
- Since:
- 1.5.0
-
internalServerError
Internal Server Error (500).- Parameters:
content- The contentcontentType- The content typecharset- The content charset- Returns:
- A result
- Since:
- 1.5.0
-
internalServerError
Internal Server Error (500).- Parameters:
content- The contentcontentType- The content type- Returns:
- A result
- Since:
- 1.0.0
-
internalServerError
Internal Server Error (500).- Parameters:
content- The contentcontentType- The content typecharset- The content charset- Returns:
- A result
- Since:
- 1.5.0
-
internalServerError
Internal Server Error (500).- Parameters:
content- The JSON content- Returns:
- A result
- Since:
- 1.0.0
-
internalServerError
Internal Server Error (500).- Parameters:
templateResult- The template to render- Returns:
- A result
- Since:
- 1.0.0
-
noContent
No Content (204).- Returns:
- A result
- Since:
- 1.0.0
-
notFound
Not Found (404).- Returns:
- A result
- Since:
- 1.2.0
-
notFound
Not Found (404).- Parameters:
content- The content- Returns:
- A result
- Since:
- 1.0.0
-
notFound
Not Found (404).- Parameters:
content- The contentcontentType- The content type- Returns:
- A result
- Since:
- 1.5.0
-
notFound
Not Found (404).- Parameters:
content- The contentcontentType- The content typecharset- The content charset- Returns:
- A result
- Since:
- 1.5.0
-
notFound
Not Found (404).- Parameters:
content- The contentcontentType- The content type- Returns:
- A result
- Since:
- 1.0.0
-
notFound
Not Found (404).- Parameters:
content- The contentcontentType- The content typecharset- The content charset- Returns:
- A result
- Since:
- 1.5.0
-
notFound
Not Found (404).- Parameters:
content- The JSON content- Returns:
- A result
- Since:
- 1.0.0
-
notFound
Not Found (404).- Parameters:
templateResult- The template to render- Returns:
- A result
- Since:
- 1.0.0
-
notImplemented
Not Implemented (501).- Returns:
- A result
- Since:
- 1.2.0
-
notImplemented
Not Implemented (501).- Parameters:
content- The content- Returns:
- A result
- Since:
- 1.0.0
-
notImplemented
Not Implemented (501).- Parameters:
content- The contentcontentType- The content type- Returns:
- A result
- Since:
- 1.5.0
-
notImplemented
Not Implemented (501).- Parameters:
content- The contentcontentType- The content typecharset- The content charset- Returns:
- A result
- Since:
- 1.5.0
-
notImplemented
Not Implemented (501).- Parameters:
content- The contentcontentType- The content type- Returns:
- A result
- Since:
- 1.0.0
-
notImplemented
Not Implemented (501).- Parameters:
content- The contentcontentType- The content typecharset- The content charset- Returns:
- A result
- Since:
- 1.5.0
-
notImplemented
Not Implemented (501).- Parameters:
content- The JSON content- Returns:
- A result
- Since:
- 1.0.0
-
notImplemented
Not Implemented (501).- Parameters:
templateResult- The template to render- Returns:
- A result
- Since:
- 1.0.0
-
ok
Ok (200).- Returns:
- A result
- Since:
- 1.2.0
-
ok
Ok (200).- Parameters:
content- The content- Returns:
- A result
- Since:
- 1.0.0
-
ok
Ok (200).- Parameters:
content- The contentcontentType- The content type- Returns:
- A result
- Since:
- 1.5.0
-
ok
Ok (200).- Parameters:
content- The contentcontentType- The content typecharset- The content charset- Returns:
- A result
- Since:
- 1.5.0
-
ok
Ok (200).- Parameters:
content- The contentcontentType- The content type- Returns:
- A result
- Since:
- 1.0.0
-
ok
Ok (200).- Parameters:
content- The contentcontentType- The content typecharset- The content charset- Returns:
- A result
- Since:
- 1.5.0
-
ok
Ok (200).- Parameters:
content- The input stream contentcontentType- The content type- Returns:
- A result
- Since:
- 1.0.0
-
ok
Ok (200).- Parameters:
content- The JSON content- Returns:
- A result
- Since:
- 1.0.0
-
ok
Ok (200).- Parameters:
templateResult- The template to render- Returns:
- A result
- Since:
- 1.0.0
-
redirectMovedPermanently
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
- Since:
- 1.3.0
-
redirectPermanentRedirect
Permanent Redirect (308). Method and body not changed.- Parameters:
uri- The URL to redirect to- Returns:
- A result
- Since:
- 1.3.0
-
redirectFound
Found (302). GET methods unchanged. Others may or may not be changed to GET.- Parameters:
uri- The URL to redirect to- Returns:
- A result
- Since:
- 1.3.0
-
redirectSeeOther
See other (303). GET methods unchanged. Others changed to GET.- Parameters:
uri- The URL to redirect to- Returns:
- A result
- Since:
- 1.3.0
-
redirectTemporaryRedirect
See other (307). Method and body not changed.- Parameters:
uri- The URL to redirect to- Returns:
- A result
- Since:
- 1.3.0
-
withCookie
Assigns a new cookie.- Parameters:
cookie- The cookie to assign- Returns:
- The current result
- Since:
- 1.0.0
-
withoutCookie
Removes a cookie.- Parameters:
cookie- The cookie to remove- Returns:
- The current result
- Since:
- 1.0.0
-
withoutCookie
Removes a cookie.- Parameters:
cookieName- Name of the cookie to remove- Returns:
- The current result
- Since:
- 1.0.0
-
withHeader
Assigns a new header.- Parameters:
headerName- Name of the headervalue- Value to assign- Returns:
- The current result
- Since:
- 1.0.0
-
withHeaders
Assigns a multiple headers.- Parameters:
headerMap- headers to assign- Returns:
- The current result
- Since:
- 1.2.0
-
withoutHeader
Removes a header.- Parameters:
headerName- Name of the header to remove- Returns:
- The current result
- Since:
- 1.0.0
-
getCookies
Gets all cookies.- Returns:
- All cookies
- Since:
- 1.0.0
-
getHeaders
Gets all headers.- Returns:
- All headers
- Since:
- 1.0.0
-
getHttpCode
public int getHttpCode()Gets the HTTP return code.- Returns:
- The HTTP return code
- Since:
- 1.0.0
-
getContentType
Gets the content type.- Returns:
- The content type
- Since:
- 1.0.0
-
getResultProcessor
Returns the result processor.- Returns:
- The result processor
- Since:
- 1.0.0
-