|
||||||||||
| 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
org.mycore.frontend.servlets.MCRServlet
public class MCRServlet
This is the superclass of all MyCoRe servlets. It provides helper methods for logging and managing the current session data. Part of the code has been taken from MilessServlet.java written by Frank Lützenkirchen.
| Field Summary | |
|---|---|
static String |
BASE_URL_ATTRIBUTE
|
protected static Set<String> |
trustedProxies
The IP addresses of trusted web proxies |
| Constructor Summary | |
|---|---|
MCRServlet()
|
|
| Method Summary | |
|---|---|
protected String |
buildRedirectURL(String baseURL,
Properties parameters)
This method builds a URL that can be used to redirect the client browser to another page, thereby including http request parameters. |
void |
doGet(HttpServletRequest req,
HttpServletResponse res)
|
protected void |
doGet(MCRServletJob job)
|
protected void |
doGetPost(MCRServletJob job)
This method should be overwritten by other servlets. |
void |
doPost(HttpServletRequest req,
HttpServletResponse res)
|
protected void |
doPost(MCRServletJob job)
|
protected void |
generateActiveLinkErrorpage(HttpServletRequest request,
HttpServletResponse response,
String msg,
MCRActiveLinkException activeLinks)
|
protected void |
generateErrorPage(HttpServletRequest request,
HttpServletResponse response,
int error,
String msg,
Exception ex,
boolean xmlstyle)
|
static String |
getBaseURL()
returns the base URL of the mycore system |
protected long |
getLastModified(HttpServletRequest request)
allows browser to cache requests. |
static MCRLayoutService |
getLayoutService()
|
static String |
getProperty(HttpServletRequest request,
String name)
|
static String |
getRemoteAddr(HttpServletRequest req)
Returns the IP address of the client that made the request. |
static String |
getServletBaseURL()
returns the servlet base URL of the mycore system |
static MCRSession |
getSession(HttpServletRequest req,
String servletName)
|
protected void |
handleException(Exception ex)
Handles an exception by reporting it and its embedded exception |
void |
init()
|
protected static void |
initTrustedProxies()
Builds a list of trusted proxy IPs from MCR.Request.TrustedProxies. |
protected void |
render(MCRServletJob job,
Exception ex)
2nd phase of doGetPost This method has a seperate transaction and gets the same MCRServletJob from the first phase (think) and any exception that occurs at the first phase. |
protected void |
reportException(Exception ex)
Reports an exception to the log |
protected void |
think(MCRServletJob job)
1st phase of doGetPost. |
| Methods inherited from class javax.servlet.http.HttpServlet |
|---|
doDelete, doHead, doOptions, doPut, doTrace, service, 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 final String BASE_URL_ATTRIBUTE
protected static Set<String> trustedProxies
| Constructor Detail |
|---|
public MCRServlet()
| Method Detail |
|---|
public static MCRLayoutService getLayoutService()
public void init()
throws ServletException
init in class GenericServletServletExceptionpublic static String getBaseURL()
public static String getServletBaseURL()
public void doGet(HttpServletRequest req,
HttpServletResponse res)
throws ServletException,
IOException
doGet in class HttpServletServletException
IOException
protected void doGet(MCRServletJob job)
throws Exception
Exception
public void doPost(HttpServletRequest req,
HttpServletResponse res)
throws ServletException,
IOException
doPost in class HttpServletServletException
IOException
protected void doPost(MCRServletJob job)
throws Exception
Exception
public static MCRSession getSession(HttpServletRequest req,
String servletName)
protected void think(MCRServletJob job)
throws Exception
job -
Exceptionrender(MCRServletJob, Exception)
protected void render(MCRServletJob job,
Exception ex)
throws Exception
job - same instance as of think(MCRServlet job)ex - any exception thrown by think(MCRServletJob) or transaction commit
Exception - if render could not handle ex to produce a nice user page
protected void doGetPost(MCRServletJob job)
throws Exception
Exceptionprotected void handleException(Exception ex)
protected void reportException(Exception ex)
throws Exception
Exception
protected void generateErrorPage(HttpServletRequest request,
HttpServletResponse response,
int error,
String msg,
Exception ex,
boolean xmlstyle)
throws IOException
IOException
protected String buildRedirectURL(String baseURL,
Properties parameters)
baseURL - the base url of the target webpageparameters - the http request parameters
protected void generateActiveLinkErrorpage(HttpServletRequest request,
HttpServletResponse response,
String msg,
MCRActiveLinkException activeLinks)
throws IOException
IOExceptionprotected long getLastModified(HttpServletRequest request)
getLastModified in class HttpServlet
public static String getProperty(HttpServletRequest request,
String name)
protected static void initTrustedProxies()
public static String getRemoteAddr(HttpServletRequest req)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||