public void setContentType(String contentType) { for (Header hdr : headers) { if (HEADER_CONTENT_TYPE.equals( hdr.getName() )) { hdr.setValue(contentType); return; } } headers.add(new Header(HEADER_CONTENT_TYPE, contentType)); }
public void setContentType(String contentType) { for (Header hdr : headers) { if (HEADER_CONTENT_TYPE.equals( hdr.getName() )) { hdr.setValue(contentType); return; } } headers.add(new Header(HEADER_CONTENT_TYPE, contentType)); }
// Create an instance of org.apache.axis2.client.ServiceClient ServiceClient client = ... // Create an instance of org.apache.axis2.client.Options Options options = new Options(); List list = new ArrayList(); // Create an instance of org.apache.commons.httpclient.Header Header header = new Header(); // Http header. Name : user, Value : admin header.setName("user"); header.setValue("admin"); list.add(header); options.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_HEADERS, list); client.setOptions(options);
public void addRequestHeaders(Header[] headers) { for (Header newHdr : headers) { // See if we already have one of these headers Header existingHdr = null; for (Header hdr : this.headers) { if (newHdr.getName().equals( hdr.getName() )) { existingHdr = hdr; } } // Update or add as needed if (existingHdr != null) { existingHdr.setValue(newHdr.getValue()); } else { this.headers.add(newHdr); } } }
public void addRequestHeaders(Header[] headers) { for (Header newHdr : headers) { // See if we already have one of these headers Header existingHdr = null; for (Header hdr : this.headers) { if (newHdr.getName().equals( hdr.getName() )) { existingHdr = hdr; } } // Update or add as needed if (existingHdr != null) { existingHdr.setValue(newHdr.getValue()); } else { this.headers.add(newHdr); } } }
/** * If a 'Proxy-Connection' header has been added to the request, * it'll be of a 'keep-alive' type. Until we support 'keep-alives', * override the Proxy-Connection setting and instead pass a 'close' * (Otherwise every request has to timeout before we notice * end-of-document). * @param method Method to find proxy-connection header in. */ public void handleAddProxyConnectionHeader(HttpMethod method) { Header h = method.getRequestHeader("Proxy-Connection"); if (h != null) { h.setValue("close"); method.setRequestHeader(h); } } }
/** * If a 'Proxy-Connection' header has been added to the request, * it'll be of a 'keep-alive' type. Until we support 'keep-alives', * override the Proxy-Connection setting and instead pass a 'close' * (Otherwise every request has to timeout before we notice * end-of-document). * @param method Method to find proxy-connection header in. */ public void handleAddProxyConnectionHeader(HttpMethod method) { Header h = method.getRequestHeader("Proxy-Connection"); if (h != null) { h.setValue("close"); method.setRequestHeader(h); } } }
/** * If a 'Proxy-Connection' header has been added to the request, * it'll be of a 'keep-alive' type. Until we support 'keep-alives', * override the Proxy-Connection setting and instead pass a 'close' * (Otherwise every request has to timeout before we notice * end-of-document). * @param method Method to find proxy-connection header in. */ public void handleAddProxyConnectionHeader(HttpMethod method) { Header h = method.getRequestHeader("Proxy-Connection"); if (h != null) { h.setValue("close"); method.setRequestHeader(h); } } }
@Override public Header getResponseHeader(String headerName) { Header header = new Header(); header.setName("Cache-Control"); header.setValue(cacheControlHeaderValue); return header; } };
String redirectedDestination = redirectionBase + destinationPath; destination.setValue(redirectedDestination); method.setRequestHeader(destination);