@Override public HttpMethod method() { return request.method(); }
@Override public HttpMethod getMethod() { return request.method(); }
@Override public HttpMethod getMethod() { return ((HttpRequest) message).method(); }
@Override public HttpMethod getMethod() { return request.method(); }
@Override public HttpMethod method() { return request.method(); }
@Override public HttpMethod method() { return request.method(); }
@Override @Deprecated public HttpMethod getMethod() { return request.method(); }
@Override protected void decode(ChannelHandlerContext ctx, ByteBuf buffer, List<Object> out) throws Exception { int oldSize = out.size(); super.decode(ctx, buffer, out); int size = out.size(); for (int i = oldSize; i < size; i++) { Object obj = out.get(i); if (obj instanceof HttpRequest) { queue.add(((HttpRequest) obj).method()); } } } }
private static void appendInitialLine(StringBuilder buf, HttpRequest req) { buf.append(req.method()); buf.append(' '); buf.append(req.uri()); buf.append(' '); buf.append(req.protocolVersion()); buf.append(StringUtil.NEWLINE); }
@Override protected void decode(ChannelHandlerContext ctx, HttpRequest msg, List<Object> out) throws Exception { CharSequence acceptedEncoding = msg.headers().get(HttpHeaderNames.ACCEPT_ENCODING); if (acceptedEncoding == null) { acceptedEncoding = HttpContentDecoder.IDENTITY; } HttpMethod meth = msg.method(); if (meth == HttpMethod.HEAD) { acceptedEncoding = ZERO_LENGTH_HEAD; } else if (meth == HttpMethod.CONNECT) { acceptedEncoding = ZERO_LENGTH_CONNECT; } acceptEncodingQueue.add(acceptedEncoding); out.add(ReferenceCountUtil.retain(msg)); }
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof HttpLifecycleChannelHandler.CompleteEvent) { // Get the stored request, and remove the attr from channel to cleanup. RequestState state = ctx.channel().attr(ATTR_REQ_STATE).get(); ctx.channel().attr(ATTR_REQ_STATE).set(null); // Response complete, so now write to access log. long durationNs = System.nanoTime() - state.startTimeNs; String remoteIp = ctx.channel().attr(SourceAddressChannelHandler.ATTR_SOURCE_ADDRESS).get(); Integer localPort = ctx.channel().attr(SourceAddressChannelHandler.ATTR_SERVER_LOCAL_PORT).get(); if (state.response == null) { LOG.debug("Response null in AccessLog, Complete reason={}, duration={}, url={}, method={}", ((HttpLifecycleChannelHandler.CompleteEvent)evt).getReason(), durationNs/(1000*1000), state.request != null ? state.request.uri() : "-", state.request != null ? state.request.method() : "-"); } publisher.log(ctx.channel(), state.request, state.response, state.dateTime, localPort, remoteIp, durationNs, state.requestBodySize, state.responseBodySize); } super.userEventTriggered(ctx, evt); } }
@Override protected void decode(ChannelHandlerContext ctx, HttpRequest msg, List<Object> out) { if (LOG.isDebugEnabled()) { LOG.debug("Server {}:{} Received Request: {} {}", embeddedServer.getHost(), embeddedServer.getPort(), msg.method(), msg.uri()); } out.add(new NettyHttpRequest<>(msg, ctx, conversionService, configuration)); } }
private static boolean isPreflightRequest(final HttpRequest request) { final HttpHeaders headers = request.headers(); return request.method().equals(OPTIONS) && headers.contains(HttpHeaderNames.ORIGIN) && headers.contains(HttpHeaderNames.ACCESS_CONTROL_REQUEST_METHOD); }
@Override public Http.RequestMethod method() { return Http.RequestMethod.create(nettyRequest.method().name()); }
/** * @param nettyRequest The Http netty request * @param conversionService The conversion service */ public AbstractNettyHttpRequest(io.netty.handler.codec.http.HttpRequest nettyRequest, ConversionService conversionService) { this.nettyRequest = nettyRequest; this.conversionService = conversionService; String fullUri = nettyRequest.uri(); this.uri = URI.create(fullUri); this.httpMethod = HttpMethod.valueOf(nettyRequest.method().name()); }
private boolean isConnectAlreadyDone(Request request, NettyResponseFuture<?> future) { return future != null && future.getNettyRequest() != null && future.getNettyRequest().getHttpRequest().method() == HttpMethod.CONNECT && !request.getMethod().equals(CONNECT); }
private HandlerHolder lookupHandler(HttpRequest req) { for (HandlerWrapper handler : handlers) { if (handler.httpMethod == req.method()) { Matcher matcher = handler.uriTemplate.matcher(req.uri()); if (matcher.matches()) { Map<String, String> extractedParams = handler.uriTemplate.extractParameters(matcher); return new HandlerHolder(handler, extractedParams); } } } return null; }
private void writeRequest(Channel channel) { if (futureIsAlreadyCancelled(channel)) { return; } if (LOGGER.isDebugEnabled()) { HttpRequest httpRequest = future.getNettyRequest().getHttpRequest(); LOGGER.debug("Using new Channel '{}' for '{}' to '{}'", channel, httpRequest.method(), httpRequest.uri()); } Channels.setAttribute(channel, future); channelManager.registerOpenChannel(channel); future.attachChannel(channel, false); requestSender.writeRequest(future, channel); }
private void invokeHandler(ChannelHandlerContext ctx, HttpRequest req, HandlerWrapper handler, Map<String, String> extractedParams) { log.debug("{} : {}", req.method().name(), req.uri()); try (URIDecoder uriDecoder = new URIDecoder(req, extractedParams)) { Object[] params = handler.fetchParams(ctx, uriDecoder); finishHttp(ctx, uriDecoder, handler, params); } }
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof HttpLifecycleChannelHandler.CompleteEvent) { // Get the stored request, and remove the attr from channel to cleanup. RequestState state = ctx.channel().attr(ATTR_REQ_STATE).get(); ctx.channel().attr(ATTR_REQ_STATE).set(null); // Response complete, so now write to access log. long durationNs = System.nanoTime() - state.startTimeNs; String remoteIp = ctx.channel().attr(SourceAddressChannelHandler.ATTR_SOURCE_ADDRESS).get(); Integer localPort = ctx.channel().attr(SourceAddressChannelHandler.ATTR_SERVER_LOCAL_PORT).get(); if (state.response == null) { LOG.debug("Response null in AccessLog, Complete reason={}, duration={}, url={}, method={}", ((HttpLifecycleChannelHandler.CompleteEvent)evt).getReason(), durationNs/(1000*1000), state.request != null ? state.request.uri() : "-", state.request != null ? state.request.method() : "-"); } publisher.log(ctx.channel(), state.request, state.response, state.dateTime, localPort, remoteIp, durationNs, state.requestBodySize, state.responseBodySize); } super.userEventTriggered(ctx, evt); } }