Package de.elo.ix.client.webapp.servlet
Class IXClientServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
de.elo.ix.client.webapp.servlet.IXClientServlet
- All Implemented Interfaces:
de.elo.utils.webapp.status.StatusPageHandler.StatusDataCallback
,jakarta.servlet.Servlet
,jakarta.servlet.ServletConfig
,Serializable
- Direct Known Subclasses:
IXClientServletUniqueConnection
public abstract class IXClientServlet
extends jakarta.servlet.http.HttpServlet
implements de.elo.utils.webapp.status.StatusPageHandler.StatusDataCallback
This class can be used as a base class for a servlet that uses Indexserver connections. The
inherited servlet class cannot override the init, service and destroy methods. It should override
the IXClientServlet_init, IXClientServlet_service and IXClientServlet_destroy functions instead.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault-constructor.IXClientServlet
(String programName, String programVersion, String mainPackage) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
destroy()
Get application objectfinal void
init
(jakarta.servlet.ServletConfig config) void
initApplication
(String programName, String programVersion, String mainPackage) Initialize the internally used IXClientServletHandler.protected abstract void
This mehtod has to be implemented to cleanup resources.protected abstract void
IXClientServlet_init
(jakarta.servlet.ServletConfig config) Initialization should be done in this function rather than in an override of Servlet.init.protected boolean
IXClientServlet_service
(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) Process an HTTP-Request.protected final void
service
(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) abstract de.elo.utils.webapp.status.StatusData
StatusPageHandler_updateStatusData
(boolean isAuth) Subclasses have to implement this function in order to update the status data before it is printed.Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
Methods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
IXClientServlet
public IXClientServlet()Default-constructor. Before this object can be used, the function initHandler must be called. -
IXClientServlet
Constructor. Either the programVersion or the mainPackage parameter should be supplied. If mainPackage is supplied, the programVersion is internally evaluated by using the de.elo.utils.Version class.- Parameters:
programName
- Program name (e.g. used on the status page)programVersion
- Program version (e.g. used on the status page)mainPackage
- Main package name
-
-
Method Details
-
IXClientServlet_init
protected abstract void IXClientServlet_init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException Initialization should be done in this function rather than in an override of Servlet.init. This ensures that the internally used IXClientServieeHandler is initialized. Furthermore Logging.get().ndc().push is used to identify the logger output.- Parameters:
config
- ServletConfig object- Throws:
jakarta.servlet.ServletException
-
IXClientServlet_destroy
protected abstract void IXClientServlet_destroy()This mehtod has to be implemented to cleanup resources. The Servlet.destroy method should not be overriden by subclasses. -
IXClientServlet_service
protected boolean IXClientServlet_service(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException Process an HTTP-Request. If the function has processed the request, it has to return true. The function must not call Servlet.service. This will be internally done, if the function returns false.- Parameters:
req
- HTTP requestresp
- HTTP response- Returns:
- true, if the request has been processed.
- Throws:
jakarta.servlet.ServletException
IOException
-
StatusPageHandler_updateStatusData
public abstract de.elo.utils.webapp.status.StatusData StatusPageHandler_updateStatusData(boolean isAuth) throws IOException Subclasses have to implement this function in order to update the status data before it is printed.- Specified by:
StatusPageHandler_updateStatusData
in interfacede.elo.utils.webapp.status.StatusPageHandler.StatusDataCallback
- Parameters:
isAuth
- authentication was successful- Throws:
IOException
-
init
public final void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException - Specified by:
init
in interfacejakarta.servlet.Servlet
- Overrides:
init
in classjakarta.servlet.GenericServlet
- Throws:
jakarta.servlet.ServletException
-
service
protected final void service(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException - Overrides:
service
in classjakarta.servlet.http.HttpServlet
- Throws:
jakarta.servlet.ServletException
IOException
-
destroy
public final void destroy()- Specified by:
destroy
in interfacejakarta.servlet.Servlet
- Overrides:
destroy
in classjakarta.servlet.GenericServlet
-
getApplication
Get application object- Returns:
- Object
-
initApplication
Initialize the internally used IXClientServletHandler. Either the programVersion or the mainPackage parameter should be supplied. If mainPackage is supplied, the programVersion is internally evaluated by using the de.elo.utils.Version class.- Parameters:
programName
- Program name (e.g. used on the status page)programVersion
- Program version (e.g. used on the status page)mainPackage
- Main package name
-