jetty-servlets migration to jmx annotations
This commit is contained in:
parent
8a1eb4a88a
commit
c92ce4bd1e
|
@ -41,6 +41,8 @@ import org.eclipse.jetty.continuation.Continuation;
|
|||
import org.eclipse.jetty.continuation.ContinuationListener;
|
||||
import org.eclipse.jetty.continuation.ContinuationSupport;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.thread.Timeout;
|
||||
|
@ -113,7 +115,7 @@ import org.eclipse.jetty.util.thread.Timeout;
|
|||
* </dl>
|
||||
* </p>
|
||||
*/
|
||||
|
||||
@ManagedObject("limits exposure to abuse from request flooding, whether malicious, or as a result of a misconfigured client")
|
||||
public class DoSFilter implements Filter
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(DoSFilter.class);
|
||||
|
@ -668,6 +670,7 @@ public class DoSFilter implements Filter
|
|||
*
|
||||
* @return maximum number of requests
|
||||
*/
|
||||
@ManagedAttribute("maximum number of requests allowed from a connection per second")
|
||||
public int getMaxRequestsPerSec()
|
||||
{
|
||||
return _maxRequestsPerSec;
|
||||
|
@ -691,6 +694,7 @@ public class DoSFilter implements Filter
|
|||
* Get delay (in milliseconds) that is applied to all requests
|
||||
* over the rate limit, before they are considered at all.
|
||||
*/
|
||||
@ManagedAttribute("delay applied to all requests over the rate limit (in ms)")
|
||||
public long getDelayMs()
|
||||
{
|
||||
return _delayMs;
|
||||
|
@ -715,6 +719,7 @@ public class DoSFilter implements Filter
|
|||
*
|
||||
* @return maximum wait time
|
||||
*/
|
||||
@ManagedAttribute("maximum time the filter will block waiting throttled connections, (0 for no delay, -1 to reject requests)")
|
||||
public long getMaxWaitMs()
|
||||
{
|
||||
return _maxWaitMs;
|
||||
|
@ -739,6 +744,7 @@ public class DoSFilter implements Filter
|
|||
*
|
||||
* @return number of requests
|
||||
*/
|
||||
@ManagedAttribute("number of requests over rate limit")
|
||||
public int getThrottledRequests()
|
||||
{
|
||||
return _throttledRequests;
|
||||
|
@ -763,6 +769,7 @@ public class DoSFilter implements Filter
|
|||
*
|
||||
* @return wait time
|
||||
*/
|
||||
@ManagedAttribute("amount of time to async wait for semaphore")
|
||||
public long getThrottleMs()
|
||||
{
|
||||
return _throttleMs;
|
||||
|
@ -786,6 +793,7 @@ public class DoSFilter implements Filter
|
|||
*
|
||||
* @return maximum processing time
|
||||
*/
|
||||
@ManagedAttribute("maximum time to allow requests to process (in ms)")
|
||||
public long getMaxRequestMs()
|
||||
{
|
||||
return _maxRequestMs;
|
||||
|
@ -811,6 +819,7 @@ public class DoSFilter implements Filter
|
|||
*
|
||||
* @return maximum tracking time
|
||||
*/
|
||||
@ManagedAttribute("maximum time to track of request rates for connection before discarding")
|
||||
public long getMaxIdleTrackerMs()
|
||||
{
|
||||
return _maxIdleTrackerMs;
|
||||
|
@ -835,6 +844,7 @@ public class DoSFilter implements Filter
|
|||
*
|
||||
* @return value of the flag
|
||||
*/
|
||||
@ManagedAttribute("inser DoSFilter headers in response")
|
||||
public boolean isInsertHeaders()
|
||||
{
|
||||
return _insertHeaders;
|
||||
|
@ -857,6 +867,7 @@ public class DoSFilter implements Filter
|
|||
*
|
||||
* @return value of the flag
|
||||
*/
|
||||
@ManagedAttribute("usage rate is tracked by session if one exists")
|
||||
public boolean isTrackSessions()
|
||||
{
|
||||
return _trackSessions;
|
||||
|
@ -879,6 +890,7 @@ public class DoSFilter implements Filter
|
|||
*
|
||||
* @return value of the flag
|
||||
*/
|
||||
@ManagedAttribute("usage rate is tracked by IP+port is session tracking not used")
|
||||
public boolean isRemotePort()
|
||||
{
|
||||
return _remotePort;
|
||||
|
@ -903,6 +915,7 @@ public class DoSFilter implements Filter
|
|||
*
|
||||
* @return comma-separated whitelist
|
||||
*/
|
||||
@ManagedAttribute("list of IPs that will not be rate limited")
|
||||
public String getWhitelist()
|
||||
{
|
||||
return _whitelistStr;
|
||||
|
|
|
@ -34,6 +34,8 @@ import org.eclipse.jetty.continuation.Continuation;
|
|||
import org.eclipse.jetty.continuation.ContinuationListener;
|
||||
import org.eclipse.jetty.continuation.ContinuationSupport;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
|
||||
/**
|
||||
* Quality of Service Filter.
|
||||
|
@ -70,6 +72,7 @@ import org.eclipse.jetty.server.handler.ContextHandler;
|
|||
*
|
||||
*
|
||||
*/
|
||||
@ManagedObject("Quality of Service Filter")
|
||||
public class QoSFilter implements Filter
|
||||
{
|
||||
final static int __DEFAULT_MAX_PRIORITY=10;
|
||||
|
@ -273,6 +276,7 @@ public class QoSFilter implements Filter
|
|||
*
|
||||
* @return wait time (in milliseconds)
|
||||
*/
|
||||
@ManagedAttribute("(short) amount of time filter will wait before suspending request (in ms)")
|
||||
public long getWaitMs()
|
||||
{
|
||||
return _waitMs;
|
||||
|
@ -297,6 +301,7 @@ public class QoSFilter implements Filter
|
|||
*
|
||||
* @return suspend time (in milliseconds)
|
||||
*/
|
||||
@ManagedAttribute("amount of time filter will suspend a request for while waiting for the semaphore to become available (in ms)")
|
||||
public long getSuspendMs()
|
||||
{
|
||||
return _suspendMs;
|
||||
|
@ -321,6 +326,7 @@ public class QoSFilter implements Filter
|
|||
*
|
||||
* @return maximum number of requests
|
||||
*/
|
||||
@ManagedAttribute("maximum number of requests to allow processing of at the same time")
|
||||
public int getMaxRequests()
|
||||
{
|
||||
return _maxRequests;
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
DoSFilter: Limit exposure to abuse from request flooding, whether malicious, or as a result of a misconfigured client.
|
||||
maxRequestsPerSec: maximum number of requests from a connection per second. Requests in excess of this are first delayed, then throttled.
|
||||
delayMs: delay (in milliseconds) that is applied to all requests over the rate limit, before they are considered at all, 0 - no delay, -1 - reject request.
|
||||
maxWaitMs: maximum amount of time (in milliseconds) the filter will blocking wait for the throttle semaphore.
|
||||
throttledRequests: number of requests over the rate limit able to be considered at once.
|
||||
throttleMs: amount of time (in milliseconds) to async wait for semaphore.
|
||||
maxRequestMs: maximum amount of time (in milliseconds) to allow the request to process.
|
||||
maxIdleTrackerMs: maximum amount of time (in milliseconds) to keep track of request rates for a connection, before deciding that the user has gone away, and discarding it.
|
||||
insertHeaders: insert the DoSFilter headers into the response.
|
||||
trackSessions: usage rate is tracked by session if a session exists.
|
||||
remotePort: usage rate is tracked by IP+port (effectively connection) if session tracking is not used.
|
||||
ipWhitelist: list of IP addresses that will not be rate limited.
|
|
@ -1,4 +0,0 @@
|
|||
QoSFilter: Quality of Service Filter.
|
||||
maxRequests: maximum number of requests allowed to be processedat the same time.
|
||||
waitMs: (short) amount of time (in milliseconds) that the filter would wait for the semaphore to become available before suspending a request.
|
||||
suspendMs: amount of time (in milliseconds) that the filter would suspend a request for while waiting for the semaphore to become available.
|
|
@ -29,4 +29,5 @@ public @interface ManagedObject
|
|||
* @return
|
||||
*/
|
||||
String value() default "Not Specified";
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue