Class AbstractInvocationServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
net.codecadenza.runtime.server.transport.AbstractInvocationServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
public abstract class AbstractInvocationServlet
extends jakarta.servlet.http.HttpServlet
Server side interface that a client uses for communication
Copyright 2025 (C) by Martin Ganserer
- Version:
- 1.0.0
- Author:
- Martin Ganserer
- See Also:
-
Field Summary
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ThrowableconvertException(Throwable rootCause) Convert the given exception in order to avoid sending back an exception that the client might not know!protected voiddoGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) protected voiddoPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) net.codecadenza.runtime.transport.MarshalledInvocationResultInvoke the service methodprotected abstract booleanlogin(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String userName, String password) protected abstract voidlogout(jakarta.servlet.http.HttpServletRequest request) protected abstract ObjectThe implementation class is responsible for defining how to search for a given serviceprotected voidprocessRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Process the requestMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, init, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
AbstractInvocationServlet
public AbstractInvocationServlet()
-
-
Method Details
-
lookup
The implementation class is responsible for defining how to search for a given service- Parameters:
serviceInterface-- Returns:
- the service bean
-
login
protected abstract boolean login(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String userName, String password) - Parameters:
request-response-userName-password-- Returns:
- true if the login was successful
-
logout
protected abstract void logout(jakarta.servlet.http.HttpServletRequest request) - Parameters:
request-
-
convertException
Convert the given exception in order to avoid sending back an exception that the client might not know!- Parameters:
rootCause-- Returns:
- the converted exception
-
invoke
public net.codecadenza.runtime.transport.MarshalledInvocationResult invoke(String serviceName, String methodName, Object... args) Invoke the service method- Parameters:
serviceName- the fully qualified class name of the service interfacemethodName- the method nameargs- the method arguments- Returns:
- the result object that should be send back to the client containing the method's return value or an exception that has been thrown
-
processRequest
protected void processRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException Process the request- Parameters:
request- the HTTP request objectresponse- the HTTP response object- Throws:
IOException- if sending of an error has failed
-
doGet
protected void doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException - Overrides:
doGetin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
doPost
protected void doPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException - Overrides:
doPostin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-