com.groiss.servlet
Class FileServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.groiss.servlet.FileServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class FileServlet
extends javax.servlet.http.HttpServlet

This servlet is for sending file to the browser.

See Also:
Serialized Form

Field Summary
protected static long cnt
           
protected static java.lang.String documentRoot
           
protected static long expires
           
protected static java.util.Map<java.lang.String,java.lang.String> roots
           
protected static java.util.Map<java.lang.String,java.lang.String> virtualRoots
           
 
Constructor Summary
FileServlet()
           
 
Method Summary
static void addVirtualRoot(java.lang.String id, java.lang.String root)
           
static com.groiss.cache.FileCacheItem findFile(java.util.Locale l, java.lang.String root, java.lang.String path)
           
static com.groiss.cache.FileCacheItem findFile(java.util.Locale l, java.lang.String root, java.lang.String path, java.lang.String starts)
          lookup a file in the locale dependent file tree
static java.lang.String getDocumentRoot()
           
static java.lang.String getMappedImage(java.lang.String imagePath)
          Returns the shiny path for the passed image path.
static long getRequestCount()
           
static java.lang.String getVirtualRoot(java.lang.String id)
           
static java.lang.String getVirtualRoot(java.lang.String vroot, java.lang.String loc)
           
static void logParameters(javax.servlet.http.HttpServletRequest req)
           
static javax.servlet.http.HttpServletRequest logRequest(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
           
static void logRequestProcessed(long startTime, javax.servlet.http.HttpServletRequest req)
           
protected  void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

virtualRoots

protected static final java.util.Map<java.lang.String,java.lang.String> virtualRoots

roots

protected static final java.util.Map<java.lang.String,java.lang.String> roots

documentRoot

protected static java.lang.String documentRoot

cnt

protected static long cnt

expires

protected static long expires
Constructor Detail

FileServlet

public FileServlet()
Method Detail

service

protected void service(javax.servlet.http.HttpServletRequest req,
                       javax.servlet.http.HttpServletResponse res)
                throws java.io.IOException,
                       javax.servlet.ServletException
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
java.io.IOException
javax.servlet.ServletException

getVirtualRoot

public static java.lang.String getVirtualRoot(java.lang.String id)

getRequestCount

public static long getRequestCount()

getVirtualRoot

public static java.lang.String getVirtualRoot(java.lang.String vroot,
                                              java.lang.String loc)

addVirtualRoot

public static void addVirtualRoot(java.lang.String id,
                                  java.lang.String root)

getDocumentRoot

public static java.lang.String getDocumentRoot()

findFile

public static com.groiss.cache.FileCacheItem findFile(java.util.Locale l,
                                                      java.lang.String root,
                                                      java.lang.String path)
                                               throws java.io.FileNotFoundException,
                                                      java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

findFile

public static com.groiss.cache.FileCacheItem findFile(java.util.Locale l,
                                                      java.lang.String root,
                                                      java.lang.String path,
                                                      java.lang.String starts)
                                               throws java.io.FileNotFoundException,
                                                      java.io.IOException
lookup a file in the locale dependent file tree

Parameters:
l - the locale, can be null for locale independent files
root - the root of search
path - the relative path of the resource
starts - the id of the application, needed for finding the resource to make the language substitutions
Throws:
java.io.FileNotFoundException
java.io.IOException

logParameters

public static void logParameters(javax.servlet.http.HttpServletRequest req)

logRequest

public static javax.servlet.http.HttpServletRequest logRequest(javax.servlet.http.HttpServletRequest req,
                                                               javax.servlet.http.HttpServletResponse res)

logRequestProcessed

public static void logRequestProcessed(long startTime,
                                       javax.servlet.http.HttpServletRequest req)

getMappedImage

public static java.lang.String getMappedImage(java.lang.String imagePath)
Returns the shiny path for the passed image path. If no shiny path is available the passed path is returned.

Parameters:
imagePath - the original path of the image
Returns:
the path for the shiny version of the image


@enterprise 8.0.22989 Copyright © 2001-2017 Groiss Informatics GmbH. All Rights Reserved.