Package ninja

Class Results

    • Constructor Detail

      • Results

        public Results()
    • 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 the NoHttpBody 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 the NoHttpBody 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.
      • contentType

        public static Result contentType​(String contentType)
      • 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 to 101 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).