protected HTTPMethod getRequestMethod(GHttpEndpoint endpoint, Exchange exchange) { String method = (String)exchange.getIn().getHeader(Exchange.HTTP_METHOD); if (method != null) { return HTTPMethod.valueOf(method); } else if (exchange.getIn().getBody() != null) { return HTTPMethod.POST; } else { return HTTPMethod.GET; } }
HTTPRequestInfo(HTTPRequest req) { method = req.getMethod().toString(); byte[] payload = req.getPayload(); length = payload == null ? -1 : payload.length; url = req.getURL(); h1 = null; h2 = req.getHeaders(); }
public void sendRequestHeader(HttpRequest request) throws HttpException, IOException { try { HttpHost host = route.getTargetHost(); URI uri = new URI(host.getSchemeName() + "://" + host.getHostName() + ((host.getPort() == -1) ? "" : (":" + host.getPort())) + request.getRequestLine().getUri()); this.request = new HTTPRequest(uri.toURL(), HTTPMethod.valueOf(request.getRequestLine().getMethod()), FetchOptions.Builder.disallowTruncate().doNotFollowRedirects()); } catch (URISyntaxException ex) { throw new IOException("Malformed request URI: " + ex.getMessage(), ex); } catch (IllegalArgumentException ex) { throw new IOException("Unsupported HTTP method: " + ex.getMessage(), ex); } // System.err.println("SEND: " + this.request.getMethod() + " " + this.request.getURL()); for (Header h : request.getAllHeaders()) { // System.err.println("SEND: " + h.getName() + ": " + h.getValue()); this.request.addHeader(new HTTPHeader(h.getName(), h.getValue())); } }
public void sendRequestHeader(HttpRequest request) throws HttpException, IOException { try { HttpHost host = route.getTargetHost(); URI uri = new URI(host.getSchemeName() + "://" + host.getHostName() + ((host.getPort() == -1) ? "" : (":" + host.getPort())) + request.getRequestLine().getUri()); this.request = new HTTPRequest(uri.toURL(), HTTPMethod.valueOf(request.getRequestLine().getMethod()), FetchOptions.Builder.disallowTruncate().doNotFollowRedirects()); } catch (URISyntaxException ex) { throw new IOException("Malformed request URI: " + ex.getMessage(), ex); } catch (IllegalArgumentException ex) { throw new IOException("Unsupported HTTP method: " + ex.getMessage(), ex); } // System.err.println("SEND: " + this.request.getMethod() + " " + this.request.getURL()); for (Header h : request.getAllHeaders()) { // System.err.println("SEND: " + h.getName() + ": " + h.getValue()); this.request.addHeader(new HTTPHeader(h.getName(), h.getValue())); } }
HTTPRequest req = new HTTPRequest(reqUrl, HTTPMethod.valueOf(method .toUpperCase())); ByteArrayOutputStream bos = new ByteArrayOutputStream();
options.setDeadline(10.0); HTTPRequest gaeRequest = new HTTPRequest(url, HTTPMethod.valueOf(request.getMethod().toString()), options);
options.setDeadline(10.0); HTTPRequest gaeRequest = new HTTPRequest(url, HTTPMethod.valueOf(request.getMethod().toString()), options);