public class MMBaseServlet extends javax.servlet.http.HttpServlet implements MMBaseStarter
| Modifier and Type | Field and Description |
|---|---|
protected MMBase |
mmbase
MMBase reference.
|
protected int |
retryAfter
If MMBase has not been started, a 503 is given, with this value for the 'Retry-After' header.
|
| Constructor and Description |
|---|
MMBaseServlet() |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
associateMapping(String function,
String servletMapping,
Integer priority)
Associate a given servletmapping with the given function.
|
protected boolean |
checkInited(javax.servlet.http.HttpServletResponse res)
This methods can be (and is) called in the beginning of
service.
|
protected void |
decRefCount(javax.servlet.http.HttpServletRequest req)
Decrease the reference count of the servlet
|
void |
destroy() |
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Serves MMBase version information.
|
protected Map<String,Integer> |
getAssociations()
On default, servlets are not associated with any function.
|
static String |
getBasePath(String function) |
MMBase |
getMMBase()
Returns the MMBase instance.
|
protected static String |
getRequestURL(javax.servlet.http.HttpServletRequest req)
Return URI with QueryString appended
|
static String |
getServletByAssociation(String function)
Gets the name of the servlet that performs actions associated with the
the given function.
|
static javax.servlet.http.HttpServlet |
getServletByMapping(String mapping)
Gets the servlet that belongs to the given mapping
|
String |
getServletInfo()
Returns information about this servlet.
|
static List<String> |
getServletMappings(String servletName)
Gets all the mappings for a given servlet.
|
static List<String> |
getServletMappingsByAssociation(String function)
Gets all the mappings for a given association.
|
protected void |
incRefCount(javax.servlet.http.HttpServletRequest req)
Increase the reference count of the servlet (for debugging)
and send running servlets to log once every 32 requests
|
void |
init()
The init of an MMBaseServlet checks if MMBase is running.
|
void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
The service method is extended with calls for the refCount
functionality (for performance related debugging).
|
void |
setInitException(javax.servlet.ServletException e)
Called by MMBaseStartThread, if something went wrong during
initialization of MMBase.
|
void |
setMMBase(MMBase mmb)
Sets the mmbase member.
|
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, serviceprotected MMBase mmbase
protected int retryAfter
protected Map<String,Integer> getAssociations()
public MMBase getMMBase()
getMMBase in interface MMBaseStarterpublic void setMMBase(MMBase mmb)
setMMBase in interface MMBaseStarterpublic void setInitException(javax.servlet.ServletException e)
setInitException in interface MMBaseStarterpublic void init()
throws javax.servlet.ServletException
init in class javax.servlet.GenericServletjavax.servlet.ServletExceptionpublic static javax.servlet.http.HttpServlet getServletByMapping(String mapping)
mapping - the mapping used to access the servletpublic static List<String> getServletMappings(String servletName)
servletName - the name of the servletpublic static List<String> getServletMappingsByAssociation(String function)
function - the function that identifies the type of associationpublic static String getServletByAssociation(String function)
function - the function that identifies the type of associationprotected static void associateMapping(String function, String servletMapping, Integer priority)
function - the function that identifies the type of associationservletMapping - mapping of the servlet to associate with the functionpriority - priority of this association, the association only occurs if no servlet or servletmapping
with higher priority for the same function is present alreadyprotected void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
IOException
doGet in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionprotected boolean checkInited(javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
IOException
javax.servlet.ServletExceptionIOExceptionpublic void service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
IOException
service in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionpublic String getServletInfo()
getServletInfo in interface javax.servlet.ServletgetServletInfo in class javax.servlet.GenericServletprotected static String getRequestURL(javax.servlet.http.HttpServletRequest req)
req - The HttpServletRequest.protected void decRefCount(javax.servlet.http.HttpServletRequest req)
req - The HttpServletRequest.protected void incRefCount(javax.servlet.http.HttpServletRequest req)
req - The HttpServletRequest.public void destroy()
destroy in interface javax.servlet.Servletdestroy in class javax.servlet.GenericServletMMBase 1.9-SNAPSHOT - ${javadoctimestamp}