mirror of
https://github.com/apache/struts.git
synced 2026-08-07 07:37:20 +00:00
WW-4518 Moves the new filters to proper package
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<filter>
|
||||
<filter-name>action2</filter-name>
|
||||
<filter-class>
|
||||
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
|
||||
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
|
||||
</filter-class>
|
||||
</filter>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<filter>
|
||||
<filter-name>action2</filter-name>
|
||||
<filter-class>
|
||||
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
|
||||
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
|
||||
</filter-class>
|
||||
</filter>
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<filter>
|
||||
<filter-name>action2</filter-name>
|
||||
<filter-class>
|
||||
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
|
||||
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
|
||||
</filter-class>
|
||||
</filter>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<!-- START SNIPPET: filter -->
|
||||
<filter>
|
||||
<filter-name>action2</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
|
||||
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
|
||||
</filter>
|
||||
<!-- END SNIPPET: filter -->
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
<filter>
|
||||
<filter-name>struts-prepare</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
|
||||
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<filter-name>struts-execute</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
|
||||
<filter-class>org.apache.struts2.dispatcher.filter.StrutsExecuteFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
</listener>
|
||||
|
||||
<listener>
|
||||
<listener-class>org.apache.struts2.dispatcher.ng.listener.StrutsListener</listener-class>
|
||||
<listener-class>org.apache.struts2.dispatcher.listener.StrutsListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<!-- SNIPPET START: dwr -->
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
|
||||
<filter>
|
||||
<filter-name>struts2</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
|
||||
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
<filter>
|
||||
<filter-name>struts2</filter-name>
|
||||
<filter-class>
|
||||
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
|
||||
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
|
||||
</filter-class>
|
||||
</filter>
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
|
||||
<filter>
|
||||
<filter-name>struts2</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
|
||||
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
<filter id="filterdispatcher">
|
||||
<filter-name>struts</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
|
||||
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<filter>
|
||||
<filter-name>struts2</filter-name>
|
||||
<filter-class>
|
||||
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
|
||||
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
|
||||
</filter-class>
|
||||
</filter>
|
||||
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
<!-- Filters -->
|
||||
<filter>
|
||||
<filter-name>struts2-prepare</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
|
||||
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareFilter</filter-class>
|
||||
</filter>
|
||||
<filter>
|
||||
<filter-name>sitemesh</filter-name>
|
||||
@@ -23,7 +23,7 @@
|
||||
</filter>
|
||||
<filter>
|
||||
<filter-name>struts2-execute</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
|
||||
<filter-class>org.apache.struts2.dispatcher.filter.StrutsExecuteFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
|
||||
@@ -9,8 +9,6 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.dispatcher.ng.ExecuteOperations;
|
||||
import org.apache.struts2.dispatcher.ng.PrepareOperations;
|
||||
import org.apache.struts2.views.freemarker.FreemarkerManager;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.dispatcher.ng.HostConfig;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -72,7 +72,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
* of the primary dispatcher holds an instance of this dispatcher to be shared for
|
||||
* all requests.
|
||||
*
|
||||
* @see org.apache.struts2.dispatcher.ng.InitOperations
|
||||
* @see InitOperations
|
||||
*/
|
||||
public class Dispatcher {
|
||||
|
||||
|
||||
+1
-4
@@ -18,14 +18,11 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.dispatcher.ng;
|
||||
package org.apache.struts2.dispatcher;
|
||||
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.dispatcher.StaticContentLoader;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapping;
|
||||
import org.apache.struts2.RequestUtils;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.dispatcher.ng;
|
||||
package org.apache.struts2.dispatcher;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import java.util.Iterator;
|
||||
+1
-3
@@ -18,14 +18,12 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.dispatcher.ng;
|
||||
package org.apache.struts2.dispatcher;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.util.ClassLoaderUtil;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.dispatcher.StaticContentLoader;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
+1
-3
@@ -18,7 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.dispatcher.ng;
|
||||
package org.apache.struts2.dispatcher;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
@@ -27,11 +27,9 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.struts2.RequestUtils;
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapper;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapping;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -20,8 +20,6 @@
|
||||
*/
|
||||
package org.apache.struts2.dispatcher;
|
||||
|
||||
import org.apache.struts2.dispatcher.ng.HostConfig;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
@@ -60,4 +58,4 @@ public interface StaticContentLoader {
|
||||
public abstract void findStaticResource(String path, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.dispatcher.ng.filter;
|
||||
package org.apache.struts2.dispatcher.filter;
|
||||
|
||||
import org.apache.struts2.util.MakeIterator;
|
||||
|
||||
@@ -26,7 +26,7 @@ import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletContext;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.struts2.dispatcher.ng.HostConfig;
|
||||
import org.apache.struts2.dispatcher.HostConfig;
|
||||
|
||||
/**
|
||||
* Host configuration that wraps FilterConfig
|
||||
+4
-4
@@ -18,14 +18,14 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.dispatcher.ng.filter;
|
||||
package org.apache.struts2.dispatcher.filter;
|
||||
|
||||
import org.apache.struts2.StrutsStatics;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapping;
|
||||
import org.apache.struts2.dispatcher.ng.ExecuteOperations;
|
||||
import org.apache.struts2.dispatcher.ng.InitOperations;
|
||||
import org.apache.struts2.dispatcher.ng.PrepareOperations;
|
||||
import org.apache.struts2.dispatcher.ExecuteOperations;
|
||||
import org.apache.struts2.dispatcher.InitOperations;
|
||||
import org.apache.struts2.dispatcher.PrepareOperations;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
+4
-4
@@ -18,14 +18,14 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.dispatcher.ng.filter;
|
||||
package org.apache.struts2.dispatcher.filter;
|
||||
|
||||
import org.apache.struts2.StrutsStatics;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapping;
|
||||
import org.apache.struts2.dispatcher.ng.ExecuteOperations;
|
||||
import org.apache.struts2.dispatcher.ng.InitOperations;
|
||||
import org.apache.struts2.dispatcher.ng.PrepareOperations;
|
||||
import org.apache.struts2.dispatcher.ExecuteOperations;
|
||||
import org.apache.struts2.dispatcher.InitOperations;
|
||||
import org.apache.struts2.dispatcher.PrepareOperations;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
+4
-4
@@ -18,12 +18,12 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.dispatcher.ng.filter;
|
||||
package org.apache.struts2.dispatcher.filter;
|
||||
|
||||
import org.apache.struts2.StrutsStatics;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.dispatcher.ng.InitOperations;
|
||||
import org.apache.struts2.dispatcher.ng.PrepareOperations;
|
||||
import org.apache.struts2.dispatcher.InitOperations;
|
||||
import org.apache.struts2.dispatcher.PrepareOperations;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
@@ -38,7 +38,7 @@ import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Prepares the request for execution by a later {@link org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter} filter instance.
|
||||
* Prepares the request for execution by a later {@link org.apache.struts2.dispatcher.filter.StrutsExecuteFilter} filter instance.
|
||||
*/
|
||||
public class StrutsPrepareFilter implements StrutsStatics, Filter {
|
||||
|
||||
+50
-50
@@ -1,50 +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;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* $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.listener;
|
||||
|
||||
import org.apache.struts2.dispatcher.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;
|
||||
}
|
||||
}
|
||||
+62
-62
@@ -1,62 +1,62 @@
|
||||
/*
|
||||
* $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.StrutsStatics;
|
||||
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 might be useful if Struts config information is needed from other servlet listeners, like
|
||||
* Sitemesh or OSGi
|
||||
*/
|
||||
public class StrutsListener implements ServletContextListener {
|
||||
private PrepareOperations prepare;
|
||||
|
||||
public void contextInitialized(ServletContextEvent sce) {
|
||||
InitOperations init = new InitOperations();
|
||||
Dispatcher dispatcher = null;
|
||||
try {
|
||||
ListenerHostConfig config = new ListenerHostConfig(sce.getServletContext());
|
||||
init.initLogging(config);
|
||||
dispatcher = init.initDispatcher(config);
|
||||
init.initStaticContentLoader(config, dispatcher);
|
||||
|
||||
prepare = new PrepareOperations(dispatcher);
|
||||
sce.getServletContext().setAttribute(StrutsStatics.SERVLET_DISPATCHER, dispatcher);
|
||||
} finally {
|
||||
if (dispatcher != null) {
|
||||
dispatcher.cleanUpAfterInit();
|
||||
}
|
||||
init.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
public void contextDestroyed(ServletContextEvent sce) {
|
||||
prepare.cleanupDispatcher();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* $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.listener;
|
||||
|
||||
import org.apache.struts2.StrutsStatics;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.dispatcher.InitOperations;
|
||||
import org.apache.struts2.dispatcher.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.filter.StrutsPrepareAndExecuteFilter} and its variants.
|
||||
* This might be useful if Struts config information is needed from other servlet listeners, like
|
||||
* Sitemesh or OSGi
|
||||
*/
|
||||
public class StrutsListener implements ServletContextListener {
|
||||
private PrepareOperations prepare;
|
||||
|
||||
public void contextInitialized(ServletContextEvent sce) {
|
||||
InitOperations init = new InitOperations();
|
||||
Dispatcher dispatcher = null;
|
||||
try {
|
||||
ListenerHostConfig config = new ListenerHostConfig(sce.getServletContext());
|
||||
init.initLogging(config);
|
||||
dispatcher = init.initDispatcher(config);
|
||||
init.initStaticContentLoader(config, dispatcher);
|
||||
|
||||
prepare = new PrepareOperations(dispatcher);
|
||||
sce.getServletContext().setAttribute(StrutsStatics.SERVLET_DISPATCHER, dispatcher);
|
||||
} finally {
|
||||
if (dispatcher != null) {
|
||||
dispatcher.cleanUpAfterInit();
|
||||
}
|
||||
init.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
public void contextDestroyed(ServletContextEvent sce) {
|
||||
prepare.cleanupDispatcher();
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -28,7 +28,7 @@
|
||||
* <pre>
|
||||
* <filter>
|
||||
* <filter-name>struts2</filter-name>
|
||||
* <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
|
||||
* <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
|
||||
* </filter>
|
||||
*
|
||||
* <filter-mapping>
|
||||
@@ -41,7 +41,7 @@
|
||||
* <pre>
|
||||
* <filter>
|
||||
* <filter-name>struts2-prepare</filter-name>
|
||||
* <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
|
||||
* <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareFilter</filter-class>
|
||||
* </filter>
|
||||
* <filter>
|
||||
* <filter-name>sitemesh</filter-name>
|
||||
@@ -49,7 +49,7 @@
|
||||
* </filter>
|
||||
* <filter>
|
||||
* <filter-name>struts2-execute</filter-name>
|
||||
* <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
|
||||
* <filter-class>org.apache.struts2.dispatcher.filter.StrutsExecuteFilter</filter-class>
|
||||
* </filter>
|
||||
*
|
||||
* <filter-mapping>
|
||||
@@ -67,4 +67,4 @@
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
package org.apache.struts2.dispatcher.ng;
|
||||
package org.apache.struts2.dispatcher;
|
||||
@@ -1,23 +0,0 @@
|
||||
<!--
|
||||
/*
|
||||
* $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.
|
||||
*/
|
||||
-->
|
||||
<body>Classes for action dispatching in Struts (the Controller part of MVC).</body>
|
||||
+2
-2
@@ -18,7 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.dispatcher.ng.servlet;
|
||||
package org.apache.struts2.dispatcher.servlet;
|
||||
|
||||
import org.apache.struts2.util.MakeIterator;
|
||||
|
||||
@@ -26,7 +26,7 @@ import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletContext;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.struts2.dispatcher.ng.HostConfig;
|
||||
import org.apache.struts2.dispatcher.HostConfig;
|
||||
|
||||
/**
|
||||
* Host configuration that wraps a ServletConfig
|
||||
+6
-5
@@ -18,13 +18,14 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.dispatcher.ng.servlet;
|
||||
package org.apache.struts2.dispatcher.servlet;
|
||||
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapping;
|
||||
import org.apache.struts2.dispatcher.ng.ExecuteOperations;
|
||||
import org.apache.struts2.dispatcher.ng.InitOperations;
|
||||
import org.apache.struts2.dispatcher.ng.PrepareOperations;
|
||||
import org.apache.struts2.dispatcher.ExecuteOperations;
|
||||
import org.apache.struts2.dispatcher.InitOperations;
|
||||
import org.apache.struts2.dispatcher.PrepareOperations;
|
||||
import org.apache.struts2.dispatcher.servlet.ServletHostConfig;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
@@ -35,7 +36,7 @@ import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Servlet dispatcher 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
|
||||
* {@link org.apache.struts2.dispatcher.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.
|
||||
*/
|
||||
+1
-1
@@ -32,7 +32,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.dispatcher.ng.PrepareOperations;
|
||||
import org.apache.struts2.dispatcher.PrepareOperations;
|
||||
import org.apache.struts2.views.freemarker.FreemarkerManager;
|
||||
import org.apache.struts2.views.freemarker.FreemarkerResult;
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.struts2.dispatcher.ng.HostConfig;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
import org.springframework.mock.web.MockServletContext;
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ package org.apache.struts2.dispatcher.ng;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter;
|
||||
import org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter;
|
||||
import org.springframework.mock.web.MockFilterChain;
|
||||
import org.springframework.mock.web.MockFilterConfig;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
|
||||
@@ -23,8 +23,9 @@ package org.apache.struts2.dispatcher.ng;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter;
|
||||
import org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter;
|
||||
import org.apache.struts2.dispatcher.PrepareOperations;
|
||||
import org.apache.struts2.dispatcher.filter.StrutsExecuteFilter;
|
||||
import org.apache.struts2.dispatcher.filter.StrutsPrepareFilter;
|
||||
import org.springframework.mock.web.*;
|
||||
|
||||
import javax.servlet.*;
|
||||
@@ -145,4 +146,4 @@ public class TwoFilterIntegrationTest extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.dispatcher.ng.PrepareOperations;
|
||||
import org.apache.struts2.dispatcher.PrepareOperations;
|
||||
import org.apache.struts2.json.annotations.SMDMethod;
|
||||
import org.apache.struts2.json.rpc.RPCError;
|
||||
import org.apache.struts2.json.rpc.RPCErrorCode;
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsStatics;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.dispatcher.StrutsRequestWrapper;
|
||||
import org.apache.struts2.dispatcher.ng.listener.StrutsListener;
|
||||
import org.apache.struts2.dispatcher.listener.StrutsListener;
|
||||
import org.apache.struts2.views.freemarker.FreemarkerManager;
|
||||
import org.apache.struts2.views.freemarker.ScopesHashModel;
|
||||
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import com.opensymphony.xwork2.ActionContext;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsStatics;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.dispatcher.ng.listener.StrutsListener;
|
||||
import org.apache.struts2.dispatcher.listener.StrutsListener;
|
||||
import org.apache.struts2.views.velocity.VelocityManager;
|
||||
import org.apache.velocity.Template;
|
||||
import org.apache.velocity.context.Context;
|
||||
|
||||
Reference in New Issue
Block a user