This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5049-velocity-plugin in repository https://gitbox.apache.org/repos/asf/struts.git
commit 84f84380266f461eecc3c6e8f3febf65c055695b Author: Lukasz Lenart <lukaszlen...@apache.org> AuthorDate: Tue Nov 26 20:36:21 2019 +0100 WW-5049 Renames default bean provider --- ...vider.java => StrutsBeanSelectionProvider.java} | 2 +- .../org/apache/struts2/dispatcher/Dispatcher.java | 4 +- .../struts2/dispatcher/StaticContentLoader.java | 120 +++++++++++---------- core/src/main/resources/struts-default.xml | 4 +- ...t.java => StrutsBeanSelectionProviderTest.java} | 2 +- .../velocity/VelocityBeanSelectionProvider.java | 3 +- 6 files changed, 69 insertions(+), 66 deletions(-) diff --git a/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java b/core/src/main/java/org/apache/struts2/config/StrutsBeanSelectionProvider.java similarity index 99% rename from core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java rename to core/src/main/java/org/apache/struts2/config/StrutsBeanSelectionProvider.java index 1e976f0..2551f77 100644 --- a/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java +++ b/core/src/main/java/org/apache/struts2/config/StrutsBeanSelectionProvider.java @@ -364,7 +364,7 @@ import org.apache.struts2.views.util.UrlHelper; * <li><code>struts.configuration.xml.reload = true</code></li> * </ul> */ -public class DefaultBeanSelectionProvider extends AbstractBeanSelectionProvider { +public class StrutsBeanSelectionProvider extends AbstractBeanSelectionProvider { public void register(ContainerBuilder builder, LocatableProperties props) { alias(ObjectFactory.class, StrutsConstants.STRUTS_OBJECTFACTORY, builder, props); diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java index 575de94..27d025b 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java @@ -44,7 +44,7 @@ import org.apache.struts2.ServletActionContext; import org.apache.struts2.StrutsConstants; import org.apache.struts2.StrutsException; import org.apache.struts2.StrutsStatics; -import org.apache.struts2.config.DefaultBeanSelectionProvider; +import org.apache.struts2.config.StrutsBeanSelectionProvider; import org.apache.struts2.config.DefaultPropertiesProvider; import org.apache.struts2.config.PropertiesConfigurationProvider; import org.apache.struts2.config.StrutsJavaConfiguration; @@ -481,7 +481,7 @@ public class Dispatcher { } private void init_AliasStandardObjects() { - configurationManager.addContainerProvider(new DefaultBeanSelectionProvider()); + configurationManager.addContainerProvider(new StrutsBeanSelectionProvider()); } private Container init_PreloadConfiguration() { diff --git a/core/src/main/java/org/apache/struts2/dispatcher/StaticContentLoader.java b/core/src/main/java/org/apache/struts2/dispatcher/StaticContentLoader.java index cf4dd47..7859702 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/StaticContentLoader.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/StaticContentLoader.java @@ -1,59 +1,61 @@ -/* - * 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; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * Interface for loading static resources, based on a path. After implementing your own static content loader - * you must tell the framework how to use it, eg. - * - * <bean name="myContentLoader" type="org.apache.struts2.dispatcher" class="com.company.struts.MyContentLoader"/> - * <constant name="struts.staticContentLoader" value="myContentLoader"/> - * - * Check {@link org.apache.struts2.config.DefaultBeanSelectionProvider} for more details. - */ -public interface StaticContentLoader { - - /** - * @param path Requested resource path - * @return true if this loader is able to load this type of resource, false otherwise - */ - public boolean canHandle(String path); - - /** - * @param filterConfig The filter configuration - */ - public abstract void setHostConfig(HostConfig filterConfig); - - /** - * Locate a static resource and copy directly to the response, setting the - * appropriate caching headers. - * - * @param path The resource name - * @param request The request - * @param response The response - * @throws IOException If anything goes wrong - */ - public abstract void findStaticResource(String path, HttpServletRequest request, HttpServletResponse response) - throws IOException; - -} +/* + * 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; + +import org.apache.struts2.config.StrutsBeanSelectionProvider; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Interface for loading static resources, based on a path. After implementing your own static content loader + * you must tell the framework how to use it, eg. + * + * <bean name="myContentLoader" type="org.apache.struts2.dispatcher" class="com.company.struts.MyContentLoader"/> + * <constant name="struts.staticContentLoader" value="myContentLoader"/> + * + * Check {@link StrutsBeanSelectionProvider} for more details. + */ +public interface StaticContentLoader { + + /** + * @param path Requested resource path + * @return true if this loader is able to load this type of resource, false otherwise + */ + public boolean canHandle(String path); + + /** + * @param filterConfig The filter configuration + */ + public abstract void setHostConfig(HostConfig filterConfig); + + /** + * Locate a static resource and copy directly to the response, setting the + * appropriate caching headers. + * + * @param path The resource name + * @param request The request + * @param response The response + * @throws IOException If anything goes wrong + */ + public abstract void findStaticResource(String path, HttpServletRequest request, HttpServletResponse response) + throws IOException; + +} diff --git a/core/src/main/resources/struts-default.xml b/core/src/main/resources/struts-default.xml index 6ab501d..9da9daf 100644 --- a/core/src/main/resources/struts-default.xml +++ b/core/src/main/resources/struts-default.xml @@ -23,8 +23,8 @@ <!-- When declaring beans in this file you must either use name="struts" or don't name the bean at all. - The name="struts" must be used when alias was defined in {@link org.apache.struts2.config.DefaultBeanSelectionProvider} - - it is then the default bean's name and {@link org.apache.struts2.config.DefaultBeanSelectionProvider} links name "struts" + The name="struts" must be used when alias was defined in {@link org.apache.struts2.config.StrutsBeanSelectionProvider} - + it is then the default bean's name and {@link org.apache.struts2.config.StrutsBeanSelectionProvider} links name "struts" with "default" (aliasing it) If name won't be defined then the "default" value will be used {@link com.opensymphony.xwork2.inject.Container#DEFAULT_NAME} diff --git a/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java b/core/src/test/java/org/apache/struts2/config/StrutsBeanSelectionProviderTest.java similarity index 97% rename from core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java rename to core/src/test/java/org/apache/struts2/config/StrutsBeanSelectionProviderTest.java index 42e07bb..30cc175 100644 --- a/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java +++ b/core/src/test/java/org/apache/struts2/config/StrutsBeanSelectionProviderTest.java @@ -29,7 +29,7 @@ import org.apache.struts2.StrutsConstants; import com.opensymphony.xwork2.inject.ContainerBuilder; import com.opensymphony.xwork2.util.location.LocatableProperties; -public class DefaultBeanSelectionProviderTest extends XWorkTestCase { +public class StrutsBeanSelectionProviderTest extends XWorkTestCase { public void testRegister() { LocalizedTextProvider localizedTextProvider = container.getInstance(LocalizedTextProvider.class); diff --git a/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/VelocityBeanSelectionProvider.java b/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/VelocityBeanSelectionProvider.java index 5690813..f53ec66 100644 --- a/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/VelocityBeanSelectionProvider.java +++ b/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/VelocityBeanSelectionProvider.java @@ -22,9 +22,10 @@ import com.opensymphony.xwork2.config.ConfigurationException; import com.opensymphony.xwork2.inject.ContainerBuilder; import com.opensymphony.xwork2.util.location.LocatableProperties; import org.apache.struts2.config.AbstractBeanSelectionProvider; +import org.apache.struts2.config.StrutsBeanSelectionProvider; /** - * Please see {@link org.apache.struts2.config.DefaultBeanSelectionProvider} for more details. + * Please see {@link StrutsBeanSelectionProvider} for more details. * * <p> * The following is a list of the allowed extension points: