@Override public String readAttribute(final HttpServerExchange exchange) { return exchange.getProtocol().toString(); }
@Override public String protocol() { return exchange.getProtocol().toString(); }
@Override public String readAttribute(final HttpServerExchange exchange) { StringBuilder sb = new StringBuilder() .append(exchange.getRequestMethod().toString()) .append(' ') .append(exchange.getRequestURI()); if (!exchange.getQueryString().isEmpty()) { sb.append('?'); sb.append(exchange.getQueryString()); } sb.append(' ') .append(exchange.getProtocol().toString()).toString(); return sb.toString(); }
@Override public void handleRequest(final HttpServerExchange exchange) throws Exception { if(exchange.getRequestMethod().equals(Methods.TRACE)) { exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "message/http"); StringBuilder body = new StringBuilder("TRACE "); body.append(exchange.getRequestURI()); if(!exchange.getQueryString().isEmpty()) { body.append('?'); body.append(exchange.getQueryString()); } body.append(' '); body.append(exchange.getProtocol().toString()); body.append("\r\n"); for(HeaderValues header : exchange.getRequestHeaders()) { for(String value : header) { body.append(header.getHeaderName()); body.append(": "); body.append(value); body.append("\r\n"); } } body.append("\r\n"); exchange.getResponseSender().send(body.toString()); } else { handler.handleRequest(exchange); } }
/** * Returns true if this exchange requires the server to send a 100 (Continue) response. * * @param exchange The exchange * @return <code>true</code> if the server needs to send a continue response */ public static boolean requiresContinueResponse(final HttpServerExchange exchange) { if (!COMPATIBLE_PROTOCOLS.contains(exchange.getProtocol()) || exchange.isResponseStarted() || !exchange.getConnection().isContinueResponseSupported() || exchange.getAttachment(ALREADY_SENT) != null) { return false; } HeaderMap requestHeaders = exchange.getRequestHeaders(); return requiresContinueResponse(requestHeaders); }
sb.append(" protocol=" + exchange.getProtocol() + "\n"); sb.append(" queryString=" + exchange.getQueryString() + "\n"); sb.append(" remoteAddr=" + exchange.getSourceAddress() + "\n");
if(httpServerExchange.getProtocol() == Protocols.HTTP_2_0) { free = handleHttp2PriorKnowledge(pooled, httpServerExchange); return; HttpString protocol = httpServerExchange.getProtocol(); if(protocol != Protocols.HTTP_1_1 && protocol != Protocols.HTTP_1_0 && protocol != Protocols.HTTP_0_9) { UndertowLogger.REQUEST_IO_LOGGER.debugf("Closing connection from %s due to unknown protocol %s", connection.getChannel().getPeerAddress(), protocol); return; if(requireHostHeader && httpServerExchange.getProtocol().equals(Protocols.HTTP_1_1)) { if(host == null || host.size() ==0 || host.getFirst().isEmpty()) { sendBadRequestAndClose(connection.getChannel(), UndertowMessages.MESSAGES.noHostInHttp11Request());
newExchange.getRequestHeaders().putAll(header, exchange.getRequestHeaders().get(header)); newExchange.setProtocol(exchange.getProtocol()); newExchange.setRequestMethod(exchange.getRequestMethod()); exchange.setRequestURI(exchange.getRequestURI(), exchange.isHostIncludedInRequestURI());
newExchange.getRequestHeaders().putAll(header, exchange.getRequestHeaders().get(header)); newExchange.setProtocol(exchange.getProtocol()); newExchange.setRequestMethod(exchange.getRequestMethod()); exchange.setRequestURI(exchange.getRequestURI(), exchange.isHostIncludedInRequestURI());
@Override public String getProtocol() { return undertowExchange.getProtocol().toString(); }
@Override public String readAttribute(final HttpServerExchange exchange) { return exchange.getProtocol().toString(); }
@Override public String getProtocol() { return exchange.getProtocol().toString(); }
@Override public String readAttribute(final HttpServerExchange exchange) { return exchange.getProtocol().toString(); }
@Override public String protocol() { return exchange.getProtocol().toString(); }
public String protocol() { return exchange.getProtocol().toString(); }
public String protocol() { return exchange.getProtocol().toString(); }
@Override public String readAttribute(final HttpServerExchange exchange) { StringBuilder sb = new StringBuilder() .append(exchange.getRequestMethod().toString()) .append(' ') .append(exchange.getRequestURI()); if (!exchange.getQueryString().isEmpty()) { sb.append('?'); sb.append(exchange.getQueryString()); } sb.append(' ') .append(exchange.getProtocol().toString()).toString(); return sb.toString(); }
@Override public String readAttribute(final HttpServerExchange exchange) { StringBuilder sb = new StringBuilder() .append(exchange.getRequestMethod().toString()) .append(' ') .append(ServletRequestURLAttribute.INSTANCE.readAttribute(exchange)); if (!exchange.getQueryString().isEmpty()) { sb.append('?'); sb.append(exchange.getQueryString()); } sb.append(' ') .append(exchange.getProtocol().toString()).toString(); return sb.toString(); }
/** * Returns true if this exchange requires the server to send a 100 (Continue) response. * * @param exchange The exchange * @return <code>true</code> if the server needs to send a continue response */ public static boolean requiresContinueResponse(final HttpServerExchange exchange) { if (!COMPATIBLE_PROTOCOLS.contains(exchange.getProtocol()) || exchange.isResponseStarted() || !exchange.getConnection().isContinueResponseSupported() || exchange.getAttachment(ALREADY_SENT) != null) { return false; } HeaderMap requestHeaders = exchange.getRequestHeaders(); return requiresContinueResponse(requestHeaders); }
/** * Returns true if this exchange requires the server to send a 100 (Continue) response. * * @param exchange The exchange * @return <code>true</code> if the server needs to send a continue response */ public static boolean requiresContinueResponse(final HttpServerExchange exchange) { if (!COMPATIBLE_PROTOCOLS.contains(exchange.getProtocol()) || exchange.isResponseStarted() || !exchange.getConnection().isContinueResponseSupported() || exchange.getAttachment(ALREADY_SENT) != null) { return false; } HeaderMap requestHeaders = exchange.getRequestHeaders(); return requiresContinueResponse(requestHeaders); }