net.i2p.servlet.filters

## Class XI2PLocationFilter

- java.lang.Object
- - org.eclipse.jetty.util.component.AbstractLifeCycle
  - - org.eclipse.jetty.util.component.ContainerLifeCycle
    - - org.eclipse.jetty.server.handler.AbstractHandler
      - - org.eclipse.jetty.server.handler.AbstractHandlerContainer
        - - org.eclipse.jetty.server.handler.HandlerWrapper
          - - net.i2p.servlet.filters.XI2PLocationFilter

- All Implemented Interfaces:
    Handler, HandlerContainer, Container, Destroyable, Dumpable, LifeCycle

      public class XI2PLocationFilter
      extends HandlerWrapper

  Adds a header, X-I2P-Location, to requests when they do **not** come in on an I2P hostname. This header contains a URL that looks like: [scheme://][i2phostname.i2p][/path][?query] and expresses the I2P-Equivalent URL of the clearnet query. Clients can use this to prompt users to switch from a non-I2P host to an I2P host or to redirect them automatically. It automatically enabled on the default I2P site located on port 7658 by default.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `AbstractLifeCycle.AbstractLifeCycleListener`

    - ### Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

      `LifeCycle.Listener`

    - ### Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container

      `Container.InheritedListener, Container.Listener`

  - ### Field Summary

    - ### Fields inherited from class org.eclipse.jetty.server.handler.HandlerWrapper

      `_handler`

    - ### Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `FAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XI2PLocationFilter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)`

    - ### Methods inherited from class org.eclipse.jetty.server.handler.HandlerWrapper

      `destroy, expandChildren, getHandler, getHandlers, insertHandler, setHandler`

    - ### Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandlerContainer

      `expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass, setServer`

    - ### Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandler

      `doStart, doStop, dumpThis, getServer`

    - ### Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle

      `addBean, addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans`

    - ### Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle

      `addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

- - ### Constructor Detail

    - #### XI2PLocationFilter

          public XI2PLocationFilter()

  - ### Method Detail

    - #### handle

          public void handle(String target,
                             Request request,
                             HttpServletRequest httpRequest,
                             HttpServletResponse httpResponse)
                      throws IOException,
                             ServletException

      Specified by:
        `handle` in interface `Handler`
      Overrides:
        `handle` in class `HandlerWrapper`
      Throws:
        `IOException`
        `ServletException`