|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.struts2.dispatcher.StrutsResultSupport
org.apache.struts2.dispatcher.VelocityResult
public class VelocityResult
Using the Servlet container's JspFactory
, this result mocks a JSP
execution environment and then displays a Velocity template that will be
streamed directly to the servlet output.
This result follows the same rules from StrutsResultSupport
.
<result name="success" type="velocity"> <param name="location">foo.vm</param> </result>
Field Summary |
---|
Fields inherited from class org.apache.struts2.dispatcher.StrutsResultSupport |
---|
DEFAULT_PARAM, encode, location, parse |
Fields inherited from interface org.apache.struts2.StrutsStatics |
---|
HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_PORTLET_CONTEXT |
Constructor Summary | |
---|---|
VelocityResult()
|
Method Summary | |
---|---|
protected org.apache.velocity.context.Context |
createContext(VelocityManager velocityManager,
com.opensymphony.xwork2.util.OgnlValueStack stack,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String location)
Creates the VelocityContext that we'll use to render this page. |
void |
doExecute(java.lang.String finalLocation,
com.opensymphony.xwork2.ActionInvocation invocation)
Creates a Velocity context from the action, loads a Velocity template and executes the template. |
protected java.lang.String |
getContentType(java.lang.String templateLocation)
Retrieve the content type for this template. |
protected java.lang.String |
getEncoding(java.lang.String templateLocation)
Retrieve the encoding for this template. |
protected org.apache.velocity.Template |
getTemplate(com.opensymphony.xwork2.util.OgnlValueStack stack,
org.apache.velocity.app.VelocityEngine velocity,
com.opensymphony.xwork2.ActionInvocation invocation,
java.lang.String location,
java.lang.String encoding)
Given a value stack, a Velocity engine, and an action invocation, this method returns the appropriate Velocity template to render. |
Methods inherited from class org.apache.struts2.dispatcher.StrutsResultSupport |
---|
conditionalParse, execute, setEncode, setLocation, setParse |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VelocityResult()
Method Detail |
---|
public void doExecute(java.lang.String finalLocation, com.opensymphony.xwork2.ActionInvocation invocation) throws java.lang.Exception
doExecute
in class StrutsResultSupport
finalLocation
- the location of the Velocity templateinvocation
- an encapsulation of the action execution state.
java.lang.Exception
- if an error occurs when creating the Velocity context, loading or executing
the template or writing output to the servlet response stream.protected java.lang.String getContentType(java.lang.String templateLocation)
protected java.lang.String getEncoding(java.lang.String templateLocation)
protected org.apache.velocity.Template getTemplate(com.opensymphony.xwork2.util.OgnlValueStack stack, org.apache.velocity.app.VelocityEngine velocity, com.opensymphony.xwork2.ActionInvocation invocation, java.lang.String location, java.lang.String encoding) throws java.lang.Exception
stack
- the value stack to resolve the location again (when parse equals true)velocity
- the velocity engine to process the request againstinvocation
- an encapsulation of the action execution state.location
- the location of the templateencoding
- the charset encoding of the template
java.lang.Exception
- when the requested template could not be foundprotected org.apache.velocity.context.Context createContext(VelocityManager velocityManager, com.opensymphony.xwork2.util.OgnlValueStack stack, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String location)
velocityManager
- a reference to the velocityManager to usestack
- the value stack to resolve the location against (when parse equals true)location
- the name of the template that is being used
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |