/** * Creates a new path handler, with the default handler specified * * @param defaultHandler The default handler * @return A new path handler */ public static PathHandler path(final HttpHandler defaultHandler) { return new PathHandler(defaultHandler); }
/** * Returns a new handler that can be used to wait for all requests to finish before shutting down the server gracefully. * * @param next The next http handler * @return The graceful shutdown handler */ public static GracefulShutdownHandler gracefulShutdown(HttpHandler next) { return new GracefulShutdownHandler(next); }
/** * Add a protocol to this handler. * * @param productString the product string to match * @param openListener the open listener to call * @param handshake a handshake implementation that can be used to verify the client request and modify the response */ public synchronized void addProtocol(String productString, HttpUpgradeListener openListener, final HttpUpgradeHandshake handshake) { addProtocol(productString, openListener, null, handshake); }
/** * Creates a new virtual host handler * * @return A new virtual host handler */ public static NameVirtualHostHandler virtualHost() { return new NameVirtualHostHandler(); }
@Override public HttpHandler wrap(HttpHandler handler) { return new MetricsHandler(handler); } };
@Override public HttpHandler wrap(HttpHandler handler) { return new SetAttributeHandler(handler, attribute, value, preCommit == null ? false : preCommit); } };
/** * * @return a new path template handler */ public static PathTemplateHandler pathTemplate() { return new PathTemplateHandler(); }
@Override public HttpHandler wrap(HttpHandler handler) { return new HttpContinueAcceptingHandler(handler, predicate); } }
/** * Creates a handler that automatically learns which resources to push based on the referer header * * @param maxEntries The maximum number of entries to store * @param maxAge The maximum age of the entries * @param next The next handler * @return A caching push handler */ public static LearningPushHandler learningPushHandler(int maxEntries, int maxAge, HttpHandler next) { return new LearningPushHandler(maxEntries, maxAge, next); }
@Override public HttpHandler wrap(HttpHandler handler) { return new DisableCacheHandler(handler); } }
@Override public HttpHandler wrap(HttpHandler handler) { return new ResponseRateLimitingHandler(handler, bytes, time, TimeUnit.MILLISECONDS); } }
@Override public HttpHandler wrap(HttpHandler handler) { return new PathSeparatorHandler(handler); } }
@Override public HttpHandler wrap(HttpHandler handler) { return new ForwardedHandler(handler); } };
/** * Adds an denied user agent to the ACL list * <p> * User agent may be given as regex * * @param pattern The user agent to add to the ACL */ public AccessControlListHandler addDeny(final String pattern) { return addRule(pattern, true); }
/** * Returns a new handler that decodes the URL and query parameters into the specified charset, assuming it * has not already been done by the connector. For this handler to take effect the parameter * {@link UndertowOptions#DECODE_URL} must have been set to false. * * @param charset The charset to decode * @param next The next handler * @return A handler that decodes the URL */ public static HttpHandler urlDecodingHandler(final String charset, final HttpHandler next) { return new URLDecodingHandler(next, charset); }
@Override public HttpHandler wrap(HttpHandler handler) { return new PeerNameResolvingHandler(handler); } }
/** * Add a protocol to this handler. * * @param productString the product string to match * @param openListener the open listener to call */ public void addProtocol(String productString, HttpUpgradeListener openListener) { addProtocol(productString, openListener, null); }
/** * Returns a handler that sends back a HTTP 100 continue response to all requests. * * This handler differs from the one returned by {@link #httpContinueRead(io.undertow.server.HttpHandler)} in * that it will eagerly send the response, and not wait for the first read attempt. * * @param next The next handler * @return The accepting handler */ public static final HttpContinueAcceptingHandler httpContinueAccepting(final HttpHandler next) { return new HttpContinueAcceptingHandler(next); }
/** * Creates a handler that automatically learns which resources to push based on the referer header * * @param maxEntries The maximum number of entries to store * @param next The next handler * @return A caching push handler */ public static LearningPushHandler learningPushHandler(int maxEntries, HttpHandler next) { return new LearningPushHandler(maxEntries, -1, next); }