Class TomcatRootValve

java.lang.Object
org.apache.catalina.util.LifecycleBase
org.apache.catalina.util.LifecycleMBeanBase
org.apache.catalina.valves.ValveBase
com.evolveum.midpoint.web.boot.TomcatRootValve
All Implemented Interfaces:
MBeanRegistration, org.apache.catalina.Contained, org.apache.catalina.JmxEnabled, org.apache.catalina.Lifecycle, org.apache.catalina.Valve

public class TomcatRootValve extends org.apache.catalina.valves.ValveBase
Tomcat valve used to redirect root (/) URL to real application (/midpoint/). This is needed in Spring boot deployment. Entire midPoint app is deployed under http://.../midpoint/ URL root. But we want users to use http://.../ as well to access the application.

This could not be done with midPoint servlets or servlet filters. The entire midPoint application is under /midpoint/, so the application won't even receive requests to root URL. We need to use dirty Tomcat-specific tricks for this.

Author:
semancik
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.catalina.Lifecycle

    org.apache.catalina.Lifecycle.SingleUse
  • Field Summary

    Fields inherited from class org.apache.catalina.valves.ValveBase

    asyncSupported, container, containerLog, next, sm

    Fields inherited from interface org.apache.catalina.Lifecycle

    AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
  • Constructor Summary

    Constructors
    Constructor
    Description
    TomcatRootValve(String servletPath)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    invoke(org.apache.catalina.connector.Request request, org.apache.catalina.connector.Response response)
     

    Methods inherited from class org.apache.catalina.valves.ValveBase

    backgroundProcess, getContainer, getDomainInternal, getNext, getObjectNameKeyProperties, initInternal, isAsyncSupported, setAsyncSupported, setContainer, setNext, startInternal, stopInternal, toString

    Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase

    destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregister

    Methods inherited from class org.apache.catalina.util.LifecycleBase

    addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TomcatRootValve

      public TomcatRootValve(String servletPath)
  • Method Details

    • invoke

      public void invoke(org.apache.catalina.connector.Request request, org.apache.catalina.connector.Response response) throws IOException, jakarta.servlet.ServletException
      Throws:
      IOException
      jakarta.servlet.ServletException