com.groiss.servlet
Class Dispatcher

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

public class Dispatcher
extends javax.servlet.http.HttpServlet
implements Public

This servlet calls methods via reflection.

See Also:
Serialized Form

Field Summary
static int licenceStatus
           
static com.groiss.servlet.impl.OldRequestHandler oldHandler
           
 
Constructor Summary
Dispatcher()
           
 
Method Summary
static void addModificationInfo(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, long lastModified, java.util.Locale locale)
          adds some header fields to the response so we can determine modification on the next request
adds an ETag and a Last-Modified-Header
static java.util.Locale getBrowserLocale(javax.servlet.http.HttpServletRequest req)
          Read the locale from the browser.
static java.lang.String getContextPath()
          Returns the context path of this application.
static java.lang.reflect.Method getMethod(java.lang.String m)
          Return the method from a string containing the class and method name, syntax: classname "." methodname
static long getRequestCount()
          Get the request count for statistics.
 void init()
           
static boolean isModifiedSince(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, long lastModified, java.util.Locale l)
          returns true if the requested resource has been modified since the last request
the following methods are used: check the ETag-header check the if-modified-since - header
static void reloadClasses()
          Reload the method cache the Dispatcher holds.
 void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
           
static void setExpiresImmediatelyForGuest(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          if no user is currently logged in, it's required, that some resources are not cached, so the user gets the new files as soon he loggs in
static java.util.Locale setLocale(javax.servlet.http.HttpServletRequest req)
          Set the locale to the ThreadContext.
 void setPathInfo(java.lang.String pi)
          Deprecated. use MultipartRequest.setPathInfo(String) instead, will be removed in @ep90
static void writeToResp(javax.servlet.http.HttpServletResponse res, java.lang.String pageStr)
           
 
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, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oldHandler

public static com.groiss.servlet.impl.OldRequestHandler oldHandler

licenceStatus

public static int licenceStatus
Constructor Detail

Dispatcher

public Dispatcher()
Method Detail

init

public void init()
Overrides:
init in class javax.servlet.GenericServlet

setPathInfo

@Deprecated
public void setPathInfo(java.lang.String pi)
Deprecated. use MultipartRequest.setPathInfo(String) instead, will be removed in @ep90

This method is useful if you call the dispatcher servlet from a method already called by the dispatcher.

Parameters:
pi - s string defining the method to call in form classname "." methodname

service

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

writeToResp

public static void writeToResp(javax.servlet.http.HttpServletResponse res,
                               java.lang.String pageStr)
                        throws java.lang.Exception
Throws:
java.lang.Exception

getRequestCount

public static long getRequestCount()
Get the request count for statistics.

Returns:
the counter, starting with 0 on startup.

getMethod

public static java.lang.reflect.Method getMethod(java.lang.String m)
                                          throws java.lang.Exception
Return the method from a string containing the class and method name, syntax: classname "." methodname

Parameters:
m -
Returns:
the method object
Throws:
java.lang.Exception - an exception is thrown if the string describes not a method with the signature necessary for the dispatcher.

reloadClasses

public static void reloadClasses()
Reload the method cache the Dispatcher holds.


setLocale

public static java.util.Locale setLocale(javax.servlet.http.HttpServletRequest req)
Set the locale to the ThreadContext.


getBrowserLocale

public static java.util.Locale getBrowserLocale(javax.servlet.http.HttpServletRequest req)
Read the locale from the browser.


getContextPath

public static java.lang.String getContextPath()
Returns the context path of this application.


addModificationInfo

public static void addModificationInfo(javax.servlet.http.HttpServletRequest req,
                                       javax.servlet.http.HttpServletResponse resp,
                                       long lastModified,
                                       java.util.Locale locale)
adds some header fields to the response so we can determine modification on the next request
adds an ETag and a Last-Modified-Header

Parameters:
req - request
resp - response
lastModified - last modification timestamp
locale - the current locale

isModifiedSince

public static boolean isModifiedSince(javax.servlet.http.HttpServletRequest req,
                                      javax.servlet.http.HttpServletResponse resp,
                                      long lastModified,
                                      java.util.Locale l)
returns true if the requested resource has been modified since the last request
the following methods are used:
  1. check the ETag-header
  2. check the if-modified-since - header

Parameters:
req - request
resp - response
lastModified - last modification timestamp
l - the current locale
Returns:
true if the resource has been modified since the the last request, false otherwise

setExpiresImmediatelyForGuest

public static void setExpiresImmediatelyForGuest(javax.servlet.http.HttpServletRequest req,
                                                 javax.servlet.http.HttpServletResponse res)
if no user is currently logged in, it's required, that some resources are not cached, so the user gets the new files as soon he loggs in

Parameters:
req -
res -


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