Class InetAccessHandler
- All Implemented Interfaces:
Handler, Handler.Container, Handler.Singleton, Request.Handler, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle, Invocable
Controls access to the wrapped handler using the real remote IP. Control is
provided by and IncludeExcludeSet over a InetAddressSet. This
handler uses the real internet address of the connection, not one reported in
the forwarded for headers, as this cannot be as easily forged.
-
Nested Class Summary
Nested classes/interfaces inherited from class ConditionalHandler
ConditionalHandler.Abstract, ConditionalHandler.ConnectorPredicate, ConditionalHandler.DontHandle, ConditionalHandler.ElseNext, ConditionalHandler.InetAddressPatternPredicate, ConditionalHandler.MethodPredicate, ConditionalHandler.PathSpecPredicate, ConditionalHandler.PredicateSet, ConditionalHandler.Reject, ConditionalHandler.SkipNextNested classes/interfaces inherited from class Handler.Abstract
Handler.Abstract.NonBlockingNested classes/interfaces inherited from class AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface Dumpable
Dumpable.DumpableContainerNested classes/interfaces inherited from interface Handler
Handler.AbstractContainer, Handler.Collection, Handler.Container, Handler.Sequence, Handler.Singleton, Handler.WrapperNested classes/interfaces inherited from interface Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.TaskNested classes/interfaces inherited from interface LifeCycle
LifeCycle.ListenerNested classes/interfaces inherited from interface Request.Handler
Request.Handler.AbortException -
Field Summary
Fields inherited from interface Invocable
__nonBlocking, NOOP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidExcludes an InetAccess entry pattern with an optional connector name, address and URI mapping.voidExcludes InetAccess patternsvoidExcludes an InetAccess entry.voidIncludes an InetAccess pattern with an optional connector name, address and URI mapping.voidIncludes InetAccess patternsvoidIncludes an InetAccess entry.protected booleanonConditionsMet(Request request, Response response, Callback callback) Handle a request that has met the conditions.protected booleanonConditionsNotMet(Request request, Response response, Callback callback) This method is called when the request has not met the conditions and is not to be handled by this handler.Methods inherited from class ConditionalHandler
clear, doStart, dump, exclude, exclude, exclude, excludeInetAddressPattern, excludeMethod, excludePath, from, from, handle, include, include, include, includeInetAddressPattern, includeMethod, includePath, nextHandlerMethods inherited from class Handler.Wrapper
getHandler, getInvocationType, setHandlerMethods inherited from class Handler.AbstractContainer
findContainerOf, getDescendant, getDescendants, isDynamic, setDynamic, setServerMethods inherited from class Handler.Abstract
destroy, doStop, getServerMethods inherited from class ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Container
getCachedBeans, getEventListenersMethods inherited from interface Destroyable
destroyMethods inherited from interface Dumpable.DumpableContainer
isDumpableMethods inherited from interface Handler.Container
getContainer, getDescendant, getDescendants, getDescendantsMethods inherited from interface Handler.Singleton
getHandlers, getTail, insertHandler, setHandlerMethods inherited from interface LifeCycle
addEventListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, start, stop
-
Constructor Details
-
InetAccessHandler
public InetAccessHandler() -
InetAccessHandler
-
-
Method Details
-
onConditionsMet
protected boolean onConditionsMet(Request request, Response response, Callback callback) throws Exception Description copied from class:ConditionalHandlerHandle a request that has met the conditions. Typically, the implementation will provide optional handling and then call theConditionalHandler.nextHandler(Request, Response, Callback)method to continue handling.- Specified by:
onConditionsMetin classConditionalHandler- Parameters:
request- The request to handleresponse- The response to generatecallback- The callback for completion- Returns:
- True if this handler will complete the callback
- Throws:
Exception- If there is a problem handling- See Also:
-
onConditionsNotMet
protected boolean onConditionsNotMet(Request request, Response response, Callback callback) throws Exception Description copied from class:ConditionalHandlerThis method is called when the request has not met the conditions and is not to be handled by this handler. Implementations may return false; send an error response; or handle the request differently.- Specified by:
onConditionsNotMetin classConditionalHandler- Parameters:
request- The request to handleresponse- The response to generatecallback- The callback for completion- Returns:
- True if this handler will complete the callback
- Throws:
Exception- If there is a problem handling- See Also:
-
include
Includes an InetAccess pattern with an optional connector name, address and URI mapping.The connector name is separated from the InetAddress pattern with an '@' character, and the InetAddress pattern is separated from the URI pattern using the "|" (pipe) character. URI patterns follow the servlet specification for simple * prefix and suffix wild cards (e.g. /, /foo, /foo/bar, /foo/bar/*, *.baz).
Examples:- "connector1@127.0.0.1|/foo"
- "127.0.0.1|/foo"
- "connector1@127.0.0.1"
- "127.0.0.1"
- Parameters:
pattern- InetAccess pattern to include- See Also:
-
include
Includes InetAccess patterns- Parameters:
patterns- InetAddress patterns to include- See Also:
-
include
-
exclude
Excludes an InetAccess entry pattern with an optional connector name, address and URI mapping.The connector name is separated from the InetAddress pattern with an '@' character, and the InetAddress pattern is separated from the URI pattern using the "|" (pipe) character. A method name is separated from the URI pattern using the ">" character. URI patterns follow the servlet specification for simple * prefix and suffix wild cards (e.g. /, /foo, /foo/bar, /foo/bar/*, *.baz).
Examples:- "connector1@127.0.0.1|/foo"
- "127.0.0.1|/foo"
- "127.0.0.1>GET|/foo"
- "127.0.0.1>GET"
- "connector1@127.0.0.1"
- "127.0.0.1"
- Parameters:
pattern- InetAddress pattern to exclude- See Also:
-
exclude
Excludes InetAccess patterns- Parameters:
patterns- InetAddress patterns to exclude- See Also:
-
exclude
-