public class ServletDspContext extends java.lang.Object implements DspContext
Constructor and Description |
---|
ServletDspContext(javax.servlet.ServletContext ctx,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Locator locator)
Constructor.
|
ServletDspContext(javax.servlet.ServletContext ctx,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.io.Writer out,
Locator locator)
Constructor with the specified writer.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
encodeURL(java.lang.String uri)
Returns the encoded URL.
|
Locator |
getLocator()
Returns the locator for loading resources, such as taglib.
|
java.io.Writer |
getOut()
Returns the writer, never null.
|
javax.servlet.ServletRequest |
getRequest()
Returns the request, or null if not available.
|
javax.servlet.ServletResponse |
getResponse()
Returns the response, or null if not available.
|
javax.servlet.ServletContext |
getServletContext()
Returns the request, or null if not available.
|
VariableResolver |
getVariableResolver()
Returns the variable resolver.
|
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 |
setContentType(java.lang.String ctype)
Sets the content type of the output.
|
void |
setOut(java.io.Writer out)
Changes the writer of this context to the specified one.
|
public ServletDspContext(javax.servlet.ServletContext ctx, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Locator locator)
locator
- used to locate resources, such as taglib.
If null is specified, the locator for the specified servlet context
is used. (In other words, we use ServletContextLocator(ctx), if locator is null).public ServletDspContext(javax.servlet.ServletContext ctx, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.io.Writer out, Locator locator)
locator
- used to locate resources, such as taglib.
If null is specified, the locator for the specified servlet context
is used. (In other words, we use ServletContextLocator(ctx), if locator is null).out
- the output to generate the result.
If null, it is the same as ServletDspContext(ServletContext,HttpServletRequest,HttpServletResponse,Locator)
In other words, response.getWriter() is used.public Locator getLocator()
DspContext
To load the resource from a web application, use
ServletContextLocator
To load the resource from class path, use
org.zkoss.util.resource.Resources.getDefault().
getLocator
in interface DspContext
public void setContentType(java.lang.String ctype)
DspContext
setContentType
in interface DspContext
public void setOut(java.io.Writer out)
DspContext
setOut
in interface DspContext
out
- the new writer. If null, it is restored to
the default one.public java.lang.String encodeURL(java.lang.String uri) throws javax.servlet.ServletException, java.io.IOException
DspContext
encodeURL
in interface DspContext
uri
- it must be empty or starts with "/". It might contain
"*" for current browser code and Locale.javax.servlet.ServletException
java.io.IOException
public void include(java.lang.String uri, java.util.Map params) throws javax.servlet.ServletException, java.io.IOException
DspContext
include
in interface DspContext
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.javax.servlet.ServletException
java.io.IOException
public boolean isIncluded()
DspContext
isIncluded
in interface DspContext
public java.io.Writer getOut() throws java.io.IOException
RequestContext
getOut
in interface RequestContext
java.io.IOException
public javax.servlet.ServletRequest getRequest()
RequestContext
getRequest
in interface RequestContext
public javax.servlet.ServletResponse getResponse()
RequestContext
getResponse
in interface RequestContext
public javax.servlet.ServletContext getServletContext()
RequestContext
getServletContext
in interface RequestContext
public VariableResolver getVariableResolver()
RequestContext
getVariableResolver
in interface RequestContext
Copyright © 2005-2011 Potix Corporation. All Rights Reserved.