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.Hashtable repositories
           
protected static java.util.Hashtable resources
           
protected static java.util.Hashtable roots
           
protected static java.util.Hashtable virtualRoots
           
 
Constructor Summary
FileServlet()
           
 
Method Summary
static void addRepository(java.lang.String path, java.lang.String id)
           
static void addResource(java.lang.String id, Resource res)
           
static void addVirtualRoot(java.lang.String id, java.lang.String root)
           
static com.groiss.cache.CacheItem findFile(java.util.Locale l, java.lang.String root, java.lang.String path)
           
static com.groiss.cache.CacheItem 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 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 com.groiss.cache.CacheItem loadAndLocalizeResource(java.util.Locale l, java.lang.String path)
          search files in classpath
static javax.servlet.http.HttpServletRequest logRequest(javax.servlet.http.HttpServletRequest req)
           
protected  void service(javax.servlet.http.HttpServletRequest req0, 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 java.util.Hashtable virtualRoots

resources

protected static java.util.Hashtable resources

roots

protected static java.util.Hashtable roots

repositories

protected static java.util.Hashtable repositories

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 req0,
                       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)

addResource

public static void addResource(java.lang.String id,
                               Resource res)

addRepository

public static void addRepository(java.lang.String path,
                                 java.lang.String id)

getDocumentRoot

public static java.lang.String getDocumentRoot()

findFile

public static com.groiss.cache.CacheItem 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.CacheItem 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

loadAndLocalizeResource

public static com.groiss.cache.CacheItem loadAndLocalizeResource(java.util.Locale l,
                                                                 java.lang.String path)
                                                          throws java.io.FileNotFoundException,
                                                                 java.io.IOException,
                                                                 ApplicationException
search files in classpath

Throws:
java.io.FileNotFoundException
java.io.IOException
ApplicationException

logRequest

public static javax.servlet.http.HttpServletRequest logRequest(javax.servlet.http.HttpServletRequest req)


Copyright © 2001-2006 Groiss Informatics GmbH. All Rights Reserved.