struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [03/16] struts git commit: Drops unused classes (cherry picked from commit 24a5bce)
Date Sun, 10 Jan 2016 11:22:01 GMT
Drops unused classes
(cherry picked from commit 24a5bce)


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/efcea81b
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/efcea81b
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/efcea81b

Branch: refs/heads/support-2-3
Commit: efcea81b67d260835eff9c811efe20a816df7213
Parents: 9862580
Author: Lukasz Lenart <lukasz.lenart@gmail.com>
Authored: Wed Nov 25 20:29:24 2015 +0100
Committer: Lukasz Lenart <lukasz.lenart@gmail.com>
Committed: Sat Nov 28 15:36:04 2015 +0100

----------------------------------------------------------------------
 .../struts2/tiles/ConfiguredServletContext.java | 187 -------------------
 .../tiles/StrutsTilesRequestContext.java        | 123 ------------
 2 files changed, 310 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/efcea81b/plugins/tiles/src/main/java/org/apache/struts2/tiles/ConfiguredServletContext.java
----------------------------------------------------------------------
diff --git a/plugins/tiles/src/main/java/org/apache/struts2/tiles/ConfiguredServletContext.java
b/plugins/tiles/src/main/java/org/apache/struts2/tiles/ConfiguredServletContext.java
deleted file mode 100644
index dfc1408..0000000
--- a/plugins/tiles/src/main/java/org/apache/struts2/tiles/ConfiguredServletContext.java
+++ /dev/null
@@ -1,187 +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.
- */
-
-package org.apache.struts2.tiles;
-
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.*;
-
-/**
- * ServletContext implementation which allows Struts
- * to inject initialization parameters into the context
- * in order to reduce the amount of configuration required
- * within web.xml for using Tiles.
- *
- * The specified init parameters are only utilized if
- * they are not explicitaly defined in the web.xml
- *
- * @version $Rev$
- * @since Struts 2.0.1
- */
-@SuppressWarnings("deprecation")
-public class ConfiguredServletContext implements ServletContext {
-
-    private ServletContext rootContext;
-    private Map<String, String> initParameters;
-
-
-    public ConfiguredServletContext(ServletContext context, Map<String, String> initParameters)
{
-        this.rootContext = context;
-        this.initParameters = initParameters;
-    }
-
-    public ServletContext getContext(String string) {
-        return rootContext.getContext(string);
-    }
-
-    public int getMajorVersion() {
-        return rootContext.getMajorVersion();
-    }
-
-    public int getMinorVersion() {
-        return rootContext.getMinorVersion();
-    }
-
-    public String getMimeType(String string) {
-        return rootContext.getMimeType(string);
-    }
-
-    public Set getResourcePaths(String string) {
-        return rootContext.getResourcePaths(string);
-    }
-
-    public URL getResource(String string) throws MalformedURLException {
-        return rootContext.getResource(string);
-    }
-
-    public InputStream getResourceAsStream(String string) {
-        return rootContext.getResourceAsStream(string);
-    }
-
-    public RequestDispatcher getRequestDispatcher(String string) {
-        return rootContext.getRequestDispatcher(string);
-    }
-
-    public RequestDispatcher getNamedDispatcher(String string) {
-        return rootContext.getNamedDispatcher(string);
-    }
-
-    @SuppressWarnings("deprecation")
-    public Servlet getServlet(String string) throws ServletException {
-        return rootContext.getServlet(string);
-    }
-
-    @SuppressWarnings("deprecation")
-    public Enumeration getServlets() {
-        return rootContext.getServlets();  //To change body of implemented methods use File
| Settings | File Templates.
-    }
-
-    @SuppressWarnings("deprecation")
-    public Enumeration getServletNames() {
-        return rootContext.getServletNames();
-    }
-
-    public void log(String string) {
-        rootContext.log(string);
-    }
-
-    @SuppressWarnings("deprecation")
-    public void log(Exception exception, String string) {
-        rootContext.log(exception, string);
-    }
-
-    public void log(String string, Throwable throwable) {
-        rootContext.log(string, throwable);
-    }
-
-    public String getRealPath(String string) {
-        return rootContext.getRealPath(string);
-    }
-
-    public String getServerInfo() {
-        return rootContext.getServerInfo();
-    }
-
-    public String getInitParameter(String string) {
-        String parm = rootContext.getInitParameter(string);
-        if (parm == null) {
-            return initParameters.get(string);
-        }
-        return parm;
-    }
-
-    public Enumeration getInitParameterNames() {
-        return new CompositeEnumeration(
-                rootContext.getInitParameterNames(),
-                initParameters.keySet().iterator());
-    }
-
-    public Object getAttribute(String string) {
-        return rootContext.getAttribute(string);
-    }
-
-    public Enumeration getAttributeNames() {
-        return rootContext.getAttributeNames();
-    }
-
-    public void setAttribute(String string, Object object) {
-        rootContext.setAttribute(string, object);
-    }
-
-    public void removeAttribute(String string) {
-        rootContext.removeAttribute(string);
-    }
-
-    public String getServletContextName() {
-        return rootContext.getServletContextName();
-    }
-
-    class CompositeEnumeration implements Enumeration {
-
-        private Enumeration first;
-        private Iterator second;
-
-
-        public CompositeEnumeration(Enumeration first, Iterator second) {
-            this.first = first;
-            this.second = second;
-        }
-
-        public boolean hasMoreElements() {
-            return first.hasMoreElements() || second.hasNext();
-        }
-
-        public Object nextElement() {
-            if (first.hasMoreElements()) {
-                return first.nextElement();
-            }
-
-            return second.next();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/struts/blob/efcea81b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesRequestContext.java
----------------------------------------------------------------------
diff --git a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesRequestContext.java
b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesRequestContext.java
deleted file mode 100644
index 856517c..0000000
--- a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesRequestContext.java
+++ /dev/null
@@ -1,123 +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.
- */
-
-package org.apache.struts2.tiles;
-
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.inject.Container;
-import com.opensymphony.xwork2.util.logging.Logger;
-import com.opensymphony.xwork2.util.logging.LoggerFactory;
-import org.apache.struts2.ServletActionContext;
-import org.apache.struts2.views.freemarker.FreemarkerResult;
-import org.apache.tiles.context.TilesRequestContext;
-import org.apache.tiles.context.TilesRequestContextWrapper;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * Default implementation of TilesUtil.
- * This class contains default implementation of utilities. This implementation
- * is intended to be used without Struts.
- * <p/>
- * TilesUtilImpl implementation used to intercept .ftl requests and
- * ensure that they are setup properly to take advantage of the
- * {@link FreemarkerResult}.
- *
- * @version $Id$
- */
-public class StrutsTilesRequestContext extends TilesRequestContextWrapper {
-
-    private static final Logger LOG = LoggerFactory.getLogger(StrutsTilesRequestContext.class);
-
-    /**
-     * The mask used to detect requests which should be intercepted.
-     */
-    private String mask;
-
-    /**
-     * Default constructor.
-     * Sets the mask to '.ftl'
-     *
-     * @param context
-     */
-    public StrutsTilesRequestContext(TilesRequestContext context) {
-        this(context, ".ftl");
-    }
-
-    /**
-     * Optional constructor used to specify a specific mask.
-     *
-     * @param mask
-     * @param context
-     */
-    public StrutsTilesRequestContext(TilesRequestContext context, String mask) {
-        super(context);
-        this.mask = mask;
-    }
-
-    public void dispatch(String include) throws IOException {
-    	if (include.endsWith(mask)) {
-            // FIXME This way FreeMarker results still don't have a content-type!
-    	    include(include);
-        } else {
-            super.dispatch(include);
-        }
-    }
-
-    /**
-     * Enhancement of the default include which allows for freemarker
-     * templates to be intercepted so that the FreemarkerResult can
-     * be used in order to setup the appropriate model.
-     *
-     * @throws IOException
-     */
-    public void include(String include) throws IOException {
-        if (include.endsWith(mask)) {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Intercepting tiles include '" + include + "'. Processing as freemarker
result.");
-            }
-            HttpServletRequest request = (HttpServletRequest) getRequest();
-            HttpServletResponse response = (HttpServletResponse) getResponse();
-
-            ActionContext ctx = ServletActionContext.getActionContext(request);
-            ActionInvocation invocation = ctx.getActionInvocation();
-
-            try {
-                FreemarkerResult result = new FreemarkerResult();
-                result.setWriter(response.getWriter());
-
-                Container container = ctx.getContainer();
-                container.inject(result);
-
-                result.doExecute(include, invocation);
-            } catch (Exception e) {
-                LOG.error("Error invoking Freemarker template", e);
-                throw new IOException("Error invoking Freemarker template." + e.getMessage());
-            }
-        } else {
-            super.include(include);
-        }
-    }
-
-}


Mime
View raw message