List of usage examples for org.apache.http.message BasicHeader BasicHeader
public BasicHeader(String str, String str2)
From source file:com.betfair.cougar.client.DefaultGeoLocationSerializer.java
@Override public void serialize(GeoLocationDetails gld, List<Header> result) { if (gld != null) { String ipAddressList = RemoteAddressUtils.externaliseWithLocalAddresses(gld.getResolvedAddresses()); if (ipAddressList != null && !ipAddressList.isEmpty()) { result.add(new BasicHeader("X-Forwarded-For", ipAddressList)); }// w w w . j ava2 s .com } }
From source file:org.elasticsearch.http.CorsNotSetIT.java
public void testCorsSettingDefaultBehaviourDoesNotReturnAnything() throws IOException { String corsValue = "http://localhost:9200"; Response response = getRestClient().performRequest("GET", "/", new BasicHeader("User-Agent", "Mozilla Bar"), new BasicHeader("Origin", corsValue)); assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getHeader("Access-Control-Allow-Origin"), nullValue()); assertThat(response.getHeader("Access-Control-Allow-Credentials"), nullValue()); }
From source file:org.apache.droids.protocol.http.LenientHttpResponseParser.java
@Override public Header parseHeader(CharArrayBuffer buffer) throws ParseException { try {//from w w w. j av a 2 s . c o m return super.parseHeader(buffer); } catch (ParseException ex) { // Suppress ParseException exception return new BasicHeader(buffer.toString(), null); } }
From source file:net.netheos.pcsapi.request.JSONEntity.java
private JSONEntity(String json_str) { this.content = json_str.getBytes(PcsUtils.UTF8); contentType = new BasicHeader("Content-Type", "application/json"); }
From source file:org.commonjava.util.jhttpc.auth.OAuth20BearerTokenAuthenticator.java
@Override public HttpClientBuilder decorateClientBuilder(final HttpClientBuilder builder) throws JHttpCException { final Header header = new BasicHeader(AUTHORIZATION_HEADER, String.format(BEARER_FORMAT, token)); return builder.setDefaultHeaders(Collections.<Header>singleton(header)); }
From source file:nl.nn.adapterframework.http.mime.MultipartEntity.java
MultipartEntity(MultipartForm multipart, final ContentType contentType, final long contentLength) { super();//from w w w .j a va 2s. c o m this.multipart = multipart; this.contentType = new BasicHeader(HTTP.CONTENT_TYPE, contentType.toString()); this.contentLength = contentLength; }
From source file:com.cybozu.kintone.gpsPunch.GpsPunchRequestManager.java
public GpsPunchRequestManager() { // ???/* www . j av a 2 s .c o m*/ try { ResourceBundle rb = ResourceBundle.getBundle("gpspunch"); authorization = rb.getString("authorization"); companyId = rb.getString("companyid"); target = rb.getString("target"); } catch (Exception e) { e.printStackTrace(); System.exit(1); } // HTTP Client?? List<Header> headers = new ArrayList<Header>(); headers.add(new BasicHeader("Authorization", authorization)); // HTTP Client?? this.httpClient = HttpClientBuilder.create().setDefaultHeaders(headers).build(); }
From source file:com.woonoz.proxy.servlet.CookieSpecTest.java
@Test public void testParseCookie() throws MalformedCookieException { BestMatchSpec parser = new BestMatchSpec(); List<Cookie> cookies = parser.parse( new BasicHeader("Set-Cookie", "JSESSIONID=F39EC36E999C90604EAFF7A87F88DA58; Path=/"), new CookieOrigin("localhost", 80, "/toto", false)); Assert.assertEquals(cookies.size(), 1); Assert.assertEquals(cookies.get(0).getPath(), "/"); Assert.assertEquals(cookies.get(0).getName(), "JSESSIONID"); Assert.assertEquals(cookies.get(0).getValue(), "F39EC36E999C90604EAFF7A87F88DA58"); }
From source file:com.subgraph.vega.internal.model.requests.RequestLogEntity.java
private Header copyHeader(Header h) { if (h == null) { return null; } else {/* ww w . j av a2 s. c o m*/ return new BasicHeader(h.getName(), h.getValue()); } }
From source file:com.subgraph.vega.internal.http.requests.RequestCopyHeadersInterceptor.java
private static void copyHeaders(HttpMessage from, HttpMessage to) { for (Header h : from.getAllHeaders()) to.addHeader(new BasicHeader(h.getName(), h.getValue())); }