WW-1453 Struts-Blank: Add missing Register.jsp. Dispatcher: Move default file list to default.properties.

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@454642 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ted Nathan Husted
2006-10-10 06:52:49 +00:00
parent 98deff1591
commit a3ba834c2e
8 changed files with 43 additions and 42 deletions
-2
View File
@@ -4,8 +4,6 @@
<struts>
<include file="struts-default.xml"/>
<include file="example.xml"/>
<!-- Add packages here -->
+2 -3
View File
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Struts Blank</display-name>
@@ -0,0 +1,3 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:include value="Missing.jsp"/>
@@ -10,7 +10,6 @@
<body>
<h3>Commands</h3>
<ul>
<li><a href="<s:url action="Register"/>">Register</a></li>
<li><a href="<s:url action="Login!input"/>">Sign On</a></li>
</ul>
@@ -24,9 +23,9 @@
</li>
<li>
<s:url id="url" action="Welcome">
<s:param name="request_locale">ja</s:param>
<s:param name="request_locale">es</s:param>
</s:url>
<s:a href="%{url}">Japanese</s:a>
<s:a href="%{url}">Espanol</s:a>
</li>
</ul>
+1 -1
View File
@@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=example/Welcome.action">
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=example/HelloWorld.action">
</head>
<body>
-2
View File
@@ -5,8 +5,6 @@
<struts>
<include file="struts-default.xml"/>
<include file="mailreader-default.xml"/>
<include file="mailreader-support.xml"/>
@@ -88,9 +88,9 @@ public class Dispatcher {
private static final Log LOG = LogFactory.getLog(Dispatcher.class);
private static ThreadLocal<Dispatcher> instance = new ThreadLocal<Dispatcher>();
private static List<DispatcherListener> dispatcherListeners =
private static List<DispatcherListener> dispatcherListeners =
new ArrayList<DispatcherListener>();
private ConfigurationManager configurationManager;
private static boolean portletSupportActive;
private boolean devMode = false;
@@ -100,34 +100,34 @@ public class Dispatcher {
/**
* Gets the current instance for this thread
*
*
* @return The dispatcher instance
*/
public static Dispatcher getInstance() {
return (Dispatcher) instance.get();
}
/**
/**
* Sets the dispatcher instance for this thread
*
*
* @param instance The instance
*/
public static void setInstance(Dispatcher instance) {
Dispatcher.instance.set(instance);
}
/**
* Adds a dispatcher lifecycle listener
*
*
* @param l The listener
*/
public static synchronized void addDispatcherListener(DispatcherListener l) {
dispatcherListeners.add(l);
}
/**
/**
* Removes a dispatcher lifecycle listener
*
*
* @param l The listener
*/
public static synchronized void removeDispatcherListener(DispatcherListener l) {
@@ -136,14 +136,14 @@ public class Dispatcher {
/**
* The constructor with its servlet context instance (optional)
*
*
* @param servletContext The servlet context
*/
public Dispatcher(ServletContext servletContext) {
init(servletContext);
}
/**
/**
* Cleans up thread local variables
*/
public void cleanup() {
@@ -172,7 +172,7 @@ public class Dispatcher {
/**
* Initializes the instance
*
*
* @param servletContext The servlet context
*/
private void init(ServletContext servletContext) {
@@ -242,7 +242,7 @@ public class Dispatcher {
}
// test wether param-access workaround needs to be enabled
if (servletContext != null && servletContext.getServerInfo() != null
if (servletContext != null && servletContext.getServerInfo() != null
&& servletContext.getServerInfo().indexOf("WebLogic") >= 0) {
LOG.info("WebLogic server detected. Enabling Struts parameter access work-around.");
paramsWorkaroundEnabled = true;
@@ -253,7 +253,6 @@ public class Dispatcher {
}
configurationManager = new ConfigurationManager();
String configFiles = "struts-default.xml,struts-plugin.xml,struts.xml";
if (Settings.isSet(StrutsConstants.STRUTS_CONFIGURATION_FILES)) {
configFiles = Settings.get(StrutsConstants.STRUTS_CONFIGURATION_FILES);
}
@@ -265,7 +264,7 @@ public class Dispatcher {
configurationManager.addConfigurationProvider(new StrutsXmlConfigurationProvider(file, false));
}
}
synchronized(Dispatcher.class) {
if (dispatcherListeners.size() > 0) {
for (DispatcherListener l : dispatcherListeners) {
@@ -345,14 +344,14 @@ public class Dispatcher {
/**
* Creates a context map containing all the wrapped request objects
*
*
* @param request The servlet request
* @param response The servlet response
* @param mapping The action mapping
* @param context The servlet context
* @return A map of context objects
*/
public Map<String,Object> createContextMap(HttpServletRequest request, HttpServletResponse response,
public Map<String,Object> createContextMap(HttpServletRequest request, HttpServletResponse response,
ActionMapping mapping, ServletContext context) {
// request map wrapping the http request objects
Map requestMap = new RequestMap(request);
@@ -493,7 +492,7 @@ public class Dispatcher {
/**
* Prepares a request, including setting the encoding and locale
*
*
* @param request The request
* @param response The response
*/
@@ -558,22 +557,22 @@ public class Dispatcher {
* @param code the HttpServletResponse error code (see {@link javax.servlet.http.HttpServletResponse} for possible error codes).
* @param e the Exception that is reported.
*/
public void sendError(HttpServletRequest request, HttpServletResponse response,
public void sendError(HttpServletRequest request, HttpServletResponse response,
ServletContext ctx, int code, Exception e) {
if (devMode) {
response.setContentType("text/html");
try {
freemarker.template.Configuration config = FreemarkerManager.getInstance().getConfiguration(ctx);
Template template = config.getTemplate("/org/apache/struts2/dispatcher/error.ftl");
List<Throwable> chain = new ArrayList<Throwable>();
Throwable cur = e;
chain.add(cur);
while ((cur = cur.getCause()) != null) {
chain.add(cur);
}
HashMap<String,Object> data = new HashMap<String,Object>();
data.put("exception", e);
data.put("unknown", Location.UNKNOWN);
@@ -593,10 +592,10 @@ public class Dispatcher {
// send a http error response to use the servlet defined error handler
// make the exception availible to the web.xml defined error page
request.setAttribute("javax.servlet.error.exception", e);
// for compatibility
request.setAttribute("javax.servlet.jsp.jspException", e);
// send the error response
response.sendError(code, e.getMessage());
} catch (IOException e1) {
@@ -628,14 +627,14 @@ public class Dispatcher {
Location loc = LocationUtils.getLocation(obj);
if (loc == null) {
return Location.UNKNOWN;
}
}
return loc;
}
}
/**
* Gets the current configuration manager instance
*
*
* @return The instance
*/
public ConfigurationManager getConfigurationManager() {
@@ -644,7 +643,7 @@ public class Dispatcher {
/**
* Sets the current configuration manager instance
*
*
* @param mgr The configuration manager
*/
public void setConfigurationManager(ConfigurationManager mgr) {
@@ -664,5 +663,5 @@ public class Dispatcher {
public void setDevMode(boolean devMode) {
this.devMode = devMode;
}
}
@@ -71,9 +71,11 @@ struts.serve.static=true
### headers)
struts.serve.static.browserCache=true
### Set this to false if you wish to disable all forms of dynamic method invocation
### Set this to false if you wish to disable implicit dynamic method invocation
### via the URL request. This includes URLs like foo!bar.action, as well as params
### like method:bar (but not action:foo). See the DefaultActionMapper for more info.
### like method:bar (but not action:foo).
### An alternative to implicit dynamic method invocation is to use wildcard
### mappings, such as <action name="*/*" method="{2}" class="actions.{1}">
struts.enable.DynamicMethodInvocation = true
### use alternative syntax that requires %{} in most places
@@ -138,4 +140,7 @@ struts.freemarker.wrapper.altMap=true
### Set to true for developers and false for production.
struts.xslt.nocache=false
### A list of configuration files automatically loaded by Struts
struts.configuration.files=struts-default.xml,struts-plugin.xml,struts.xml
### END SNIPPET: complete_file