@Override public boolean resolve(final HttpServerExchange value) { for(final Predicate predicate : predicates) { if(!predicate.resolve(value)) { return false; } } return true; } }
@Override public boolean resolve(final HttpServerExchange value) { return !predicate.resolve(value); } }
@Override public boolean resolve(final HttpServerExchange value) { for (final Predicate predicate : predicates) { if (predicate.resolve(value)) { return true; } } return false; } }
@Override public void handleRequest(final HttpServerExchange exchange) throws Exception { HttpHandler next = predicate.resolve(exchange) ? trueHandler : falseHandler; next.handleRequest(exchange); }
public EncodingMapping getEncoding() { for (EncodingMapping encoding : encodings) { if (encoding.getAllowed() == null || encoding.getAllowed().resolve(exchange)) { return encoding; } } return null; }
@Override public boolean resolve(HttpServerExchange value) { if (value.getResponseHeaders().contains(Headers.CONTENT_LENGTH)) { return this.maxContentSize.resolve(value); } return true; }
@Override public void exchangeEvent(final HttpServerExchange exchange, final NextListener nextListener) { try { if(predicate == null || predicate.resolve(exchange)) { accessLogReceiver.logMessage(tokens.readAttribute(exchange)); } } finally { nextListener.proceed(); } } }
/** * @return The content encoding that will be set, given the current state of the HttpServerExchange */ public String getCurrentContentEncoding() { for (EncodingMapping encoding : encodings) { if (encoding.getAllowed() == null || encoding.getAllowed().resolve(exchange)) { return encoding.getName(); } } return Headers.IDENTITY.toString(); }
@Override public void handleRequest(final HttpServerExchange exchange) throws Exception { if(HttpContinue.requiresContinueResponse(exchange)) { if(accept.resolve(exchange)) { HttpContinue.sendContinueResponse(exchange, new IoCallback() { @Override public void onComplete(final HttpServerExchange exchange, final Sender sender) { exchange.dispatch(next); } @Override public void onException(final HttpServerExchange exchange, final Sender sender, final IOException exception) { UndertowLogger.REQUEST_IO_LOGGER.ioException(exception); exchange.endExchange(); } }); } else { HttpContinue.rejectExchange(exchange); } } else { next.handleRequest(exchange); } }
@Override public void handleRequest(final HttpServerExchange exchange) throws Exception { if(exchange.getRequestMethod().equals(Methods.CONNECT)) { if(!allowed.resolve(exchange)) {
@Override public void handleRequest(HttpServerExchange exchange) throws Exception { PathTemplateMatcher<RoutingMatch> matcher = matches.get(exchange.getRequestMethod()); if (matcher == null) { handleNoMatch(exchange); return; } PathTemplateMatcher.PathMatchResult<RoutingMatch> match = matcher.match(exchange.getRelativePath()); if (match == null) { handleNoMatch(exchange); return; } exchange.putAttachment(PathTemplateMatch.ATTACHMENT_KEY, match); if (rewriteQueryParameters) { for (Map.Entry<String, String> entry : match.getParameters().entrySet()) { exchange.addQueryParam(entry.getKey(), entry.getValue()); } } for (HandlerHolder handler : match.getValue().predicatedHandlers) { if (handler.predicate.resolve(exchange)) { handler.handler.handleRequest(exchange); return; } } if (match.getValue().defaultHandler != null) { match.getValue().defaultHandler.handleRequest(exchange); } else { fallbackHandler.handleRequest(exchange); } }
static void handleFailure(HttpServerExchange exchange, ProxyClientHandler proxyClientHandler, Predicate idempotentRequestPredicate, IOException e) { UndertowLogger.PROXY_REQUEST_LOGGER.proxyRequestFailed(exchange.getRequestURI(), e); if(exchange.isResponseStarted()) { IoUtils.safeClose(exchange.getConnection()); } else if(idempotentRequestPredicate.resolve(exchange) && proxyClientHandler != null) { proxyClientHandler.failed(exchange); //this will attempt a retry if configured to do so } else { exchange.setStatusCode(StatusCodes.SERVICE_UNAVAILABLE); exchange.endExchange(); } }
boolean allowed = false; for(Predicate allow : allowSuspendedRequests) { if(allow.resolve(exchange)) { allowed = true; ServletRequestContext src = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
!(encodingAllowed == null || encodingAllowed.resolve(exchange))) { return null;
if (handler.predicate.resolve(exchange)) { exchange.putAttachment(CURRENT_POSITION, pos + 1); handler.handler.handleRequest(exchange);
@Override public boolean resolve(final HttpServerExchange value) { for (final Predicate predicate : predicates) { if (predicate.resolve(value)) { return true; } } return false; } }
@Override public boolean resolve(final HttpServerExchange value) { return !predicate.resolve(value); } }
@Override public void handleRequest(final HttpServerExchange exchange) throws Exception { HttpHandler next = predicate.resolve(exchange) ? trueHandler : falseHandler; next.handleRequest(exchange); }
public EncodingMapping getEncoding() { for (EncodingMapping encoding : encodings) { if (encoding.getAllowed() == null || encoding.getAllowed().resolve(exchange)) { return encoding; } } return null; }