]> source.dussan.org Git - vaadin-framework.git/commitdiff
removed obsolete millstone/toolkit 4 era method
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 26 Aug 2009 12:58:21 +0000 (12:58 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 26 Aug 2009 12:58:21 +0000 (12:58 +0000)
svn changeset:8549/svn branch:6.1

src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java

index 83ff3ffabcc66c198d1bd0e92a5fc6b6bcb28232..a9e30bdb67af67957f313808d270942876fde88a 100644 (file)
@@ -34,7 +34,6 @@ import org.xml.sax.SAXException;
 import com.vaadin.Application;
 import com.vaadin.Application.SystemMessages;
 import com.vaadin.external.org.apache.commons.fileupload.servlet.ServletFileUpload;
-import com.vaadin.service.FileTypeResolver;
 import com.vaadin.terminal.DownloadStream;
 import com.vaadin.terminal.ParameterHandler;
 import com.vaadin.terminal.Terminal;
@@ -160,8 +159,6 @@ public abstract class AbstractApplicationServlet extends HttpServlet {
 
     private static final int MAX_BUFFER_SIZE = 64 * 1024;
 
-    private static final String RESOURCE_URI = "/RES/";
-
     private static final String AJAX_UIDL_URI = "/UIDL";
 
     static final String THEME_DIRECTORY_PATH = "VAADIN/themes/";
@@ -460,11 +457,6 @@ public abstract class AbstractApplicationServlet extends HttpServlet {
                 return;
             }
 
-            // Handles theme resource requests
-            if (handleResourceRequest(request, response, window)) {
-                return;
-            }
-
             // Send initial AJAX page that kickstarts a Vaadin application
             writeAjaxPage(request, response, window, application);
 
@@ -1662,91 +1654,6 @@ public abstract class AbstractApplicationServlet extends HttpServlet {
         return "You have to enable javascript in your browser to use an application built with Vaadin.";
     }
 
-    /**
-     * Handles theme resource file requests. Resources supplied with the themes
-     * are provided by the WebAdapterServlet.
-     * 
-     * @param request
-     *            the HTTP request.
-     * @param response
-     *            the HTTP response.
-     * @return boolean <code>true</code> if the request was handled and further
-     *         processing should be suppressed, <code>false</code> otherwise.
-     * @throws ServletException
-     *             if an exception has occurred that interferes with the
-     *             servlet's normal operation.
-     */
-    private boolean handleResourceRequest(HttpServletRequest request,
-            HttpServletResponse response, Window window)
-            throws ServletException {
-        // If the resource path is unassigned, initialize it
-        if (resourcePath == null) {
-            resourcePath = request.getContextPath() + request.getServletPath()
-                    + RESOURCE_URI;
-            // WebSphere Application Server related fix
-            resourcePath = resourcePath.replaceAll("//", "/");
-        }
-
-        String resourceId = request.getPathInfo();
-
-        // Checks if this really is a resource request
-        if (resourceId == null || !resourceId.startsWith(RESOURCE_URI)) {
-            return false;
-        }
-
-        String themeName = getThemeForWindow(request, window);
-
-        // Checks the resource type
-        resourceId = resourceId.substring(RESOURCE_URI.length());
-        InputStream data = null;
-
-        // Gets theme resources
-        try {
-            data = getServletContext().getResourceAsStream(
-                    THEME_DIRECTORY_PATH + themeName + "/" + resourceId);
-        } catch (final Exception e) {
-            // FIXME: Handle exception
-            e.printStackTrace();
-            data = null;
-        }
-
-        // Writes the response
-        try {
-            if (data != null) {
-                response.setContentType(FileTypeResolver
-                        .getMIMEType(resourceId));
-
-                // Use default cache time for theme resources
-                response.setHeader("Cache-Control", "max-age="
-                        + DEFAULT_THEME_CACHETIME / 1000);
-                response.setDateHeader("Expires", System.currentTimeMillis()
-                        + DEFAULT_THEME_CACHETIME);
-                response.setHeader("Pragma", "cache"); // Required to apply
-                // caching in some
-                // Tomcats
-
-                // Writes the data to client
-                final byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
-                int bytesRead = 0;
-                final OutputStream out = response.getOutputStream();
-                while ((bytesRead = data.read(buffer)) > 0) {
-                    out.write(buffer, 0, bytesRead);
-                }
-                out.close();
-                data.close();
-            } else {
-                response.sendError(HttpServletResponse.SC_NOT_FOUND);
-            }
-
-        } catch (final java.io.IOException e) {
-            // FIXME: Handle exception
-            System.err.println("Resource transfer failed:  "
-                    + request.getRequestURI() + ". (" + e.getMessage() + ")");
-        }
-
-        return true;
-    }
-
     /**
      * Gets the current application URL from request.
      *