@Override protected HttpMessage createMessage(String[] initialLine) throws Exception { return new DefaultHttpRequest( HttpVersion.valueOf(initialLine[2]), HttpMethod.valueOf(initialLine[0]), initialLine[1]); }
/** * Returns the {@link HttpMethod} represented by the HTTP method header. */ public static HttpMethod getMethod(int spdyVersion, SpdyHeadersFrame frame) { try { return HttpMethod.valueOf(frame.headers().get(HttpNames.METHOD)); } catch (Exception e) { return null; } }
/** * Creates the {@link HttpMethod} to use to call the remote server, often either its GET or POST. * * @param message the Camel message * @return the created method */ public static HttpMethod createMethod(Message message, boolean hasPayload) { // use header first HttpMethod m = message.getHeader(Exchange.HTTP_METHOD, HttpMethod.class); if (m != null) { return m; } String name = message.getHeader(Exchange.HTTP_METHOD, String.class); if (name != null) { return HttpMethod.valueOf(name); } if (hasPayload) { // use POST if we have payload return HttpMethod.POST; } else { // fallback to GET return HttpMethod.GET; } }
private DefaultHttpClientRequest(final DefaultHttpClient client, final String method, final String uri, final Handler<HttpClientResponse> respHandler, final Context context, final boolean raw) { this.client = client; this.request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.valueOf(method), uri); this.chunked = false; this.respHandler = respHandler; this.context = context; this.raw = raw; }
public NettyRequest newNettyRequest(Request request, Uri uri, boolean forceConnect, ProxyServer proxyServer) throws IOException { HttpMethod method = forceConnect ? HttpMethod.CONNECT : HttpMethod.valueOf(request.getMethod()); boolean connect = method == HttpMethod.CONNECT;
@Override public void encode(Channel channel) throws Exception { HttpChannelConfig httpConfig = (HttpChannelConfig) channel.getConfig(); ChannelBufferFactory bufferFactory = httpConfig.getBufferFactory(); String methodName = methodEncoder.encode(bufferFactory).toString(US_ASCII); HttpMethod method = HttpMethod.valueOf(methodName); httpConfig.setMethod(method); }
@Override public void onReceive(ActorRef sender, HttpRequest message) throws Exception { // run the request via ning and return the response async HttpMethod method = HttpMethod.valueOf(message.getMethod()); if(HttpMethod.GET.equals(method)) { setHeaders(httpClient.prepareGet(message.getUrl()),message.getHeaders()) .execute(new ResponseHandler(getSelf(), sender)); } else if(HttpMethod.POST.equals(method)) { setHeaders(httpClient.preparePost(message.getUrl()),message.getHeaders()) .setBody(message.getContent()) .execute(new ResponseHandler(getSelf(), sender)); } else { logger.error("Unhandled request method: "+method); } }
@Override public void onReceive(ActorRef sender, HttpRequest message) throws Exception { // run the request via ning and return the response async HttpMethod method = HttpMethod.valueOf(message.getMethod()); if(HttpMethod.GET.equals(method)) { setHeaders(httpClient.prepareGet(message.getUrl()),message.getHeaders()) .execute(new ResponseHandler(getSelf(), sender)); } else if(HttpMethod.POST.equals(method)) { setHeaders(httpClient.preparePost(message.getUrl()),message.getHeaders()) .setBody(message.getContent()) .execute(new ResponseHandler(getSelf(), sender)); } else { logger.error("Unhandled request method: "+method); } }
public NettyRequest newNettyRequest(Request request, boolean forceConnect, ProxyServer proxyServer) { HttpMethod method = forceConnect ? HttpMethod.CONNECT : HttpMethod.valueOf(request.getMethod()); boolean connect = method == HttpMethod.CONNECT;
public NettyRequest newNettyRequest(Request request, Uri uri, boolean forceConnect, ProxyServer proxyServer) throws IOException { HttpMethod method = forceConnect ? HttpMethod.CONNECT : HttpMethod.valueOf(request.getMethod()); boolean connect = method == HttpMethod.CONNECT;
public NettyRequest newNettyRequest(Request request, UriComponents uri, boolean forceConnect, ProxyServer proxyServer) throws IOException { HttpMethod method = forceConnect ? HttpMethod.CONNECT : HttpMethod.valueOf(request.getMethod()); HttpVersion httpVersion = method == HttpMethod.CONNECT ? HttpVersion.HTTP_1_0 : HttpVersion.HTTP_1_1; String requestUri = requestUri(uri, proxyServer, method);