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
FieldsModifier and TypeFieldDescriptionstatic final intThe application scope.static final intThe page scope.static final intThe request scope.static final intThe session scope. -
Method Summary
Modifier and TypeMethodDescriptionEncodes the specified URI.findAttribute(String name) Finds the attribute from page, request, session to application scopegetAttribute(String name, int scope) Returns the attribute of the specified scope.intReturns the line number of this action.getOut()Returns the current output.Returns the parent action, or null if no parent at all.voidIncludes the specified URI and render the result to the specified output.booleanReturns whether this page is included.voidremoveAttribute(String name, int scope) Removes the attribute of the specified scope.voidrenderFragment(Writer out) Renders the nested fragment.voidsetAttribute(String name, Object value, int scope) Sets the attribute of the specified scope.voidsetContentType(String ctype) Sets the content type.
-
Field Details
-
PAGE_SCOPE
static final int PAGE_SCOPEThe page scope.- See Also:
-
REQUEST_SCOPE
static final int REQUEST_SCOPEThe request scope.- See Also:
-
SESSION_SCOPE
static final int SESSION_SCOPEThe session scope.- See Also:
-
APPLICATION_SCOPE
static final int APPLICATION_SCOPEThe application scope.- See Also:
-
-
Method Details
-
getAttribute
Returns the attribute of the specified scope.- Parameters:
scope- one ofPAGE_SCOPE,REQUEST_SCOPE,SESSION_SCOPEandAPPLICATION_SCOPE.
-
setAttribute
Sets the attribute of the specified scope.- Parameters:
scope- one ofPAGE_SCOPE,REQUEST_SCOPE,SESSION_SCOPEandAPPLICATION_SCOPE.
-
removeAttribute
Removes the attribute of the specified scope.- Parameters:
scope- one ofPAGE_SCOPE,REQUEST_SCOPE,SESSION_SCOPEandAPPLICATION_SCOPE.
-
findAttribute
Finds the attribute from page, request, session to application scope -
setContentType
Sets the content type. -
getOut
Returns the current output.- Throws:
IOException
-
getParent
Action getParent()Returns the parent action, or null if no parent at all. -
renderFragment
Renders the nested fragment.- Parameters:
out- the output. If null,getOut()is assumed.- Throws:
DspExceptionIOException
-
include
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:
DspExceptionIOException
-
isIncluded
boolean isIncluded()Returns whether this page is included.- Since:
- 3.0.6
-
encodeURL
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:
DspExceptionIOException
-
getLineNumber
int getLineNumber()Returns the line number of this action. It is used for throwing exception and debug purpose.
-