ninja
Class Result

java.lang.Object
  extended by ninja.Result
Direct Known Subclasses:
AsyncResult

public class Result
extends Object


Field Summary
static String APPLICATION_OCTET_STREAM
           
static String APPLICATION_XML
           
static String APPLICATON_JSON
           
static String LOCATION
           
static int SC_200_OK
           
static int SC_204_NO_CONTENT
           
static int SC_300_MULTIPLE_CHOICES
           
static int SC_301_MOVED_PERMANENTLY
           
static int SC_302_FOUND
           
static int SC_303_SEE_OTHER
           
static int SC_307_TEMPORARY_REDIRECT
           
static int SC_400_BAD_REQUEST
           
static int SC_403_FORBIDDEN
           
static int SC_404_NOT_FOUND
           
static int SC_500_INTERNAL_SERVER_ERROR
           
static int SC_501_NOT_IMPLEMENTED
           
static String TEXT_HTML
           
static String TEXT_PLAIN
           
 
Constructor Summary
Result(int statusCode)
           
 
Method Summary
 Result addCookie(Cookie cookie)
           
 Result addHeader(String headerName, String headerContent)
           
 void charset(String charset)
           
 Result contentType(String contentType)
          Sets the content type.
 String getCharset()
           
 String getContentType()
           
 List<Cookie> getCookies()
           
 Map<String,String> getHeaders()
           
 Object getRenderable()
           
 int getStatusCode()
           
 String getTemplate()
           
 Result html()
          Deprecated. 
 Result json()
          Deprecated. 
 Result redirect(String url)
          Deprecated. 
 Result render(Object renderable)
           
 Result setContentType(String contentType)
          Deprecated. 
 Result status(int statusCode)
           
 Result template(String template)
           
 Result unsetCookie(String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SC_200_OK

public static int SC_200_OK

SC_204_NO_CONTENT

public static int SC_204_NO_CONTENT

SC_300_MULTIPLE_CHOICES

public static int SC_300_MULTIPLE_CHOICES

SC_301_MOVED_PERMANENTLY

public static int SC_301_MOVED_PERMANENTLY

SC_302_FOUND

public static int SC_302_FOUND

SC_303_SEE_OTHER

public static int SC_303_SEE_OTHER

SC_307_TEMPORARY_REDIRECT

public static int SC_307_TEMPORARY_REDIRECT

SC_400_BAD_REQUEST

public static int SC_400_BAD_REQUEST

SC_403_FORBIDDEN

public static int SC_403_FORBIDDEN

SC_404_NOT_FOUND

public static int SC_404_NOT_FOUND

SC_500_INTERNAL_SERVER_ERROR

public static int SC_500_INTERNAL_SERVER_ERROR

SC_501_NOT_IMPLEMENTED

public static int SC_501_NOT_IMPLEMENTED

TEXT_HTML

public static final String TEXT_HTML
See Also:
Constant Field Values

TEXT_PLAIN

public static final String TEXT_PLAIN
See Also:
Constant Field Values

APPLICATON_JSON

public static final String APPLICATON_JSON
See Also:
Constant Field Values

APPLICATION_XML

public static final String APPLICATION_XML
See Also:
Constant Field Values

APPLICATION_OCTET_STREAM

public static final String APPLICATION_OCTET_STREAM
See Also:
Constant Field Values

LOCATION

public static final String LOCATION
See Also:
Constant Field Values
Constructor Detail

Result

public Result(int statusCode)
Method Detail

getRenderable

public Object getRenderable()

render

public Result render(Object renderable)

getContentType

public String getContentType()

getCharset

public String getCharset()
Returns:
Charset of the current result that will be used. Will be "utf-8" by default.

charset

public void charset(String charset)

setContentType

@Deprecated
public Result setContentType(String contentType)
Deprecated. 

Sets the content type

Parameters:
contentType -

contentType

public Result contentType(String contentType)
Sets the content type. Must not contain any charset WRONG: "text/html; charset=utf8". If you want to set the charset use method charset(String);

Parameters:
contentType - (without encoding) something like "text/html" or "application/json"

getHeaders

public Map<String,String> getHeaders()

addHeader

public Result addHeader(String headerName,
                        String headerContent)

getCookies

public List<Cookie> getCookies()

addCookie

public Result addCookie(Cookie cookie)

unsetCookie

public Result unsetCookie(String name)

getStatusCode

public int getStatusCode()

status

public Result status(int statusCode)

getTemplate

public String getTemplate()

template

public Result template(String template)

redirect

@Deprecated
public Result redirect(String url)
Deprecated. 

=> Convenience methods moved to Results.redirect()... and Results.redirectTemporary()...

Returns:

html

@Deprecated
public Result html()
Deprecated. 

=> Convenience methods moved to Results.html()...

Returns:

json

@Deprecated
public Result json()
Deprecated. 

=> Convenience methods moved to Results.json()...

Returns:


Copyright © 2012. All Rights Reserved.