Package org.zkoss.web.servlet.dsp.action
Interface ActionContext
-
public interface ActionContext
Encapsulates a portion of DSP page in an object that can be invoked as many times as needed.- Author:
- tomyeh
-
-
Field Summary
Fields Modifier and Type Field Description static int
APPLICATION_SCOPE
The application scope.static int
PAGE_SCOPE
The page scope.static int
REQUEST_SCOPE
The request scope.static int
SESSION_SCOPE
The session scope.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
encodeURL(java.lang.String uri)
Encodes the specified URI.java.lang.Object
findAttribute(java.lang.String name)
Finds the attribute from page, request, session to application scopejava.lang.Object
getAttribute(java.lang.String name, int scope)
Returns the attribute of the specified scope.int
getLineNumber()
Returns the line number of this action.java.io.Writer
getOut()
Returns the current output.Action
getParent()
Returns the parent action, or null if no parent at all.void
include(java.lang.String uri, java.util.Map<?,?> params)
Includes the specified URI and render the result to the specified output.boolean
isIncluded()
Returns whether this page is included.void
removeAttribute(java.lang.String name, int scope)
Removes the attribute of the specified scope.void
renderFragment(java.io.Writer out)
Renders the nested fragment.void
setAttribute(java.lang.String name, java.lang.Object value, int scope)
Sets the attribute of the specified scope.void
setContentType(java.lang.String ctype)
Sets the content type.
-
-
-
Field Detail
-
PAGE_SCOPE
static final int PAGE_SCOPE
The page scope.- See Also:
- Constant Field Values
-
REQUEST_SCOPE
static final int REQUEST_SCOPE
The request scope.- See Also:
- Constant Field Values
-
SESSION_SCOPE
static final int SESSION_SCOPE
The session scope.- See Also:
- Constant Field Values
-
APPLICATION_SCOPE
static final int APPLICATION_SCOPE
The application scope.- See Also:
- Constant Field Values
-
-
Method Detail
-
getAttribute
java.lang.Object getAttribute(java.lang.String name, int scope)
Returns the attribute of the specified scope.- Parameters:
scope
- one ofPAGE_SCOPE
,REQUEST_SCOPE
,SESSION_SCOPE
andAPPLICATION_SCOPE
.
-
setAttribute
void setAttribute(java.lang.String name, java.lang.Object value, int scope)
Sets the attribute of the specified scope.- Parameters:
scope
- one ofPAGE_SCOPE
,REQUEST_SCOPE
,SESSION_SCOPE
andAPPLICATION_SCOPE
.
-
removeAttribute
void removeAttribute(java.lang.String name, int scope)
Removes the attribute of the specified scope.- Parameters:
scope
- one ofPAGE_SCOPE
,REQUEST_SCOPE
,SESSION_SCOPE
andAPPLICATION_SCOPE
.
-
findAttribute
java.lang.Object findAttribute(java.lang.String name)
Finds the attribute from page, request, session to application scope
-
setContentType
void setContentType(java.lang.String ctype)
Sets the content type.
-
getOut
java.io.Writer getOut() throws java.io.IOException
Returns the current output.- Throws:
java.io.IOException
-
getParent
Action getParent()
Returns the parent action, or null if no parent at all.
-
renderFragment
void renderFragment(java.io.Writer out) throws DspException, java.io.IOException
Renders the nested fragment.- Parameters:
out
- the output. If null,getOut()
is assumed.- Throws:
DspException
java.io.IOException
-
include
void include(java.lang.String uri, java.util.Map<?,?> params) throws DspException, java.io.IOException
Includes the specified URI and render the result to the specified output.- Parameters:
uri
- the URI to include. It is OK to relevant (without leading '/'). If starts with "/", the context path of request is assumed. To reference to foreign context, use "~ctx/" where ctx is the context path of the foreign context (without leading '/').params
- a map of parameters, or null to ignore. The map is passed thru the request attribute called arg.- Throws:
DspException
java.io.IOException
-
isIncluded
boolean isIncluded()
Returns whether this page is included.- Since:
- 3.0.6
-
encodeURL
java.lang.String encodeURL(java.lang.String uri) throws DspException, java.io.IOException
Encodes the specified URI.In additions, if uri starts with "/", the context path, e.g., /we2, is prefixed. In other words, "/ab/cd" means it is relevant to the servlet context path (say, "/we2").
If uri starts with "~abc/", it means it is relevant to a foreign context called /abc. And, it will be converted to "/abc/" first (without prefix request.getContextPath()).
Finally, the uri is encoded by HttpServletResponse.encodeURL.
- Throws:
DspException
java.io.IOException
-
getLineNumber
int getLineNumber()
Returns the line number of this action. It is used for throwing exception and debug purpose.
-
-