public class PortletVelocityResult extends StrutsResultSupport
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 type takes the following parameters:
This result follows the same rules from StrutsResultSupport.
Example:
<!-- START SNIPPET: example -->
<result name="success" type="velocity">
<param name="location">foo.vm</param>
</result>
<!-- END SNIPPET: example -->
Result.LegacyAdapterDEFAULT_PARAM, DEFAULT_URL_ENCODING, parseLocationACTION_MAPPING, HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_ACTION_TAG_INVOCATION, STRUTS_PORTLET_CONTEXT| Constructor and Description |
|---|
PortletVelocityResult() |
PortletVelocityResult(String location) |
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.velocity.context.Context |
createContext(VelocityManagerInterface velocityManager,
ValueStack stack,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String location)
Creates the VelocityContext that we'll use to render this page.
|
protected org.apache.velocity.context.Context |
createContext(VelocityManager velocityManager,
ValueStack stack,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String location)
Deprecated.
since 6.4.0
|
void |
doExecute(String location,
ActionInvocation invocation) |
void |
executeRenderResult(String finalLocation,
ActionInvocation invocation)
Creates a Velocity context from the action, loads a Velocity template and
executes the template.
|
protected String |
getContentType(String templateLocation)
Retrieve the content type for this template.
|
protected String |
getEncoding(String templateLocation)
Retrieve the encoding for this template.
|
protected org.apache.velocity.Template |
getTemplate(ValueStack stack,
org.apache.velocity.app.VelocityEngine velocity,
ActionInvocation invocation,
String location,
String encoding)
Given a value stack, a Velocity engine, and an action invocation, this
method returns the appropriate Velocity template to render.
|
void |
setDefaultEncoding(String encoding) |
void |
setVelocityManager(VelocityManager mgr)
Deprecated.
since 6.4.0
|
void |
setVelocityManager(VelocityManagerInterface mgr) |
conditionalParse, conditionalParseCollection, doExecute, execute, getLastFinalLocation, getLocation, setEncode, setLocation, setParsepublic PortletVelocityResult()
public PortletVelocityResult(String location)
public void setVelocityManager(VelocityManagerInterface mgr)
@Deprecated public void setVelocityManager(VelocityManager mgr)
public void setDefaultEncoding(String encoding)
public void doExecute(String location, ActionInvocation invocation) throws Exception
doExecute in class StrutsResultSupportExceptionpublic void executeRenderResult(String finalLocation, ActionInvocation invocation) throws Exception
finalLocation - the location of the Velocity templateinvocation - an encapsulation of the action execution state.Exception - if an error occurs when creating the Velocity context,
loading or executing the template or writing output to the
servlet response stream.protected String getContentType(String templateLocation)
templateLocation - location of templatesprotected String getEncoding(String templateLocation)
templateLocation - location of templatesprotected org.apache.velocity.Template getTemplate(ValueStack stack, org.apache.velocity.app.VelocityEngine velocity, ActionInvocation invocation, String location, String encoding) throws 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 templateException - when the requested template could not be foundprotected org.apache.velocity.context.Context createContext(VelocityManagerInterface velocityManager, ValueStack stack, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String location)
velocityManager - a reference to the velocityManager to usestack - the value stack to resolve the location against (when parse
equals true)request - servlet requestresponse - servlet responselocation - the name of the template that is being used@Deprecated protected org.apache.velocity.context.Context createContext(VelocityManager velocityManager, ValueStack stack, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String location)
Copyright © 2000–2024 Apache Software Foundation. All rights reserved.