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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Throwable
    Convert the given exception in order to avoid sending back an exception that the client might not know!
    protected void
    doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
     
    protected void
    doPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
     
    net.codecadenza.runtime.transport.MarshalledInvocationResult
    invoke(String serviceName, String methodName, Object... args)
    Invoke the service method
    protected abstract boolean
    login(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String userName, String password)
     
    protected abstract void
    logout(jakarta.servlet.http.HttpServletRequest request)
     
    protected abstract Object
    lookup(Class<?> serviceInterface)
    The implementation class is responsible for defining how to search for a given service
    protected void
    processRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
    Process the request

    Methods inherited from class jakarta.servlet.http.HttpServlet

    doDelete, doHead, doOptions, doPut, doTrace, getLastModified, init, service, service

    Methods inherited from class jakarta.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
  • Constructor Details

    • AbstractInvocationServlet

      public AbstractInvocationServlet()
  • Method Details

    • lookup

      protected abstract Object lookup(Class<?> serviceInterface)
      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

      protected Throwable convertException(Throwable rootCause)
      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 interface
      methodName - the method name
      args - 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 object
      response - 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:
      doGet in class jakarta.servlet.http.HttpServlet
      Throws:
      jakarta.servlet.ServletException
      IOException
    • doPost

      protected void doPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException
      Overrides:
      doPost in class jakarta.servlet.http.HttpServlet
      Throws:
      jakarta.servlet.ServletException
      IOException