You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2018/10/20 10:49:38 UTC
[myfaces] branch master updated: duplicate code
This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/master by this push:
new f53c35d duplicate code
f53c35d is described below
commit f53c35daec680f0b624802a569b42f1c84e3aec1
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Sat Oct 20 12:49:33 2018 +0200
duplicate code
---
.../apache/myfaces/config/FacesConfigurator.java | 4 +-
.../myfaces/ee/MyFacesContainerInitializer.java | 2 +-
.../apache/myfaces/lifecycle/LifecycleImpl.java | 2 +-
.../util/serial/DefaultSerialFactory.java | 46 ---
.../shared_impl/util/serial/SerialFactory.java | 35 --
.../webapp/webxml/DelegatedFacesServlet.java | 23 --
.../shared_impl/webapp/webxml/FilterMapping.java | 67 ----
.../shared_impl/webapp/webxml/ServletMapping.java | 87 -----
.../myfaces/shared_impl/webapp/webxml/WebXml.java | 295 ---------------
.../shared_impl/webapp/webxml/WebXmlParser.java | 409 ---------------------
.../myfaces/spi/impl/DefaultWebConfigProvider.java | 5 +-
.../myfaces/spi/impl/ServletMappingImpl.java | 5 +-
.../org/apache/myfaces/webapp/MyFacesServlet.java | 3 +-
.../myfaces/application/StateManagerImplTest.java | 2 +-
.../myfaces/renderkit/ErrorPageWriterTest.java | 2 +-
.../facelets/StateManagerWithFaceletsTest.java | 2 +-
.../compiler/UniqueComponentIdTestCase.java | 2 +-
17 files changed, 13 insertions(+), 978 deletions(-)
diff --git a/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java b/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
index 182d9e8..59257f6 100755
--- a/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
+++ b/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
@@ -124,8 +124,6 @@ import org.apache.myfaces.shared.util.LocaleUtils;
import org.apache.myfaces.shared.util.StateUtils;
import org.apache.myfaces.shared.util.StringUtils;
import org.apache.myfaces.shared.util.WebConfigParamUtils;
-import org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory;
-import org.apache.myfaces.shared_impl.util.serial.SerialFactory;
import org.apache.myfaces.cdi.util.BeanEntry;
import org.apache.myfaces.component.search.SearchExpressionContextFactoryImpl;
import org.apache.myfaces.config.element.FaceletsTemplateMapping;
@@ -133,6 +131,8 @@ import org.apache.myfaces.config.element.ViewPoolMapping;
import org.apache.myfaces.config.element.facelets.FaceletTagLibrary;
import org.apache.myfaces.lifecycle.LifecycleImpl;
import org.apache.myfaces.renderkit.LazyRenderKit;
+import org.apache.myfaces.shared.util.serial.DefaultSerialFactory;
+import org.apache.myfaces.shared.util.serial.SerialFactory;
import org.apache.myfaces.spi.FacesConfigurationMerger;
import org.apache.myfaces.spi.FacesConfigurationMergerFactory;
import org.apache.myfaces.spi.InjectionProvider;
diff --git a/impl/src/main/java/org/apache/myfaces/ee/MyFacesContainerInitializer.java b/impl/src/main/java/org/apache/myfaces/ee/MyFacesContainerInitializer.java
index 7226f02..ac4213e 100644
--- a/impl/src/main/java/org/apache/myfaces/ee/MyFacesContainerInitializer.java
+++ b/impl/src/main/java/org/apache/myfaces/ee/MyFacesContainerInitializer.java
@@ -54,7 +54,7 @@ import javax.servlet.annotation.HandlesTypes;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
import org.apache.myfaces.context.servlet.StartupServletExternalContextImpl;
-import org.apache.myfaces.shared_impl.webapp.webxml.DelegatedFacesServlet;
+import org.apache.myfaces.shared.webapp.webxml.DelegatedFacesServlet;
import org.apache.myfaces.spi.FacesConfigResourceProvider;
import org.apache.myfaces.spi.FacesConfigResourceProviderFactory;
diff --git a/impl/src/main/java/org/apache/myfaces/lifecycle/LifecycleImpl.java b/impl/src/main/java/org/apache/myfaces/lifecycle/LifecycleImpl.java
index 6e09931..9ce1c70 100755
--- a/impl/src/main/java/org/apache/myfaces/lifecycle/LifecycleImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/lifecycle/LifecycleImpl.java
@@ -37,7 +37,7 @@ import javax.faces.lifecycle.ClientWindowFactory;
import javax.faces.lifecycle.Lifecycle;
import org.apache.myfaces.config.FacesConfigurator;
-import org.apache.myfaces.shared_impl.webapp.webxml.WebXml;
+import org.apache.myfaces.shared.webapp.webxml.WebXml;
import org.apache.myfaces.util.DebugUtils;
/**
diff --git a/impl/src/main/java/org/apache/myfaces/shared_impl/util/serial/DefaultSerialFactory.java b/impl/src/main/java/org/apache/myfaces/shared_impl/util/serial/DefaultSerialFactory.java
deleted file mode 100644
index 774369c..0000000
--- a/impl/src/main/java/org/apache/myfaces/shared_impl/util/serial/DefaultSerialFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.myfaces.shared_impl.util.serial;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-
-import org.apache.myfaces.shared.util.MyFacesObjectInputStream;
-
-/**
- * @author Dennis C. Byrne
- */
-
-public class DefaultSerialFactory implements SerialFactory
-{
-
- public ObjectOutputStream getObjectOutputStream(OutputStream outputStream) throws IOException
- {
- return new ObjectOutputStream(outputStream);
- }
-
- public ObjectInputStream getObjectInputStream(InputStream inputStream) throws IOException
- {
- return new MyFacesObjectInputStream(inputStream);
- }
-
-}
diff --git a/impl/src/main/java/org/apache/myfaces/shared_impl/util/serial/SerialFactory.java b/impl/src/main/java/org/apache/myfaces/shared_impl/util/serial/SerialFactory.java
deleted file mode 100644
index 31ae1e1..0000000
--- a/impl/src/main/java/org/apache/myfaces/shared_impl/util/serial/SerialFactory.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.myfaces.shared_impl.util.serial;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-
-/**
- * @author Dennis C. Byrne
- */
-
-public interface SerialFactory extends org.apache.myfaces.shared.util.serial.SerialFactory
-{
- ObjectOutputStream getObjectOutputStream(OutputStream outputStream) throws IOException;
- ObjectInputStream getObjectInputStream(InputStream inputStream) throws IOException;
-}
diff --git a/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/DelegatedFacesServlet.java b/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/DelegatedFacesServlet.java
deleted file mode 100644
index c2c80eb..0000000
--- a/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/DelegatedFacesServlet.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.myfaces.shared_impl.webapp.webxml;
-
-public interface DelegatedFacesServlet
-{
-}
diff --git a/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/FilterMapping.java b/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/FilterMapping.java
deleted file mode 100644
index 6b07b49..0000000
--- a/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/FilterMapping.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.myfaces.shared_impl.webapp.webxml;
-
-/**
- * @author Mario Ivankovits (latest modification by $Author$)
- * @version $Revision$ $Date$
- */
-public class FilterMapping
-{
- private String _filterName;
- private Class _filterClass;
- private String _urlPattern;
- private boolean _isExtensionMapping = false;
-
- public FilterMapping(String filterName,
- Class filterClass,
- String urlPattern)
- {
- _filterName = filterName;
- _filterClass = filterClass;
- _urlPattern = urlPattern;
- if (_urlPattern != null)
- {
- if (_urlPattern.startsWith("*."))
- {
- _isExtensionMapping = true;
- }
- }
- }
-
- public boolean isExtensionMapping()
- {
- return _isExtensionMapping;
- }
-
- public String getFilterName()
- {
- return _filterName;
- }
-
- public Class getFilterClass()
- {
- return _filterClass;
- }
-
- public String getUrlPattern()
- {
- return _urlPattern;
- }
-}
diff --git a/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/ServletMapping.java b/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/ServletMapping.java
deleted file mode 100644
index e093fba..0000000
--- a/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/ServletMapping.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.myfaces.shared_impl.webapp.webxml;
-
-/**
- * @author Manfred Geiler (latest modification by $Author$)
- * @version $Revision$ $Date$
- */
-public class ServletMapping
-{
- private final String _servletName;
- private final Class _servletClass;
- private final String _urlPattern;
- private final String _extension;
- private final String _prefix;
-
- public ServletMapping(String servletName, Class servletClass, String urlPattern)
- {
- _servletName = servletName;
- _servletClass = servletClass;
- _urlPattern = urlPattern;
- _extension = _urlPattern != null && _urlPattern.startsWith("*.") ? _urlPattern.substring(_urlPattern
- .indexOf('.')) : null;
- if (_extension == null)
- {
- int index = _urlPattern.indexOf("/*");
- if (index != -1)
- {
- _prefix = _urlPattern.substring(0, _urlPattern.indexOf("/*"));
- }
- else
- {
- _prefix = _urlPattern;
- }
- }
- else
- {
- _prefix = null;
- }
- }
-
- public boolean isExtensionMapping()
- {
- return _extension != null;
- }
-
- public String getExtension()
- {
- return _extension;
- }
-
- public String getPrefix()
- {
- return _prefix;
- }
-
- public String getServletName()
- {
- return _servletName;
- }
-
- public Class getServletClass()
- {
- return _servletClass;
- }
-
- public String getUrlPattern()
- {
- return _urlPattern;
- }
-}
diff --git a/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/WebXml.java b/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/WebXml.java
deleted file mode 100644
index 914d467..0000000
--- a/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/WebXml.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * 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.myfaces.shared_impl.webapp.webxml;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.faces.context.ExternalContext;
-import javax.faces.webapp.FacesServlet;
-
-import org.apache.myfaces.shared.config.MyfacesConfig;
-
-/**
- * @author Manfred Geiler (latest modification by $Author$)
- * @version $Revision$ $Date$
- */
-public class WebXml
-{
- private static final Logger log = Logger.getLogger(WebXml.class.getName());
-
-
- private static long refreshPeriod;
- private long parsingTime;
-
- private Map _servlets = new HashMap();
- private Map _servletMappings = new HashMap();
- private Map _filters = new HashMap();
- private Map _filterMappings = new HashMap();
-
- private volatile List _facesServletMappings = null;
- private volatile List _facesExtensionsFilterMappings = null;
-
- private String _delegateFacesServlet = null;
- private boolean errorPagePresent = false;
-
- void addServlet(String servletName, String servletClass)
- {
- if (_servlets.get(servletName) != null)
- {
- log.warning("Servlet " + servletName + " defined more than once, first definition will be used.");
- }
- else
- {
- _servlets.put(servletName, servletClass);
- }
- }
-
- void addFilter(String filterName, String filterClass)
- {
- if (_filters.get(filterName) != null)
- {
- log.warning("Filter " + filterName + " defined more than once, first definition will be used.");
- }
- else
- {
- _filters.put(filterName, filterClass);
- }
- }
-
- boolean containsServlet(String servletName)
- {
- return _servlets.containsKey(servletName);
- }
-
- boolean containsFilter(String filterName)
- {
- return _filters.containsKey(filterName);
- }
-
- void addServletMapping(String servletName, String urlPattern)
- {
- List mappings = (List)_servletMappings.get(servletName);
- if (mappings == null)
- {
- mappings = new ArrayList();
- _servletMappings.put(servletName, mappings);
- }
- mappings.add(urlPattern);
- }
-
- void addFilterMapping(String filterName, String urlPattern)
- {
- List mappings = (List)_filterMappings.get(filterName);
- if (mappings == null)
- {
- mappings = new ArrayList();
- _filterMappings.put(filterName, mappings);
- }
- mappings.add(urlPattern);
- }
-
- public List getFacesServletMappings()
- {
- if (_facesServletMappings != null)
- {
- return _facesServletMappings;
- }
-
- List tempFacesServletMappings = new ArrayList();
- for (Iterator it = _servlets.entrySet().iterator(); it.hasNext(); )
- {
- Map.Entry entry = (Map.Entry)it.next();
- String servletName = (String)entry.getKey();
- if (null == entry.getValue())
- {
- // the value is null in the case of jsp files listed as servlets
- // in cactus
- // <servlet>
- // <servlet-name>JspRedirector</servlet-name>
- // <jsp-file>/jspRedirector.jsp</jsp-file>
- // </servlet>
- continue;
- }
- Class servletClass = org.apache.myfaces.shared.util.ClassUtils.simpleClassForName((String)entry.getValue());
- if (FacesServlet.class.isAssignableFrom(servletClass) ||
- DelegatedFacesServlet.class.isAssignableFrom(servletClass) ||
- servletClass.getName().equals(_delegateFacesServlet))
- {
- List urlPatterns = (List)_servletMappings.get(servletName);
- if( urlPatterns != null )
- {
- for (Iterator it2 = urlPatterns.iterator(); it2.hasNext(); )
- {
- String urlpattern = (String)it2.next();
- tempFacesServletMappings.add(new ServletMapping(servletName, servletClass, urlpattern));
- if (log.isLoggable(Level.FINEST))
- {
- log.finest("adding mapping for servlet + " + servletName + " urlpattern = " + urlpattern);
- }
- }
- }
- }
- else
- {
- if (log.isLoggable(Level.FINEST))
- {
- log.finest("ignoring servlet + " + servletName + " " + servletClass + " (no FacesServlet)");
- }
- }
- }
-
- //Expose to all threads
- _facesServletMappings = tempFacesServletMappings;
-
- return _facesServletMappings;
- }
-
- /**
- * returns a list of org.apache.myfaces.shared_impl.webapp.webxml.FilterMapping representing a
- * extensions filter entry
- */
- public List getFacesExtensionsFilterMappings()
- {
- if (_facesExtensionsFilterMappings != null)
- {
- return _facesExtensionsFilterMappings;
- }
-
- List tempExtensionsFilterMappings = new ArrayList();
- for (Iterator it = _filters.entrySet().iterator(); it.hasNext(); )
- {
- Map.Entry entry = (Map.Entry)it.next();
- String filterName = (String)entry.getKey();
- String filterClassName = (String)entry.getValue();
-
- if (!"org.apache.myfaces.component.html.util.ExtensionsFilter".equals(filterClassName) &&
- !"org.apache.myfaces.webapp.filter.ExtensionsFilter".equals(filterClassName))
- {
- // not an extensions filter
- continue;
- }
-
- Class filterClass = org.apache.myfaces.shared.util.ClassUtils.simpleClassForName(filterClassName);
- List urlPatterns = (List)_filterMappings.get(filterName);
- if( urlPatterns != null )
- {
- for (Iterator it2 = urlPatterns.iterator(); it2.hasNext(); )
- {
- String urlpattern = (String)it2.next();
- tempExtensionsFilterMappings.add(new org.apache.myfaces.shared_impl.webapp.webxml.FilterMapping(
- filterName, filterClass, urlpattern));
- if (log.isLoggable(Level.FINEST))
- {
- log.finest("adding mapping for filter + " + filterName + " urlpattern = " + urlpattern);
- }
- }
- }
- }
-
- //Expose to all threads
- _facesExtensionsFilterMappings = tempExtensionsFilterMappings;
-
- return _facesExtensionsFilterMappings;
- }
-
- protected void setParsingTime(long parsingTime)
- {
- this.parsingTime = parsingTime;
- }
-
- private void setDelegateFacesServlet(String delegateFacesServlet)
- {
- this._delegateFacesServlet = delegateFacesServlet;
- }
-
- /**
- * Sets if, the web.xml contains an error-page entry
- * @param errorPagePresent
- */
- public void setErrorPagePresent(boolean errorPagePresent)
- {
- this.errorPagePresent = errorPagePresent;
- }
-
- /**
- * Determines, if the web.xml contains an error-page entry
- * @return
- */
- public boolean isErrorPagePresent()
- {
- return errorPagePresent;
- }
-
- protected boolean isOld(ExternalContext context)
- {
- if (refreshPeriod > 0)
- {
- long ttl = this.parsingTime + refreshPeriod;
- if (System.currentTimeMillis() > ttl)
- {
- long lastModified = WebXmlParser.getWebXmlLastModified(context);
- return lastModified == 0 || lastModified > ttl;
- }
- }
- return false;
- }
-
- private static final String WEB_XML_ATTR = WebXml.class.getName();
- public static WebXml getWebXml(ExternalContext context)
- {
- WebXml webXml = (WebXml)context.getApplicationMap().get(WEB_XML_ATTR);
- if (webXml == null)
- {
- init(context);
- webXml = (WebXml)context.getApplicationMap().get(WEB_XML_ATTR);
- }
- return webXml;
- }
-
- /**
- * should be called when initialising Servlet
- * @param context
- */
- public static void init(ExternalContext context)
- {
- WebXmlParser parser = new WebXmlParser(context);
- WebXml webXml = parser.parse();
- context.getApplicationMap().put(WEB_XML_ATTR, webXml);
- MyfacesConfig mfconfig = MyfacesConfig.getCurrentInstance(context);
- long configRefreshPeriod = mfconfig.getConfigRefreshPeriod();
- webXml.setParsingTime(System.currentTimeMillis());
- webXml.setDelegateFacesServlet(mfconfig.getDelegateFacesServlet());
- refreshPeriod = (configRefreshPeriod * 1000);
- }
-
- public static void update(ExternalContext context)
- {
- if (getWebXml(context).isOld(context))
- {
- WebXml.init(context);
- }
- }
-
-}
diff --git a/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/WebXmlParser.java b/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/WebXmlParser.java
deleted file mode 100644
index 96e10e5..0000000
--- a/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/WebXmlParser.java
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
- * 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.myfaces.shared_impl.webapp.webxml;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.faces.FacesException;
-import javax.faces.context.ExternalContext;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.myfaces.shared.util.ClassUtils;
-import org.apache.myfaces.shared.util.xml.MyFacesErrorHandler;
-import org.apache.myfaces.shared.util.xml.XmlUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-
-/**
- * @author Manfred Geiler (latest modification by $Author$)
- * @version $Revision$ $Date$
- */
-public class WebXmlParser
-{
- private static final Logger log = Logger.getLogger(WebXmlParser.class.getName());
-
- /*
- private static final String JAXP_SCHEMA_LANGUAGE =
- "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
- private static final String W3C_XML_SCHEMA =
- "http://www.w3.org/2001/XMLSchema";
- */
-
- private static final String WEB_XML_PATH = "/WEB-INF/web.xml";
-
- private static final String WEB_APP_2_2_J2EE_SYSTEM_ID = "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";
- private static final String WEB_APP_2_2_SYSTEM_ID = "http://java.sun.com/dtd/web-app_2_2.dtd";
- private static final String WEB_APP_2_2_RESOURCE = "javax/servlet/resources/web-app_2_2.dtd";
-
- private static final String WEB_APP_2_3_SYSTEM_ID = "http://java.sun.com/dtd/web-app_2_3.dtd";
- private static final String WEB_APP_2_3_RESOURCE = "javax/servlet/resources/web-app_2_3.dtd";
-
- private ExternalContext _context;
- private org.apache.myfaces.shared_impl.webapp.webxml.WebXml _webXml;
-
- public WebXmlParser(ExternalContext context)
- {
- _context = context;
- }
-
- public WebXml parse()
- {
- _webXml = new WebXml();
-
- try
- {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setIgnoringElementContentWhitespace(true);
- dbf.setIgnoringComments(true);
- dbf.setNamespaceAware(true);
- dbf.setValidating(false);
-// dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
-
- DocumentBuilder db = dbf.newDocumentBuilder();
- db.setEntityResolver(new _EntityResolver());
- db.setErrorHandler(new MyFacesErrorHandler(log));
-
- InputSource is = createContextInputSource(null, WEB_XML_PATH);
-
- if(is==null)
- {
- URL url = _context.getResource(WEB_XML_PATH);
- log.fine("No web-xml found at : "+(url==null?" null ":url.toString()));
- return _webXml;
- }
-
- Document document = db.parse(is);
-
- Element webAppElem = document.getDocumentElement();
- if (webAppElem == null ||
- !webAppElem.getNodeName().equals("web-app"))
- {
- throw new FacesException("No valid web-app root element found!");
- }
-
- readWebApp(webAppElem);
-
- return _webXml;
- }
- catch (Exception e)
- {
- log.log(Level.SEVERE, "Unable to parse web.xml", e);
- throw new FacesException(e);
- }
- }
-
- public static long getWebXmlLastModified(ExternalContext context)
- {
- try
- {
- URL url = context.getResource(WEB_XML_PATH);
- if (url != null)
- {
- return url.openConnection().getLastModified();
- }
- }
- catch (IOException e)
- {
- log.log(Level.SEVERE, "Could not find web.xml in path " + WEB_XML_PATH);
- }
- return 0L;
- }
-
-
- private InputSource createContextInputSource(String publicId, String systemId)
- {
- InputStream inStream = _context.getResourceAsStream(systemId);
- if (inStream == null)
- {
- // there is no such entity
- return null;
- }
- InputSource is = new InputSource(inStream);
- is.setPublicId(publicId);
- is.setSystemId(systemId);
- //the next line was removed - encoding should be determined automatically out of the inputStream
- //DEFAULT_ENCODING was ISO-8859-1
- //is.setEncoding(DEFAULT_ENCODING);
- return is;
- }
-
- private InputSource createClassloaderInputSource(String publicId, String systemId)
- {
- InputStream inStream = ClassUtils.getResourceAsStream(systemId);
- if (inStream == null)
- {
- // there is no such entity
- return null;
- }
- InputSource is = new InputSource(inStream);
- is.setPublicId(publicId);
- is.setSystemId(systemId);
- //the next line was removed - encoding should be determined automatically out of the inputStream
- //encoding should be determined automatically out of the inputStream
- //DEFAULT_ENCODING was ISO-8859-1
- //is.setEncoding(DEFAULT_ENCODING);
- return is;
- }
-
- private class _EntityResolver implements EntityResolver
- {
- public InputSource resolveEntity(String publicId, String systemId) throws IOException
- {
- if (systemId == null)
- {
- throw new UnsupportedOperationException("systemId must not be null");
- }
-
- if (systemId.equals(WebXmlParser.WEB_APP_2_2_SYSTEM_ID) ||
- systemId.equals(WebXmlParser.WEB_APP_2_2_J2EE_SYSTEM_ID))
- {
- //Load DTD from servlet.jar
- return createClassloaderInputSource(publicId, WebXmlParser.WEB_APP_2_2_RESOURCE);
- }
- else if (systemId.equals(WebXmlParser.WEB_APP_2_3_SYSTEM_ID))
- {
- //Load DTD from servlet.jar
- return createClassloaderInputSource(publicId, WebXmlParser.WEB_APP_2_3_RESOURCE);
- }
- else
- {
- //Load additional entities from web context
- return createContextInputSource(publicId, systemId);
- }
- }
-
- }
-
-
- private void readWebApp(Element webAppElem)
- {
- NodeList nodeList = webAppElem.getChildNodes();
- for (int i = 0, len = nodeList.getLength(); i < len; i++)
- {
- Node n = nodeList.item(i);
- if (n.getNodeType() == Node.ELEMENT_NODE)
- {
- if (n.getNodeName().equals("servlet"))
- {
- readServlet((Element)n);
- }
- if (n.getNodeName().equals("servlet-mapping"))
- {
- readServletMapping((Element)n);
- }
- if (n.getNodeName().equals("filter"))
- {
- readFilter((Element)n);
- }
- if (n.getNodeName().equals("filter-mapping"))
- {
- readFilterMapping((Element)n);
- }
- if (n.getNodeName().equals("error-page"))
- {
- _webXml.setErrorPagePresent(true);
- }
- }
- else
- {
- if (log.isLoggable(Level.FINE))
- {
- log.fine("Ignored node '" + n.getNodeName() + "' of type " + n.getNodeType());
- }
- }
- }
- }
-
- private void readServlet(Element servletElem)
- {
- String servletName = null;
- String servletClass = null;
- NodeList nodeList = servletElem.getChildNodes();
- for (int i = 0, len = nodeList.getLength(); i < len; i++)
- {
- Node n = nodeList.item(i);
- if (n.getNodeType() == Node.ELEMENT_NODE)
- {
- if (n.getNodeName().equals("servlet-name"))
- {
- servletName = XmlUtils.getElementText((Element)n);
- }
- else if (n.getNodeName().equals("servlet-class"))
- {
- servletClass = org.apache.myfaces.shared.util.xml.XmlUtils.getElementText((Element)n).trim();
- }
- else if (n.getNodeName().equals("description") || n.getNodeName().equals("load-on-startup")
- || n.getNodeName().equals("init-param"))
- {
- //ignore
- }
- else
- {
- if (log.isLoggable(Level.FINE))
- {
- log.fine("Ignored element '" + n.getNodeName() + "' as child of '"
- + servletElem.getNodeName() + "'.");
- }
- }
- }
- else
- {
- if (log.isLoggable(Level.FINE))
- {
- log.fine("Ignored node '" + n.getNodeName() + "' of type " + n.getNodeType());
- }
- }
- }
- _webXml.addServlet(servletName, servletClass);
- }
-
-
- private void readServletMapping(Element servletMappingElem)
- {
- String servletName = null;
- String urlPattern = null;
- NodeList nodeList = servletMappingElem.getChildNodes();
- for (int i = 0, len = nodeList.getLength(); i < len; i++)
- {
- Node n = nodeList.item(i);
- if (n.getNodeType() == Node.ELEMENT_NODE)
- {
- if (n.getNodeName().equals("servlet-name"))
- {
- servletName = org.apache.myfaces.shared.util.xml.XmlUtils.getElementText((Element)n);
- }
- else if (n.getNodeName().equals("url-pattern"))
- {
- urlPattern = org.apache.myfaces.shared.util.xml.XmlUtils.getElementText((Element)n).trim();
- }
- else
- {
- if (log.isLoggable(Level.FINE))
- {
- log.fine("Ignored element '" + n.getNodeName() + "' as child of '"
- + servletMappingElem.getNodeName() + "'.");
- }
- }
- }
- else
- {
- if (log.isLoggable(Level.FINE))
- {
- log.fine("Ignored node '" + n.getNodeName() + "' of type " + n.getNodeType());
- }
- }
- }
- urlPattern = urlPattern.trim();
- _webXml.addServletMapping(servletName, urlPattern);
- }
-
- private void readFilter(Element filterElem)
- {
- String filterName = null;
- String filterClass = null;
- NodeList nodeList = filterElem.getChildNodes();
- for (int i = 0, len = nodeList.getLength(); i < len; i++)
- {
- Node n = nodeList.item(i);
- if (n.getNodeType() == Node.ELEMENT_NODE)
- {
- if (n.getNodeName().equals("filter-name"))
- {
- filterName = XmlUtils.getElementText((Element)n).trim();
- }
- else if (n.getNodeName().equals("filter-class"))
- {
- filterClass = org.apache.myfaces.shared.util.xml.XmlUtils.getElementText((Element)n).trim();
- }
- else if (n.getNodeName().equals("description") || n.getNodeName().equals("init-param"))
- {
- //ignore
- }
- else
- {
- if (log.isLoggable(Level.FINE))
- {
- log.fine("Ignored element '" + n.getNodeName() + "' as child of '"
- + filterElem.getNodeName() + "'.");
- }
- }
- }
- else
- {
- if (log.isLoggable(Level.FINE))
- {
- log.fine("Ignored node '" + n.getNodeName() + "' of type " + n.getNodeType());
- }
- }
- }
- _webXml.addFilter(filterName, filterClass);
- }
-
-
- private void readFilterMapping(Element filterMappingElem)
- {
- String filterName = null;
- String urlPattern = null;
- NodeList nodeList = filterMappingElem.getChildNodes();
- for (int i = 0, len = nodeList.getLength(); i < len; i++)
- {
- Node n = nodeList.item(i);
- if (n.getNodeType() == Node.ELEMENT_NODE)
- {
- if (n.getNodeName().equals("filter-name"))
- {
- filterName = org.apache.myfaces.shared.util.xml.XmlUtils.getElementText((Element)n).trim();
- }
- else if (n.getNodeName().equals("url-pattern"))
- {
- urlPattern = org.apache.myfaces.shared.util.xml.XmlUtils.getElementText((Element)n).trim();
- }
- else if (n.getNodeName().equals("servlet-name"))
- {
- // we are not interested in servlet-name based mapping - for now
- }
- else
- {
- if (log.isLoggable(Level.FINE))
- {
- log.fine("Ignored element '" + n.getNodeName() + "' as child of '"
- + filterMappingElem.getNodeName() + "'.");
- }
- }
- }
- else
- {
- if (log.isLoggable(Level.FINE))
- {
- log.fine("Ignored node '" + n.getNodeName() + "' of type " + n.getNodeType());
- }
- }
- }
- _webXml.addFilterMapping(filterName, urlPattern);
- }
-}
diff --git a/impl/src/main/java/org/apache/myfaces/spi/impl/DefaultWebConfigProvider.java b/impl/src/main/java/org/apache/myfaces/spi/impl/DefaultWebConfigProvider.java
index 8f2446a..233ebf6 100644
--- a/impl/src/main/java/org/apache/myfaces/spi/impl/DefaultWebConfigProvider.java
+++ b/impl/src/main/java/org/apache/myfaces/spi/impl/DefaultWebConfigProvider.java
@@ -22,8 +22,8 @@ import java.util.ArrayList;
import java.util.List;
import javax.faces.context.ExternalContext;
+import org.apache.myfaces.shared.webapp.webxml.WebXml;
-import org.apache.myfaces.shared_impl.webapp.webxml.WebXml;
import org.apache.myfaces.spi.ServletMapping;
import org.apache.myfaces.spi.WebConfigProvider;
@@ -51,8 +51,7 @@ public class DefaultWebConfigProvider extends WebConfigProvider
for (int i = 0; i < mapping.size(); i++)
{
- org.apache.myfaces.shared_impl.webapp.webxml.ServletMapping delegateMapping =
- (org.apache.myfaces.shared_impl.webapp.webxml.ServletMapping) mapping.get(i);
+ ServletMapping delegateMapping = (ServletMapping) mapping.get(i);
mappingList.add(new ServletMappingImpl(delegateMapping));
}
diff --git a/impl/src/main/java/org/apache/myfaces/spi/impl/ServletMappingImpl.java b/impl/src/main/java/org/apache/myfaces/spi/impl/ServletMappingImpl.java
index b29d35f..5776b2b 100644
--- a/impl/src/main/java/org/apache/myfaces/spi/impl/ServletMappingImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/spi/impl/ServletMappingImpl.java
@@ -23,10 +23,9 @@ import org.apache.myfaces.spi.ServletMapping;
public class ServletMappingImpl implements ServletMapping
{
- private org.apache.myfaces.shared_impl.webapp.webxml.ServletMapping _delegateMapping;
+ private ServletMapping _delegateMapping;
- public ServletMappingImpl(
- org.apache.myfaces.shared_impl.webapp.webxml.ServletMapping delegateMapping)
+ public ServletMappingImpl(ServletMapping delegateMapping)
{
super();
this._delegateMapping = delegateMapping;
diff --git a/impl/src/main/java/org/apache/myfaces/webapp/MyFacesServlet.java b/impl/src/main/java/org/apache/myfaces/webapp/MyFacesServlet.java
index 7a0d621..8374d62 100755
--- a/impl/src/main/java/org/apache/myfaces/webapp/MyFacesServlet.java
+++ b/impl/src/main/java/org/apache/myfaces/webapp/MyFacesServlet.java
@@ -30,8 +30,7 @@ import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-
-import org.apache.myfaces.shared_impl.webapp.webxml.DelegatedFacesServlet;
+import org.apache.myfaces.shared.webapp.webxml.DelegatedFacesServlet;
/**
* Derived FacesServlet that can be used for debugging purpose
diff --git a/impl/src/test/java/org/apache/myfaces/application/StateManagerImplTest.java b/impl/src/test/java/org/apache/myfaces/application/StateManagerImplTest.java
index c96efdb..b203e69 100644
--- a/impl/src/test/java/org/apache/myfaces/application/StateManagerImplTest.java
+++ b/impl/src/test/java/org/apache/myfaces/application/StateManagerImplTest.java
@@ -29,7 +29,7 @@ import javax.faces.render.ResponseStateManager;
import org.apache.myfaces.renderkit.html.HtmlResponseStateManager;
import org.apache.myfaces.shared.util.StateUtils;
-import org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory;
+import org.apache.myfaces.shared.util.serial.DefaultSerialFactory;
import org.apache.myfaces.test.base.junit4.AbstractJsfConfigurableMultipleRequestsTestCase;
import org.apache.myfaces.test.mock.MockRenderKit;
import org.apache.myfaces.test.mock.MockResponseWriter;
diff --git a/impl/src/test/java/org/apache/myfaces/renderkit/ErrorPageWriterTest.java b/impl/src/test/java/org/apache/myfaces/renderkit/ErrorPageWriterTest.java
index d0a655e..033f88a 100644
--- a/impl/src/test/java/org/apache/myfaces/renderkit/ErrorPageWriterTest.java
+++ b/impl/src/test/java/org/apache/myfaces/renderkit/ErrorPageWriterTest.java
@@ -30,7 +30,7 @@ import junit.framework.TestSuite;
import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
import org.apache.myfaces.shared.util.StateUtils;
-import org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory;
+import org.apache.myfaces.shared.util.serial.DefaultSerialFactory;
import org.apache.myfaces.test.base.AbstractJsfTestCase;
import org.apache.myfaces.test.mock.MockRenderKitFactory;
import org.apache.myfaces.test.mock.MockResponseWriter;
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/StateManagerWithFaceletsTest.java b/impl/src/test/java/org/apache/myfaces/view/facelets/StateManagerWithFaceletsTest.java
index ed02992..2a272e3 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/StateManagerWithFaceletsTest.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/StateManagerWithFaceletsTest.java
@@ -26,7 +26,7 @@ import javax.faces.render.ResponseStateManager;
import org.apache.myfaces.application.StateManagerImpl;
import org.apache.myfaces.renderkit.html.HtmlResponseStateManager;
import org.apache.myfaces.shared.util.StateUtils;
-import org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory;
+import org.apache.myfaces.shared.util.serial.DefaultSerialFactory;
import org.apache.myfaces.test.mock.MockFacesContext20;
import org.apache.myfaces.test.mock.MockRenderKit;
import org.junit.Test;
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/UniqueComponentIdTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/UniqueComponentIdTestCase.java
index 7518e11..a5d179c 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/UniqueComponentIdTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/UniqueComponentIdTestCase.java
@@ -34,7 +34,7 @@ import org.apache.myfaces.application.StateManagerImpl;
import org.apache.myfaces.renderkit.html.HtmlResponseStateManager;
import org.apache.myfaces.shared.config.MyfacesConfig;
import org.apache.myfaces.shared.util.StateUtils;
-import org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory;
+import org.apache.myfaces.shared.util.serial.DefaultSerialFactory;
import org.apache.myfaces.test.mock.MockFacesContext20;
import org.apache.myfaces.test.mock.MockRenderKit;
import org.apache.myfaces.view.facelets.FaceletMultipleRequestsTestCase;