com.scooterframework.web.controller
Class ActionResult

java.lang.Object
  extended by com.scooterframework.web.controller.ActionResult

public class ActionResult
extends java.lang.Object

ActionResult class contains keys, tags and convenient methods for decorating a result.


Field Summary
static java.lang.String FORWARD_ERROR
          forward error key
static java.lang.String FORWARD_FAILURE
          forward failure key
static java.lang.String FORWARD_HOME
          forward home key
static java.lang.String FORWARD_LOGIN
          forward login key
static java.lang.String FORWARD_LOGOUT
          forward logout key
static java.lang.String FORWARD_SUCCESS
          forward success key
static java.lang.String TAG_ERROR
          error tag
static java.lang.String TAG_FORWARD_TO
          forward tag
static java.lang.String TAG_HTML
          html tag
static java.lang.String TAG_REDIRECT_TO
          redirect tag
static java.lang.String TAG_RENDER
          render tag
static java.lang.String TAG_SYMBOL
          content type tag symbol
static java.lang.String TAG_TEXT
          text tag
static java.lang.String TAG_XML
          xml tag
 
Constructor Summary
ActionResult()
           
 
Method Summary
static boolean checkResultTag(java.lang.Object result, java.lang.String tag)
          Checks if a result has a certain tag.
static java.lang.String error(java.lang.String content)
          Returns an error-tagged content string for error output.
static java.lang.String forwardTo(java.lang.String uri)
          Returns a forward-tagged URI string.
static java.lang.String forwardTo(java.lang.String uri, ActiveRecord record)
          Returns a forward-tagged URI string with a query string.
static java.lang.String forwardTo(java.lang.String uri, java.util.Map<java.lang.String,java.lang.Object> nameValuePairs)
          Returns a forward-tagged URI string with a query string.
static java.lang.String forwardTo(java.lang.String uri, java.lang.String nameValuePairs)
          Returns a forward-tagged URI string with a query string.
static java.lang.String getContentTypeTag(java.lang.String content)
          Gets content type tag that is at the beginning of the content.
static java.lang.String getResultContentByTag(java.lang.Object result, java.lang.String tag)
          Returns content as denoted by the specified tag.
static java.lang.String html(java.lang.String content)
          Returns a html-tagged content string for html output.
static java.lang.String redirectTo(java.lang.String uri)
          Returns a redirect-tagged URI string.
static java.lang.String redirectTo(java.lang.String uri, ActiveRecord record)
          Returns a redirect-tagged URI string with a query string.
static java.lang.String redirectTo(java.lang.String uri, java.util.Map<java.lang.String,java.lang.Object> nameValuePairs)
          Returns a redirect-tagged URI string with a query string.
static java.lang.String redirectTo(java.lang.String uri, java.lang.String nameValuePairs)
          Returns a redirect-tagged URI string with a query string.
static boolean startsWithContentTypeTag(java.lang.String content)
          Checks if the content starts with a content type tag.
static java.lang.String text(java.lang.String content)
          Returns a text-tagged content string for plain-text output.
static java.lang.String xml(java.lang.String content)
          Returns a xml-tagged content string for xml output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORWARD_ERROR

public static final java.lang.String FORWARD_ERROR
forward error key

See Also:
Constant Field Values

FORWARD_HOME

public static final java.lang.String FORWARD_HOME
forward home key

See Also:
Constant Field Values

FORWARD_LOGIN

public static final java.lang.String FORWARD_LOGIN
forward login key

See Also:
Constant Field Values

FORWARD_LOGOUT

public static final java.lang.String FORWARD_LOGOUT
forward logout key

See Also:
Constant Field Values

FORWARD_SUCCESS

public static final java.lang.String FORWARD_SUCCESS
forward success key

See Also:
Constant Field Values

FORWARD_FAILURE

public static final java.lang.String FORWARD_FAILURE
forward failure key

See Also:
Constant Field Values

TAG_SYMBOL

public static final java.lang.String TAG_SYMBOL
content type tag symbol

See Also:
Constant Field Values

TAG_ERROR

public static final java.lang.String TAG_ERROR
error tag

See Also:
Constant Field Values

TAG_HTML

public static final java.lang.String TAG_HTML
html tag

See Also:
Constant Field Values

TAG_TEXT

public static final java.lang.String TAG_TEXT
text tag

See Also:
Constant Field Values

TAG_XML

public static final java.lang.String TAG_XML
xml tag

See Also:
Constant Field Values

TAG_RENDER

public static final java.lang.String TAG_RENDER
render tag

See Also:
Constant Field Values

TAG_FORWARD_TO

public static final java.lang.String TAG_FORWARD_TO
forward tag

See Also:
Constant Field Values

TAG_REDIRECT_TO

public static final java.lang.String TAG_REDIRECT_TO
redirect tag

See Also:
Constant Field Values
Constructor Detail

ActionResult

public ActionResult()
Method Detail

error

public static java.lang.String error(java.lang.String content)
Returns an error-tagged content string for error output.

Parameters:
content - the error content
Returns:
a error-tagged content string

html

public static java.lang.String html(java.lang.String content)
Returns a html-tagged content string for html output.

Parameters:
content - the html content
Returns:
a html-tagged content string

text

public static java.lang.String text(java.lang.String content)
Returns a text-tagged content string for plain-text output.

Parameters:
content - the text content
Returns:
a text-tagged content string

xml

public static java.lang.String xml(java.lang.String content)
Returns a xml-tagged content string for xml output.

Parameters:
content - the xml content
Returns:
a xml-tagged content string

forwardTo

public static java.lang.String forwardTo(java.lang.String uri,
                                         ActiveRecord record)
Returns a forward-tagged URI string with a query string. The query string is formed by listing all primary key and value pairs of the record instance.

Parameters:
uri - an URI string
record - an ActiveRecord instance
Returns:
a formatted forward-tagged URI string

forwardTo

public static java.lang.String forwardTo(java.lang.String uri,
                                         java.util.Map<java.lang.String,java.lang.Object> nameValuePairs)
Returns a forward-tagged URI string with a query string.

Parameters:
uri - an URI string
nameValuePairs - a map of name and value pairs as HTTP query string
Returns:
a formatted forward-tagged URI string

forwardTo

public static java.lang.String forwardTo(java.lang.String uri,
                                         java.lang.String nameValuePairs)
Returns a forward-tagged URI string with a query string.

Parameters:
uri - an URI string
nameValuePairs - a string of name and value pairs as HTTP query string
Returns:
a formatted forward-tagged URI string

forwardTo

public static java.lang.String forwardTo(java.lang.String uri)
Returns a forward-tagged URI string.

Parameters:
uri - an URI string
Returns:
a formatted forward-tagged URI string

redirectTo

public static java.lang.String redirectTo(java.lang.String uri,
                                          ActiveRecord record)
Returns a redirect-tagged URI string with a query string. The query string is formed by listing all primary key and value pairs of the record instance.

Parameters:
uri - an URI string
record - an ActiveRecord instance
Returns:
a formatted redirect-tagged URI string

redirectTo

public static java.lang.String redirectTo(java.lang.String uri,
                                          java.util.Map<java.lang.String,java.lang.Object> nameValuePairs)
Returns a redirect-tagged URI string with a query string.

Parameters:
uri - an URI string
nameValuePairs - a map of name and value pairs as HTTP query string
Returns:
a formatted redirect-tagged URI string

redirectTo

public static java.lang.String redirectTo(java.lang.String uri,
                                          java.lang.String nameValuePairs)
Returns a redirect-tagged URI string with a query string.

Parameters:
uri - an URI string
nameValuePairs - a string of name and value pairs as HTTP query string
Returns:
a formatted redirect-tagged URI string

redirectTo

public static java.lang.String redirectTo(java.lang.String uri)
Returns a redirect-tagged URI string.

Parameters:
uri - an URI string
Returns:
a formatted redirect-tagged URI string

checkResultTag

public static boolean checkResultTag(java.lang.Object result,
                                     java.lang.String tag)
Checks if a result has a certain tag.

Parameters:
result - the result
tag - the tag to check
Returns:
true if the result contains the tag

getResultContentByTag

public static java.lang.String getResultContentByTag(java.lang.Object result,
                                                     java.lang.String tag)
Returns content as denoted by the specified tag.

Parameters:
result - a string with a tag
tag - the string denoting the result
Returns:
a string of result without the tag

startsWithContentTypeTag

public static boolean startsWithContentTypeTag(java.lang.String content)
Checks if the content starts with a content type tag.

Parameters:
content - the content to check
Returns:
true if the content starts with a content type tag

getContentTypeTag

public static java.lang.String getContentTypeTag(java.lang.String content)
Gets content type tag that is at the beginning of the content.

Parameters:
content - the content string
Returns:
the content type tag