Author: musachy
Date: Tue Apr 7 17:56:30 2009
New Revision: 762875
URL: http://svn.apache.org/viewvc?rev=762875&view=rev
Log:
WW-3076 Add an "order" attribute to the "struts" configuration element
Added:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/ListenerHostConfig.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/StrutsListener.java
struts/struts2/trunk/core/src/main/resources/struts-2.1.7.dtd
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
struts/struts2/trunk/core/src/main/resources/struts-default.xml
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java?rev=762875&r1=762874&r2=762875&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
Tue Apr 7 17:56:30 2009
@@ -78,6 +78,7 @@
Map<String,String> dtdMappings = new
HashMap<String,String>(getDtdMappings());
dtdMappings.put("-//Apache Software Foundation//DTD Struts
Configuration 2.0//EN", "struts-2.0.dtd");
dtdMappings.put("-//Apache Software Foundation//DTD Struts
Configuration 2.1//EN", "struts-2.1.dtd");
+ dtdMappings.put("-//Apache Software Foundation//DTD Struts
Configuration 2.1.7//EN", "struts-2.1.7.dtd");
setDtdMappings(dtdMappings);
File file = new File(filename);
if (file.getParent() != null) {
Added:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/ListenerHostConfig.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/ListenerHostConfig.java?rev=762875&view=auto
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/ListenerHostConfig.java
(added)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/ListenerHostConfig.java
Tue Apr 7 17:56:30 2009
@@ -0,0 +1,50 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.dispatcher.ng.listener;
+
+import org.apache.struts2.dispatcher.ng.HostConfig;
+
+import javax.servlet.ServletContext;
+import java.util.Iterator;
+import java.util.Collections;
+
+/**
+ * Host configuration that just holds a ServletContext
+ */
+public class ListenerHostConfig implements HostConfig {
+ private ServletContext servletContext;
+
+ public ListenerHostConfig(ServletContext servletContext) {
+ this.servletContext = servletContext;
+ }
+
+ public String getInitParameter(String key) {
+ return null;
+ }
+
+ public Iterator<String> getInitParameterNames() {
+ return Collections.<String>emptyList().iterator();
+ }
+
+ public ServletContext getServletContext() {
+ return servletContext;
+ }
+}
Added:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/StrutsListener.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/StrutsListener.java?rev=762875&view=auto
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/StrutsListener.java
(added)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/StrutsListener.java
Tue Apr 7 17:56:30 2009
@@ -0,0 +1,58 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.dispatcher.ng.listener;
+
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.dispatcher.Dispatcher;
+import org.apache.struts2.dispatcher.ng.InitOperations;
+import org.apache.struts2.dispatcher.ng.PrepareOperations;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+/**
+ * Servlet listener for Struts. The preferred way to use Struts is as a
filter via the
+ * {...@link
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter} and its
variants. This servlet dispatcher
+ * is only for those that really know what they are doing as it may not
support every feature of Struts, particularly
+ * static resource serving.
+ */
+public class StrutsListener implements ServletContextListener {
+ private PrepareOperations prepare;
+
+ public void contextInitialized(ServletContextEvent sce) {
+ InitOperations init = new InitOperations();
+ try {
+ ListenerHostConfig config = new
ListenerHostConfig(sce.getServletContext());
+ init.initLogging(config);
+ Dispatcher dispatcher = init.initDispatcher(config);
+ ServletActionContext.setServletContext(sce.getServletContext());
+ init.initStaticContentLoader(config, dispatcher);
+
+ prepare = new PrepareOperations(config.getServletContext(),
dispatcher);
+ } finally {
+ init.cleanup();
+ }
+ }
+
+ public void contextDestroyed(ServletContextEvent sce) {
+ prepare.cleanupDispatcher();
+ }
+}
Added: struts/struts2/trunk/core/src/main/resources/struts-2.1.7.dtd
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/struts-2.1.7.dtd?rev=762875&view=auto
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/struts-2.1.7.dtd (added)
+++ struts/struts2/trunk/core/src/main/resources/struts-2.1.7.dtd Tue Apr 7
17:56:30 2009
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * $Id: struts-2.0.dtd 651946 2008-04-27 13:41:38Z apetrelli $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+-->
+<!-- START SNIPPET: strutsDtd -->
+
+<!--
+ Struts configuration DTD.
+ Use the following DOCTYPE
+
+ <!DOCTYPE struts PUBLIC
+ "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
+ "http://struts.apache.org/dtds/struts-2.1.7.dtd">
+-->
+
+<!ELEMENT struts ((package|include|bean|constant)*, unknown-handler-stack?)>
+<!ATTLIST struts
+ order CDATA #IMPLIED
+>
+
+<!ELEMENT package (result-types?, interceptors?, default-interceptor-ref?,
default-action-ref?, default-class-ref?, global-results?,
global-exception-mappings?, action*)>
+<!ATTLIST package
+ name CDATA #REQUIRED
+ extends CDATA #IMPLIED
+ namespace CDATA #IMPLIED
+ abstract CDATA #IMPLIED
+ externalReferenceResolver NMTOKEN #IMPLIED
+>
+
+<!ELEMENT result-types (result-type+)>
+
+<!ELEMENT result-type (param*)>
+<!ATTLIST result-type
+ name CDATA #REQUIRED
+ class CDATA #REQUIRED
+ default (true|false) "false"
+>
+
+<!ELEMENT interceptors (interceptor|interceptor-stack)+>
+
+<!ELEMENT interceptor (param*)>
+<!ATTLIST interceptor
+ name CDATA #REQUIRED
+ class CDATA #REQUIRED
+>
+
+<!ELEMENT interceptor-stack (interceptor-ref*)>
+<!ATTLIST interceptor-stack
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT interceptor-ref (param*)>
+<!ATTLIST interceptor-ref
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT default-interceptor-ref (#PCDATA)>
+<!ATTLIST default-interceptor-ref
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT default-action-ref (#PCDATA)>
+<!ATTLIST default-action-ref
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT default-class-ref (#PCDATA)>
+<!ATTLIST default-class-ref
+ class CDATA #REQUIRED
+>
+
+<!ELEMENT global-results (result+)>
+
+<!ELEMENT global-exception-mappings (exception-mapping+)>
+
+<!ELEMENT action (param|result|interceptor-ref|exception-mapping)*>
+<!ATTLIST action
+ name CDATA #REQUIRED
+ class CDATA #IMPLIED
+ method CDATA #IMPLIED
+ converter CDATA #IMPLIED
+>
+
+<!ELEMENT param (#PCDATA)>
+<!ATTLIST param
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT result (#PCDATA|param)*>
+<!ATTLIST result
+ name CDATA #IMPLIED
+ type CDATA #IMPLIED
+>
+
+<!ELEMENT exception-mapping (#PCDATA|param)*>
+<!ATTLIST exception-mapping
+ name CDATA #IMPLIED
+ exception CDATA #REQUIRED
+ result CDATA #REQUIRED
+>
+
+<!ELEMENT include (#PCDATA)>
+<!ATTLIST include
+ file CDATA #REQUIRED
+>
+
+<!ELEMENT bean (#PCDATA)>
+<!ATTLIST bean
+ type CDATA #IMPLIED
+ name CDATA #IMPLIED
+ class CDATA #REQUIRED
+ scope CDATA #IMPLIED
+ static CDATA #IMPLIED
+ optional CDATA #IMPLIED
+>
+
+<!ELEMENT constant (#PCDATA)>
+<!ATTLIST constant
+ name CDATA #REQUIRED
+ value CDATA #REQUIRED
+>
+
+<!ELEMENT unknown-handler-stack (unknown-handler-ref*)>
+<!ELEMENT unknown-handler-ref (#PCDATA)>
+<!ATTLIST unknown-handler-ref
+ name CDATA #REQUIRED
+>
+
+<!-- END SNIPPET: strutsDtd -->
+
Modified: struts/struts2/trunk/core/src/main/resources/struts-default.xml
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/struts-default.xml?rev=762875&r1=762874&r2=762875&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/struts-default.xml (original)
+++ struts/struts2/trunk/core/src/main/resources/struts-default.xml Tue Apr 7
17:56:30 2009
@@ -22,8 +22,8 @@
*/
-->
<!DOCTYPE struts PUBLIC
- "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
- "http://struts.apache.org/dtds/struts-2.1.dtd">
+ "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
+ "http://struts.apache.org/dtds/struts-2.1.7.dtd">
<struts>
<bean class="com.opensymphony.xwork2.ObjectFactory" name="xwork" />
Modified:
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java?rev=762875&r1=762874&r2=762875&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java
(original)
+++
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java
Tue Apr 7 17:56:30 2009
@@ -202,7 +202,7 @@
stack.push(foo);
MockJspWriter jspWriter = new MockJspWriter();
- jspWriter.setExpectedData("Foo is: \\t\\b\\n\\f\\r\\\"\\\'/\\\\");
+ jspWriter.setExpectedData("Foo is: \\t\\b\\n\\f\\r\\\"\\\'\\/\\\\");
MockPageContext pageContext = new MockPageContext();
pageContext.setJspWriter(jspWriter);