mirror of
https://github.com/apache/struts.git
synced 2026-08-07 07:37:20 +00:00
URL Tag includeParams default attribute value should be configurable
o backport from WW 2.2.4 Issue Number: WW-1442 git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@442946 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -47,7 +47,10 @@ public final class StrutsConstants {
|
||||
/** The HTTPS port used by Struts URLs */
|
||||
public static final String STRUTS_URL_HTTPS_PORT = "struts.url.https.port";
|
||||
|
||||
/** The com.opensymphony.xwork.ObjectFactory implementation class */
|
||||
/** The default includeParams method to generate Struts URLs */
|
||||
public static final String STRUTS_URL_INCLUDEPARAMS = "struts.url.includeParams";
|
||||
|
||||
/** The com.opensymphony.xwork.ObjectFactory implementation class */
|
||||
public static final String STRUTS_OBJECTFACTORY = "struts.objectFactory";
|
||||
|
||||
/** The com.opensymphony.xwork.util.ObjectTypeDeterminer implementation class */
|
||||
|
||||
@@ -30,6 +30,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.config.Settings;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.portlet.context.PortletActionContext;
|
||||
import org.apache.struts2.portlet.util.PortletUrlHelper;
|
||||
@@ -153,7 +155,10 @@ public class URL extends Component {
|
||||
// this at start so body params can override any of these they wish.
|
||||
try {
|
||||
// ww-1266
|
||||
String includeParams = GET;
|
||||
String includeParams =
|
||||
Settings.isSet(StrutsConstants.STRUTS_URL_INCLUDEPARAMS) ?
|
||||
Settings.get(StrutsConstants.STRUTS_URL_INCLUDEPARAMS).toLowerCase() : GET;
|
||||
|
||||
|
||||
if (this.includeParams != null) {
|
||||
includeParams = findString(this.includeParams);
|
||||
|
||||
@@ -122,6 +122,8 @@ struts.configuration.xml.reload=false
|
||||
### used to build URLs, such as the UrlTag
|
||||
struts.url.http.port = 80
|
||||
struts.url.https.port = 443
|
||||
### possible values are: none, get or all
|
||||
struts.url.includeParams = get
|
||||
|
||||
### Load custom default resource bundles
|
||||
# struts.custom.i18n.resources=testmessages,testmessages2
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.opensymphony.xwork2.util.LocalizedTextUtil;
|
||||
public class SettingsTest extends StrutsTestCase {
|
||||
|
||||
public void testSettings() {
|
||||
assertEquals("get", Settings.get(StrutsConstants.STRUTS_URL_INCLUDEPARAMS));
|
||||
assertEquals("12345", Settings.get(StrutsConstants.STRUTS_MULTIPART_MAXSIZE));
|
||||
assertEquals("\temp", Settings.get(StrutsConstants.STRUTS_MULTIPART_SAVEDIR));
|
||||
|
||||
@@ -44,7 +45,7 @@ public class SettingsTest extends StrutsTestCase {
|
||||
assertEquals("de", locale.getLanguage());
|
||||
|
||||
int count = getKeyCount();
|
||||
assertEquals(30, count);
|
||||
assertEquals(31, count);
|
||||
}
|
||||
|
||||
public void testDefaultResourceBundlesLoaded() {
|
||||
|
||||
Reference in New Issue
Block a user