mirror of
https://github.com/apache/struts.git
synced 2026-08-06 15:17:00 +00:00
WW-1645 Refactored portlet support into a plugin.
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@557544 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.pluto</groupId>
|
||||
<artifactId>maven-pluto-plugin</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<version>1.1.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
@@ -66,6 +66,11 @@
|
||||
<artifactId>struts2-core</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-portlet-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>velocity</groupId>
|
||||
<artifactId>velocity</artifactId>
|
||||
|
||||
+7
-28
@@ -337,21 +337,6 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Portlet -->
|
||||
<dependency>
|
||||
<groupId>portlet-api</groupId>
|
||||
<artifactId>portlet-api</artifactId>
|
||||
<version>1.0</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.pluto</groupId>
|
||||
<artifactId>pluto</artifactId>
|
||||
<version>1.0.1-rc4</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Mocks for unit testing (by Spring) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
@@ -387,12 +372,6 @@
|
||||
<classifier>jdk15</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jmock</groupId>
|
||||
<artifactId>jmock</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
@@ -412,13 +391,6 @@
|
||||
</exclusions>
|
||||
</dependency-->
|
||||
|
||||
<dependency>
|
||||
<groupId>jmock</groupId>
|
||||
<artifactId>jmock-cglib</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mockobjects</groupId>
|
||||
<artifactId>mockobjects-core</artifactId>
|
||||
@@ -454,6 +426,13 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jmock</groupId>
|
||||
<artifactId>jmock</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
|
||||
@@ -55,6 +55,8 @@ public final class StrutsConstants {
|
||||
/** The default includeParams method to generate Struts URLs */
|
||||
public static final String STRUTS_URL_INCLUDEPARAMS = "struts.url.includeParams";
|
||||
|
||||
public static final String STRUTS_URL_RENDERER = "struts.urlRenderer";
|
||||
|
||||
/** The com.opensymphony.xwork2.ObjectFactory implementation class */
|
||||
public static final String STRUTS_OBJECTFACTORY = "struts.objectFactory";
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapping;
|
||||
import org.apache.struts2.portlet.context.PortletActionContext;
|
||||
import org.apache.struts2.portlet.util.PortletUrlHelper;
|
||||
//import org.apache.struts2.portlet.context.PortletActionContext;
|
||||
//import org.apache.struts2.portlet.util.PortletUrlHelper;
|
||||
import org.apache.struts2.views.util.UrlHelper;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
@@ -115,6 +115,7 @@ public class Form extends ClosingUIBean {
|
||||
protected boolean enableDynamicMethodInvocation = true;
|
||||
protected Configuration configuration;
|
||||
protected ObjectFactory objectFactory;
|
||||
protected UrlRenderer urlRenderer;
|
||||
|
||||
public Form(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
|
||||
super(stack, request, response);
|
||||
@@ -146,6 +147,11 @@ public class Form extends ClosingUIBean {
|
||||
public void setObjectFactory(ObjectFactory objectFactory) {
|
||||
this.objectFactory = objectFactory;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setUrlRenderer(UrlRenderer urlRenderer) {
|
||||
this.urlRenderer = urlRenderer;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -227,13 +233,7 @@ public class Form extends ClosingUIBean {
|
||||
if (id != null) {
|
||||
addParameter("id", escape(id));
|
||||
}
|
||||
if (Dispatcher.getInstance().isPortletSupportActive() && PortletActionContext.isPortletRequest()) {
|
||||
evaluateExtraParamsPortletRequest(namespace, action);
|
||||
} else {
|
||||
String namespace = determineNamespace(this.namespace, getStack(),
|
||||
request);
|
||||
evaluateExtraParamsServletRequest(action, namespace, isAjax);
|
||||
}
|
||||
urlRenderer.renderFormUrl(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,96 +241,9 @@ public class Form extends ClosingUIBean {
|
||||
* @param namespace
|
||||
* @param action
|
||||
*/
|
||||
private void evaluateExtraParamsServletRequest(String action, String namespace, boolean isAjax) {
|
||||
if (action == null) {
|
||||
// no action supplied? ok, then default to the current request (action or general URL)
|
||||
ActionInvocation ai = (ActionInvocation) getStack().getContext().get(ActionContext.ACTION_INVOCATION);
|
||||
if (ai != null) {
|
||||
action = ai.getProxy().getActionName();
|
||||
namespace = ai.getProxy().getNamespace();
|
||||
} else {
|
||||
// hmm, ok, we need to just assume the current URL cut down
|
||||
String uri = request.getRequestURI();
|
||||
action = uri.substring(uri.lastIndexOf('/'));
|
||||
}
|
||||
}
|
||||
|
||||
String actionMethod = "";
|
||||
// FIXME: our implementation is flawed - the only concept of ! should be in DefaultActionMapper
|
||||
// handle "name!method" convention.
|
||||
if (enableDynamicMethodInvocation) {
|
||||
if (action.indexOf("!") != -1) {
|
||||
int endIdx = action.lastIndexOf("!");
|
||||
actionMethod = action.substring(endIdx + 1, action.length());
|
||||
action = action.substring(0, endIdx);
|
||||
}
|
||||
}
|
||||
|
||||
final ActionConfig actionConfig = configuration.getRuntimeConfiguration().getActionConfig(namespace, action);
|
||||
String actionName = action;
|
||||
if (actionConfig != null) {
|
||||
|
||||
ActionMapping mapping = new ActionMapping(action, namespace, actionMethod, parameters);
|
||||
String result = UrlHelper.buildUrl(actionMapper.getUriFromActionMapping(mapping), request, response, null);
|
||||
addParameter("action", result);
|
||||
|
||||
// let's try to get the actual action class and name
|
||||
// this can be used for getting the list of validators
|
||||
addParameter("actionName", actionName);
|
||||
try {
|
||||
Class clazz = objectFactory.getClassInstance(actionConfig.getClassName());
|
||||
addParameter("actionClass", clazz);
|
||||
} catch (ClassNotFoundException e) {
|
||||
// this is OK, we'll just move on
|
||||
}
|
||||
|
||||
addParameter("namespace", namespace);
|
||||
|
||||
// if the name isn't specified, use the action name
|
||||
if (name == null) {
|
||||
addParameter("name", action);
|
||||
}
|
||||
|
||||
// if the id isn't specified, use the action name
|
||||
if (id == null) {
|
||||
addParameter("id", action);
|
||||
}
|
||||
} else if (action != null) {
|
||||
// Since we can't find an action alias in the configuration, we just assume
|
||||
// the action attribute supplied is the path to be used as the uri this
|
||||
// form is submitting to.
|
||||
|
||||
String result = UrlHelper.buildUrl(action, request, response, null);
|
||||
addParameter("action", result);
|
||||
|
||||
// namespace: cut out anything between the start and the last /
|
||||
int slash = result.lastIndexOf('/');
|
||||
if (slash != -1) {
|
||||
addParameter("namespace", result.substring(0, slash));
|
||||
} else {
|
||||
addParameter("namespace", "");
|
||||
}
|
||||
|
||||
// name/id: cut out anything between / and . should be the id and name
|
||||
if (id == null) {
|
||||
slash = result.lastIndexOf('/');
|
||||
int dot = result.indexOf('.', slash);
|
||||
if (dot != -1) {
|
||||
id = result.substring(slash + 1, dot);
|
||||
} else {
|
||||
id = result.substring(slash + 1);
|
||||
}
|
||||
addParameter("id", escape(id));
|
||||
}
|
||||
}
|
||||
|
||||
// WW-1284
|
||||
// evaluate if client-side js is to be enabled. (if validation interceptor
|
||||
// does allow validation eg. method is not filtered out)
|
||||
evaluateClientSideJsEnablement(actionName, namespace, actionMethod);
|
||||
}
|
||||
|
||||
private void evaluateClientSideJsEnablement(String actionName, String namespace, String actionMethod) {
|
||||
protected void evaluateClientSideJsEnablement(String actionName, String namespace, String actionMethod) {
|
||||
|
||||
// Only evaluate if Client-Side js is to be enable when validate=true
|
||||
Boolean validate = (Boolean) getParameters().get("validate");
|
||||
@@ -361,53 +274,6 @@ public class Form extends ClosingUIBean {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the action url adapted to a portal environment.
|
||||
*
|
||||
* @param action The action to create the URL for.
|
||||
*/
|
||||
private void evaluateExtraParamsPortletRequest(String namespace, String action) {
|
||||
|
||||
if (this.action != null) {
|
||||
// if it isn't specified, we'll make somethig up
|
||||
action = findString(this.action);
|
||||
}
|
||||
|
||||
String type = "action";
|
||||
if (TextUtils.stringSet(method)) {
|
||||
if ("GET".equalsIgnoreCase(method.trim())) {
|
||||
type = "render";
|
||||
}
|
||||
}
|
||||
if (action != null) {
|
||||
String result = PortletUrlHelper.buildUrl(action, namespace,
|
||||
getParameters(), type, portletMode, windowState);
|
||||
addParameter("action", result);
|
||||
|
||||
// namespace: cut out anything between the start and the last /
|
||||
int slash = result.lastIndexOf('/');
|
||||
if (slash != -1) {
|
||||
addParameter("namespace", result.substring(0, slash));
|
||||
} else {
|
||||
addParameter("namespace", "");
|
||||
}
|
||||
|
||||
// name/id: cut out anything between / and . should be the id and
|
||||
// name
|
||||
if (id == null) {
|
||||
slash = action.lastIndexOf('/');
|
||||
int dot = action.indexOf('.', slash);
|
||||
if (dot != -1) {
|
||||
id = action.substring(slash + 1, dot);
|
||||
} else {
|
||||
id = action.substring(slash + 1);
|
||||
}
|
||||
addParameter("id", escape(id));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List getValidators(String name) {
|
||||
Class actionClass = (Class) getParameters().get("actionClass");
|
||||
if (actionClass == null) {
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapping;
|
||||
import org.apache.struts2.views.util.UrlHelper;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.config.entities.ActionConfig;
|
||||
|
||||
/**
|
||||
* Implementation of the {@link UrlRenderer} interface that creates URLs suitable in a servlet environment.
|
||||
*
|
||||
*/
|
||||
public class ServletUrlRenderer implements UrlRenderer {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void renderUrl(Writer writer, URL urlComponent) {
|
||||
String scheme = urlComponent.req.getScheme();
|
||||
|
||||
if (urlComponent.scheme != null) {
|
||||
scheme = urlComponent.scheme;
|
||||
}
|
||||
|
||||
String result;
|
||||
if (urlComponent.value == null && urlComponent.action != null) {
|
||||
result = urlComponent.determineActionURL(urlComponent.action, urlComponent.namespace, urlComponent.method, urlComponent.req, urlComponent.res, urlComponent.parameters, scheme, urlComponent.includeContext, urlComponent.encode);
|
||||
} else {
|
||||
String _value = urlComponent.value;
|
||||
|
||||
// We don't include the request parameters cause they would have been
|
||||
// prioritised before this [in start(Writer) method]
|
||||
if (_value != null && _value.indexOf("?") > 0) {
|
||||
_value = _value.substring(0, _value.indexOf("?"));
|
||||
}
|
||||
result = UrlHelper.buildUrl(_value, urlComponent.req, urlComponent.res, urlComponent.parameters, scheme, urlComponent.includeContext, urlComponent.encode);
|
||||
}
|
||||
if ( urlComponent.anchor != null && urlComponent.anchor.length() > 0 ) {
|
||||
result += '#' + urlComponent.anchor;
|
||||
}
|
||||
|
||||
String var = urlComponent.getVar();
|
||||
|
||||
if (var != null) {
|
||||
urlComponent.putInContext(result);
|
||||
|
||||
// add to the request and page scopes as well
|
||||
urlComponent.req.setAttribute(var, result);
|
||||
} else {
|
||||
try {
|
||||
writer.write(result);
|
||||
} catch (IOException e) {
|
||||
throw new StrutsException("IOError: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void renderFormUrl(Form formComponent) {
|
||||
String namespace = formComponent.determineNamespace(formComponent.namespace, formComponent.getStack(),
|
||||
formComponent.request);
|
||||
String action = null;
|
||||
|
||||
if(formComponent.action != null) {
|
||||
action = formComponent.findString(formComponent.action);
|
||||
}
|
||||
|
||||
if (formComponent.action == null) {
|
||||
// no action supplied? ok, then default to the current request
|
||||
// (action or general URL)
|
||||
ActionInvocation ai = (ActionInvocation) formComponent.getStack().getContext().get(
|
||||
ActionContext.ACTION_INVOCATION);
|
||||
if (ai != null) {
|
||||
action = ai.getProxy().getActionName();
|
||||
namespace = ai.getProxy().getNamespace();
|
||||
} else {
|
||||
// hmm, ok, we need to just assume the current URL cut down
|
||||
String uri = formComponent.request.getRequestURI();
|
||||
action = uri.substring(uri.lastIndexOf('/'));
|
||||
}
|
||||
}
|
||||
|
||||
String actionMethod = "";
|
||||
// FIXME: our implementation is flawed - the only concept of ! should be
|
||||
// in DefaultActionMapper
|
||||
// handle "name!method" convention.
|
||||
if (formComponent.enableDynamicMethodInvocation) {
|
||||
if (action.indexOf("!") != -1) {
|
||||
int endIdx = action.lastIndexOf("!");
|
||||
actionMethod = action.substring(endIdx + 1, action.length());
|
||||
action = action.substring(0, endIdx);
|
||||
}
|
||||
}
|
||||
|
||||
final ActionConfig actionConfig = formComponent.configuration.getRuntimeConfiguration().getActionConfig(
|
||||
namespace, action);
|
||||
String actionName = action;
|
||||
if (actionConfig != null) {
|
||||
|
||||
ActionMapping mapping = new ActionMapping(action, namespace, actionMethod, formComponent.parameters);
|
||||
String result = UrlHelper.buildUrl(formComponent.actionMapper.getUriFromActionMapping(mapping),
|
||||
formComponent.request, formComponent.response, null);
|
||||
formComponent.addParameter("action", result);
|
||||
|
||||
// let's try to get the actual action class and name
|
||||
// this can be used for getting the list of validators
|
||||
formComponent.addParameter("actionName", actionName);
|
||||
try {
|
||||
Class clazz = formComponent.objectFactory.getClassInstance(actionConfig.getClassName());
|
||||
formComponent.addParameter("actionClass", clazz);
|
||||
} catch (ClassNotFoundException e) {
|
||||
// this is OK, we'll just move on
|
||||
}
|
||||
|
||||
formComponent.addParameter("namespace", namespace);
|
||||
|
||||
// if the name isn't specified, use the action name
|
||||
if (formComponent.name == null) {
|
||||
formComponent.addParameter("name", action);
|
||||
}
|
||||
|
||||
// if the id isn't specified, use the action name
|
||||
if (formComponent.getId() == null) {
|
||||
formComponent.addParameter("id", action);
|
||||
}
|
||||
} else if (action != null) {
|
||||
// Since we can't find an action alias in the configuration, we just
|
||||
// assume
|
||||
// the action attribute supplied is the path to be used as the uri
|
||||
// this
|
||||
// form is submitting to.
|
||||
|
||||
String result = UrlHelper.buildUrl(action, formComponent.request, formComponent.response, null);
|
||||
formComponent.addParameter("action", result);
|
||||
|
||||
// namespace: cut out anything between the start and the last /
|
||||
int slash = result.lastIndexOf('/');
|
||||
if (slash != -1) {
|
||||
formComponent.addParameter("namespace", result.substring(0, slash));
|
||||
} else {
|
||||
formComponent.addParameter("namespace", "");
|
||||
}
|
||||
|
||||
// name/id: cut out anything between / and . should be the id and
|
||||
// name
|
||||
String id = formComponent.getId();
|
||||
if (id == null) {
|
||||
slash = result.lastIndexOf('/');
|
||||
int dot = result.indexOf('.', slash);
|
||||
if (dot != -1) {
|
||||
id = result.substring(slash + 1, dot);
|
||||
} else {
|
||||
id = result.substring(slash + 1);
|
||||
}
|
||||
formComponent.addParameter("id", formComponent.escape(id));
|
||||
}
|
||||
}
|
||||
|
||||
// WW-1284
|
||||
// evaluate if client-side js is to be enabled. (if validation
|
||||
// interceptor
|
||||
// does allow validation eg. method is not filtered out)
|
||||
formComponent.evaluateClientSideJsEnablement(actionName, namespace, actionMethod);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,8 +37,6 @@ import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.portlet.context.PortletActionContext;
|
||||
import org.apache.struts2.portlet.util.PortletUrlHelper;
|
||||
import org.apache.struts2.views.util.UrlHelper;
|
||||
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
@@ -125,8 +123,8 @@ public class URL extends ContextBean {
|
||||
public static final String GET = "get";
|
||||
public static final String ALL = "all";
|
||||
|
||||
private HttpServletRequest req;
|
||||
private HttpServletResponse res;
|
||||
protected HttpServletRequest req;
|
||||
protected HttpServletResponse res;
|
||||
|
||||
protected String includeParams;
|
||||
protected String scheme;
|
||||
@@ -142,6 +140,7 @@ public class URL extends ContextBean {
|
||||
protected String anchor;
|
||||
protected String urlIncludeParams;
|
||||
protected ExtraParameterProvider extraParameterProvider;
|
||||
protected UrlRenderer urlRenderer;
|
||||
|
||||
public URL(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
|
||||
super(stack);
|
||||
@@ -153,6 +152,11 @@ public class URL extends ContextBean {
|
||||
public void setUrlIncludeParams(String urlIncludeParams) {
|
||||
this.urlIncludeParams = urlIncludeParams;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setUrlRenderer(UrlRenderer urlRenderer) {
|
||||
this.urlRenderer = urlRenderer;
|
||||
}
|
||||
|
||||
@Inject(required=false)
|
||||
public void setExtraParameterProvider(ExtraParameterProvider provider) {
|
||||
@@ -204,10 +208,8 @@ public class URL extends ContextBean {
|
||||
}
|
||||
}
|
||||
private void includeGetParameters() {
|
||||
if(!(Dispatcher.getInstance().isPortletSupportActive() && PortletActionContext.isPortletRequest())) {
|
||||
String query = extractQueryString();
|
||||
mergeRequestParameters(value, parameters, UrlHelper.parseQueryString(query));
|
||||
}
|
||||
String query = extractQueryString();
|
||||
mergeRequestParameters(value, parameters, UrlHelper.parseQueryString(query));
|
||||
}
|
||||
|
||||
private String extractQueryString() {
|
||||
@@ -229,53 +231,7 @@ public class URL extends ContextBean {
|
||||
}
|
||||
|
||||
public boolean end(Writer writer, String body) {
|
||||
String scheme = req.getScheme();
|
||||
|
||||
if (this.scheme != null) {
|
||||
scheme = this.scheme;
|
||||
}
|
||||
|
||||
String result;
|
||||
if (value == null && action != null) {
|
||||
if(Dispatcher.getInstance().isPortletSupportActive() && PortletActionContext.isPortletRequest()) {
|
||||
result = PortletUrlHelper.buildUrl(action, namespace, parameters, portletUrlType, portletMode, windowState);
|
||||
}
|
||||
else {
|
||||
result = determineActionURL(action, namespace, method, req, res, parameters, scheme, includeContext, encode);
|
||||
}
|
||||
} else {
|
||||
if(Dispatcher.getInstance().isPortletSupportActive() && PortletActionContext.isPortletRequest()) {
|
||||
result = PortletUrlHelper.buildResourceUrl(value, parameters);
|
||||
}
|
||||
else {
|
||||
String _value = value;
|
||||
|
||||
// We don't include the request parameters cause they would have been
|
||||
// prioritised before this [in start(Writer) method]
|
||||
if (_value != null && _value.indexOf("?") > 0) {
|
||||
_value = _value.substring(0, _value.indexOf("?"));
|
||||
}
|
||||
result = UrlHelper.buildUrl(_value, req, res, parameters, scheme, includeContext, encode);
|
||||
}
|
||||
}
|
||||
if ( anchor != null && anchor.length() > 0 ) {
|
||||
result += '#' + anchor;
|
||||
}
|
||||
|
||||
String var = getVar();
|
||||
|
||||
if (var != null) {
|
||||
putInContext(result);
|
||||
|
||||
// add to the request and page scopes as well
|
||||
req.setAttribute(var, result);
|
||||
} else {
|
||||
try {
|
||||
writer.write(result);
|
||||
} catch (IOException e) {
|
||||
throw new StrutsException("IOError: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
urlRenderer.renderUrl(writer, this);
|
||||
return super.end(writer, body);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
/**
|
||||
* Implementations of this interface are responsible for rendering/creating URLs for a specific
|
||||
* environment (e.g. Servlet, Portlet).
|
||||
*
|
||||
*/
|
||||
public interface UrlRenderer {
|
||||
/**
|
||||
* Render a URL.
|
||||
* @param writer A writer that the implementation can use to write the result to.
|
||||
* @param urlComponent The {@link URL} component that "owns" this renderer.
|
||||
*/
|
||||
void renderUrl(Writer writer, URL urlComponent);
|
||||
|
||||
/**
|
||||
* Render a Form URL.
|
||||
* @param formComponent The {@link Form} component that "owns" this renderer.
|
||||
*/
|
||||
void renderFormUrl(Form formComponent);
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import java.util.StringTokenizer;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.components.UrlRenderer;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapper;
|
||||
import org.apache.struts2.dispatcher.multipart.MultiPartRequest;
|
||||
import org.apache.struts2.views.freemarker.FreemarkerManager;
|
||||
@@ -159,6 +160,7 @@ public class BeanSelectionProvider implements ConfigurationProvider {
|
||||
alias(MultiPartRequest.class, StrutsConstants.STRUTS_MULTIPART_PARSER, builder, props, Scope.DEFAULT);
|
||||
alias(FreemarkerManager.class, StrutsConstants.STRUTS_FREEMARKER_MANAGER_CLASSNAME, builder, props);
|
||||
alias(VelocityManager.class, StrutsConstants.STRUTS_VELOCITY_MANAGER_CLASSNAME, builder, props);
|
||||
alias(UrlRenderer.class, StrutsConstants.STRUTS_URL_RENDERER, builder, props);
|
||||
|
||||
if ("true".equalsIgnoreCase(props.getProperty(StrutsConstants.STRUTS_DEVMODE))) {
|
||||
props.setProperty(StrutsConstants.STRUTS_I18N_RELOAD, "true");
|
||||
|
||||
@@ -25,12 +25,9 @@ import java.util.Map;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.portlet.PortletRequest;
|
||||
|
||||
import org.apache.struts2.StrutsStatics;
|
||||
import org.apache.struts2.servlet.interceptor.ServletPrincipalProxy;
|
||||
import org.apache.struts2.portlet.PortletActionConstants;
|
||||
import org.apache.struts2.portlet.interceptor.PortletPrincipalProxy;
|
||||
import org.apache.struts2.util.ServletContextAware;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
@@ -154,11 +151,7 @@ public class ServletConfigInterceptor extends AbstractInterceptor implements Str
|
||||
|
||||
if (action instanceof PrincipalAware) {
|
||||
HttpServletRequest request = (HttpServletRequest) context.get(HTTP_REQUEST);
|
||||
Object portletRequest = context.get(PortletActionConstants.REQUEST);
|
||||
if (portletRequest != null) {
|
||||
// We are in portlet environment, so principal information resides in PortletRequest
|
||||
((PrincipalAware) action).setPrincipalProxy(new PortletPrincipalProxy((PortletRequest) portletRequest));
|
||||
} else {
|
||||
if(request != null) {
|
||||
// We are in servtlet environment, so principal information resides in HttpServletRequest
|
||||
((PrincipalAware) action).setPrincipalProxy(new ServletPrincipalProxy(request));
|
||||
}
|
||||
|
||||
@@ -133,12 +133,16 @@ public class ServletConfigInterceptorTest extends StrutsTestCase {
|
||||
}
|
||||
|
||||
public void testPrincipalAware() throws Exception {
|
||||
MockHttpServletRequest req = new MockHttpServletRequest();
|
||||
req.setUserPrincipal(null);
|
||||
req.setRemoteUser("Santa");
|
||||
MockControl control = MockControl.createControl(PrincipalAware.class);
|
||||
control.setDefaultMatcher(MockControl.ALWAYS_MATCHER); // less strick match is needed for this unit test to be conducted using mocks
|
||||
PrincipalAware mock = (PrincipalAware) control.getMock();
|
||||
|
||||
MockActionInvocation mai = createActionInvocation(mock);
|
||||
|
||||
mai.getInvocationContext().put(StrutsStatics.HTTP_REQUEST, req);
|
||||
|
||||
MockServletContext ctx = new MockServletContext();
|
||||
mai.getInvocationContext().put(StrutsStatics.SERVLET_CONTEXT, ctx);
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.portlet.util;
|
||||
package org.apache.struts2.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -32,6 +32,7 @@
|
||||
<module>struts1</module>
|
||||
<module>tiles</module>
|
||||
<module>dojo</module>
|
||||
<module>portlet</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plugins</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-portlet-plugin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>Struts 2 Portlet Plugin</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/portlet/</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/portlet/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/plugins/portlet/</url>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jsp-api</artifactId>
|
||||
<version>2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Velocity -->
|
||||
<dependency>
|
||||
<groupId>velocity</groupId>
|
||||
<artifactId>velocity</artifactId>
|
||||
<version>1.4</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>velocity-tools</groupId>
|
||||
<artifactId>velocity-tools</artifactId>
|
||||
<version>1.1</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Portlet -->
|
||||
<dependency>
|
||||
<groupId>portlet-api</groupId>
|
||||
<artifactId>portlet-api</artifactId>
|
||||
<version>1.0</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mockobjects</groupId>
|
||||
<artifactId>mockobjects-jdk1.3-j2ee1.3</artifactId>
|
||||
<version>0.09</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<version>2.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jmock</groupId>
|
||||
<artifactId>jmock</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jmock</groupId>
|
||||
<artifactId>jmock-cglib</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mockobjects</groupId>
|
||||
<artifactId>mockobjects-core</artifactId>
|
||||
<version>0.09</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Mocks for unit testing (by Spring) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-mock</artifactId>
|
||||
<version>1.2.8</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>1.2.8</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,104 @@
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.components.URL;
|
||||
import org.apache.struts2.components.UrlRenderer;
|
||||
import org.apache.struts2.portlet.util.PortletUrlHelper;
|
||||
|
||||
import com.opensymphony.xwork2.util.TextUtils;
|
||||
|
||||
/**
|
||||
* Implementation of the {@link URLRenderer} interface that renders URLs for portlet environments.
|
||||
*
|
||||
* @see URLRenderer
|
||||
*
|
||||
*/
|
||||
public class PortletUrlRenderer implements UrlRenderer {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void renderUrl(Writer writer, URL urlComponent) {
|
||||
String scheme = urlComponent.req.getScheme();
|
||||
|
||||
if (urlComponent.scheme != null) {
|
||||
scheme = urlComponent.scheme;
|
||||
}
|
||||
|
||||
String result;
|
||||
if (urlComponent.value == null && urlComponent.action != null) {
|
||||
result = PortletUrlHelper.buildUrl(urlComponent.action, urlComponent.namespace, urlComponent.parameters, urlComponent.portletUrlType, urlComponent.portletMode, urlComponent.windowState);
|
||||
} else {
|
||||
result = PortletUrlHelper.buildResourceUrl(urlComponent.value, urlComponent.parameters);
|
||||
}
|
||||
if ( urlComponent.anchor != null && urlComponent.anchor.length() > 0 ) {
|
||||
result += '#' + urlComponent.anchor;
|
||||
}
|
||||
|
||||
String var = urlComponent.getVar();
|
||||
|
||||
if (var != null) {
|
||||
urlComponent.putInContext(result);
|
||||
|
||||
// add to the request and page scopes as well
|
||||
urlComponent.req.setAttribute(var, result);
|
||||
} else {
|
||||
try {
|
||||
writer.write(result);
|
||||
} catch (IOException e) {
|
||||
throw new StrutsException("IOError: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void renderFormUrl(Form formComponent) {
|
||||
String action = null;
|
||||
if (formComponent.action != null) {
|
||||
// if it isn't specified, we'll make somethig up
|
||||
action = formComponent.findString(formComponent.action);
|
||||
}
|
||||
|
||||
String type = "action";
|
||||
if (TextUtils.stringSet(formComponent.method)) {
|
||||
if ("GET".equalsIgnoreCase(formComponent.method.trim())) {
|
||||
type = "render";
|
||||
}
|
||||
}
|
||||
if (action != null) {
|
||||
String result = PortletUrlHelper.buildUrl(action, formComponent.namespace,
|
||||
formComponent.getParameters(), type, formComponent.portletMode, formComponent.windowState);
|
||||
formComponent.addParameter("action", result);
|
||||
|
||||
// namespace: cut out anything between the start and the last /
|
||||
int slash = result.lastIndexOf('/');
|
||||
if (slash != -1) {
|
||||
formComponent.addParameter("namespace", result.substring(0, slash));
|
||||
} else {
|
||||
formComponent.addParameter("namespace", "");
|
||||
}
|
||||
|
||||
// name/id: cut out anything between / and . should be the id and
|
||||
// name
|
||||
String id = formComponent.getId();
|
||||
if (id == null) {
|
||||
slash = action.lastIndexOf('/');
|
||||
int dot = action.indexOf('.', slash);
|
||||
if (dot != -1) {
|
||||
id = action.substring(slash + 1, dot);
|
||||
} else {
|
||||
id = action.substring(slash + 1);
|
||||
}
|
||||
formComponent.addParameter("id", formComponent.escape(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+3
@@ -36,6 +36,7 @@ import javax.portlet.PortletRequest;
|
||||
import javax.portlet.PortletResponse;
|
||||
import javax.portlet.RenderRequest;
|
||||
import javax.portlet.RenderResponse;
|
||||
import javax.portlet.WindowState;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -300,6 +301,7 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics,
|
||||
LOG.debug("Entering render");
|
||||
resetActionContext();
|
||||
response.setTitle(getTitle(request));
|
||||
if(!request.getWindowState().equals(WindowState.MINIMIZED)) {
|
||||
try {
|
||||
// Check to see if an event set the render to be included directly
|
||||
serviceAction(request, response, getActionMapping(request),
|
||||
@@ -310,6 +312,7 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics,
|
||||
} finally {
|
||||
resetActionContext();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,174 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
@@ -0,0 +1,5 @@
|
||||
Apache Struts
|
||||
Copyright 2000-2007 The Apache Software Foundation
|
||||
|
||||
This product includes software developed by
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.0.dtd">
|
||||
|
||||
<struts>
|
||||
|
||||
<bean type="org.apache.struts2.components.UrlRenderer" name="portlet" class="org.apache.struts2.components.PortletUrlRenderer"/>
|
||||
<constant name="struts.urlRenderer" value="portlet" />
|
||||
|
||||
<package name="struts-portlet-default" extends="struts-default">
|
||||
|
||||
<result-types>
|
||||
<result-type name="dispatcher" class="org.apache.struts2.portlet.result.PortletResult" default="true"/>
|
||||
<result-type name="freemarker" class="org.apache.struts2.views.freemarker.PortletFreemarkerResult"/>
|
||||
<result-type name="velocity" class="org.apache.struts2.portlet.result.PortletVelocityResult"/>
|
||||
</result-types>
|
||||
|
||||
<interceptors>
|
||||
<interceptor name="portlet-preferences" class="org.apache.struts2.portlet.interceptor.PortletPreferencesInterceptor"/>
|
||||
<interceptor name="servletConfig" class="org.apache.struts2.portlet.interceptor.PortletConfigInterceptor"/>
|
||||
<interceptor-stack name="portletDefaultStack">
|
||||
<interceptor-ref name="defaultStack"/>
|
||||
<interceptor-ref name="portlet-preferences" />
|
||||
</interceptor-stack>
|
||||
|
||||
</interceptors>
|
||||
|
||||
<default-interceptor-ref name="portletDefaultStack"/>
|
||||
|
||||
<action name="renderDirect" class="org.apache.struts2.portlet.dispatcher.DirectRenderFromEventAction">
|
||||
<result name="success">${location}</result>
|
||||
</action>
|
||||
<action name="freemarkerDirect" class="org.apache.struts2.portlet.dispatcher.DirectRenderFromEventAction">
|
||||
<result type="freemarker" name="success">${location}</result>
|
||||
</action>
|
||||
<action name="velocityDirect" class="org.apache.struts2.portlet.dispatcher.DirectRenderFromEventAction">
|
||||
<result type="velocity" name="success">${location}</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
Reference in New Issue
Block a user