|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.groiss.servlet.Dispatcher
public class Dispatcher
This servlet calls methods via reflection.
| Field Summary | |
|---|---|
static com.groiss.servlet.impl.OldRequestHandler |
oldHandler
|
| Constructor Summary | |
|---|---|
Dispatcher()
|
|
| Method Summary | |
|---|---|
static void |
addModificationInfo(HttpServletRequest req,
HttpServletResponse resp,
long lastModified,
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 Locale |
getBrowserLocale(HttpServletRequest req)
Read the locale from the browser. |
static String |
getContextPath()
Returns the context path of this application. |
static Method |
getMethod(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(HttpServletRequest req,
HttpServletResponse resp,
long lastModified,
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(HttpServletRequest req,
HttpServletResponse res)
|
static void |
setExpiresImmediatelyForGuest(HttpServletRequest req,
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 Locale |
setLocale(HttpServletRequest req)
Set the locale to the ThreadContext. |
void |
setPathInfo(String pi)
This method is useful if you call the dispatcher servlet from a method already called by the dispatcher. |
static void |
writeToResp(HttpServletResponse res,
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 |
|---|
public static com.groiss.servlet.impl.OldRequestHandler oldHandler
| Constructor Detail |
|---|
public Dispatcher()
| Method Detail |
|---|
public void init()
init in class GenericServletpublic void setPathInfo(String pi)
pi - s string defining the method to call in form classname "." methodname
public void service(HttpServletRequest req,
HttpServletResponse res)
throws IOException,
UnsupportedEncodingException
service in class HttpServletIOException
UnsupportedEncodingException
public static void writeToResp(HttpServletResponse res,
String pageStr)
throws Exception
Exceptionpublic static long getRequestCount()
public static Method getMethod(String m)
throws Exception
m -
Exception - an exception is thrown if the string describes not a method with the signature necessary for the dispatcher.public static void reloadClasses()
public static Locale setLocale(HttpServletRequest req)
public static Locale getBrowserLocale(HttpServletRequest req)
public static String getContextPath()
public static void addModificationInfo(HttpServletRequest req,
HttpServletResponse resp,
long lastModified,
Locale locale)
ETag and a Last-Modified-Header
req - requestresp - responselastModified - last modification timestamplocale - the current locale
public static boolean isModifiedSince(HttpServletRequest req,
HttpServletResponse resp,
long lastModified,
Locale l)
true if the requested resource has been modified since the last request ETag-headerif-modified-since - header
req - requestresp - responselastModified - last modification timestampl - the current locale
true if the resource has been modified since the the last request, false otherwise
public static void setExpiresImmediatelyForGuest(HttpServletRequest req,
HttpServletResponse res)
req - res -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||