Package ninja
Class Results
- java.lang.Object
-
- ninja.Results
-
public class Results extends Object
Convenience methods for the generation of Results.generates a results and sets it to forbidden. A range of shortcuts are available from here.
- Author:
- rbauer
-
-
Constructor Summary
Constructors Constructor Description Results()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static AsyncResult
async()
static Result
badRequest()
static Result
contentType(String contentType)
static Result
created(Optional<String> url)
static Result
forbidden()
static Result
html()
static Result
internalServerError()
static Result
json()
static Result
jsonp()
static Result
noContent()
static Result
notFound()
static Result
ok()
static Result
redirect(String url)
A redirect that uses 303 see other.static Result
redirectTemporary(String url)
A redirect that uses 307 see other.static Result
status(int statusCode)
static Result
text()
static Result
TODO()
static Result
unauthorized()
static Result
webSocketContinue()
Instructs ninja (and the http container) that it is okay to continue with the websocket handshake.static Result
xml()
-
-
-
Method Detail
-
status
public static Result status(int statusCode)
-
ok
public static Result ok()
-
notFound
public static Result notFound()
-
forbidden
public static Result forbidden()
-
unauthorized
public static Result unauthorized()
-
badRequest
public static Result badRequest()
-
noContent
public static Result noContent()
-
internalServerError
public static Result internalServerError()
-
redirect
public static Result redirect(String url)
A redirect that uses 303 see other. The redirect does NOT need a template and does NOT render a text in the Http body by default. If you wish to do so please remove theNoHttpBody
that is set as renderable of the Result.- Parameters:
url
- The url used as redirect target.- Returns:
- A nicely configured result with status code 303 and the url set as Location header. Renders no Http body by default.
-
redirectTemporary
public static Result redirectTemporary(String url)
A redirect that uses 307 see other. The redirect does NOT need a template and does NOT render a text in the Http body by default. If you wish to do so please remove theNoHttpBody
that is set as renderable of the Result.- Parameters:
url
- The url used as redirect target.- Returns:
- A nicely configured result with status code 307 and the url set as Location header. Renders no Http body by default.
-
html
public static Result html()
-
text
public static Result text()
-
json
public static Result json()
-
jsonp
public static Result jsonp()
-
xml
public static Result xml()
-
TODO
public static Result TODO()
-
webSocketContinue
public static Result webSocketContinue()
Instructs ninja (and the http container) that it is okay to continue with the websocket handshake. This sets the HTTP status code to101 Switching Protocols
. Do not include any result via a render() as writing it out will not be possible if you intend on switching protocols (e.g. upgrade to a websocket).
-
async
public static AsyncResult async()
-
-