本文整理了Java中org.apache.http.HttpResponse.setHeader()
方法的一些代码示例,展示了HttpResponse.setHeader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpResponse.setHeader()
方法的具体详情如下:
包路径:org.apache.http.HttpResponse
类名称:HttpResponse
方法名:setHeader
暂无
代码示例来源:origin: rest-assured/rest-assured
public void setHeader( Header arg0 ) {
responseBase.setHeader( arg0 );
}
代码示例来源:origin: rest-assured/rest-assured
public void setHeader( String arg0, String arg1 ) {
responseBase.setHeader( arg0, arg1 );
}
代码示例来源:origin: robovm/robovm
public void process(final HttpResponse response, final HttpContext context)
throws HttpException, IOException {
if (response == null) {
throw new IllegalArgumentException
("HTTP response may not be null.");
}
int status = response.getStatusLine().getStatusCode();
if ((status >= HttpStatus.SC_OK) &&
!response.containsHeader(HTTP.DATE_HEADER)) {
String httpdate = DATE_GENERATOR.getCurrentDate();
response.setHeader(HTTP.DATE_HEADER, httpdate);
}
}
代码示例来源:origin: robovm/robovm
status == HttpStatus.SC_SERVICE_UNAVAILABLE ||
status == HttpStatus.SC_NOT_IMPLEMENTED) {
response.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
return;
if (entity.getContentLength() < 0 &&
(!entity.isChunked() || ver.lessEquals(HttpVersion.HTTP_1_0))) {
response.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
return;
Header header = request.getFirstHeader(HTTP.CONN_DIRECTIVE);
if (header != null) {
response.setHeader(HTTP.CONN_DIRECTIVE, header.getValue());
代码示例来源:origin: com.jayway.restassured/rest-assured
public void setHeader( String arg0, String arg1 ) {
responseBase.setHeader( arg0, arg1 );
}
代码示例来源:origin: com.jayway.restassured/rest-assured
public void setHeader( Header arg0 ) {
responseBase.setHeader( arg0 );
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
@Override
public void setHeader(final String name, final String value) {
original.setHeader(name, value);
}
代码示例来源:origin: ibinti/bugvm
@Override
public void setHeader(final Header header) {
original.setHeader(header);
}
代码示例来源:origin: stackoverflow.com
class CustomRedirectHandler extends DefaultRedirectHandler {
@Override
public URI getLocationURI(HttpResponse response, HttpContext context)
throws ProtocolException {
response.setHeader("Location", "http://www.ims.tau.ac.il/Tal/"+ response.getFirstHeader("Location").getValue().replace(" ", "%20"));
return super.getLocationURI(response, context);
}
}
代码示例来源:origin: stackoverflow.com
private static void setContentTypeHeader(HttpResponse response, File file) {
String contentType = MimeTypes.getContentType(file.getPath());
if (!contentType.equals("application/octet-stream")) {
contentType += "; charset=utf-8";
}
response.setHeader(CONTENT_TYPE, contentType);
}
代码示例来源:origin: com.jkoolcloud/jesl
/**
* {@inheritDoc}
*/
@Override
public void setHeader(String name, String value) {
if (response != null) {
response.setHeader(name, value);
} else {
super.setHeader(name, value);
}
}
代码示例来源:origin: com.jkoolcloud/jesl
/**
* {@inheritDoc}
*/
@Override
public void setHeader(Header header) {
if (response != null) {
response.setHeader(header);
} else {
super.setHeader(header);
}
}
代码示例来源:origin: org.apache.httpcomponents/com.springsource.org.apache.httpcomponents.httpclient-cache
private void addMissingContentLengthHeader(HttpResponse response, HttpEntity entity) {
if (transferEncodingIsPresent(response))
return;
Header contentLength = response.getFirstHeader(HTTP.CONTENT_LEN);
if (contentLength == null) {
contentLength = new BasicHeader(HTTP.CONTENT_LEN, Long.toString(entity
.getContentLength()));
response.setHeader(contentLength);
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient
private void addMissingContentLengthHeader(final HttpResponse response, final HttpEntity entity) {
if (transferEncodingIsPresent(response)) {
return;
}
Header contentLength = response.getFirstHeader(HTTP.CONTENT_LEN);
if (contentLength == null) {
contentLength = new BasicHeader(HTTP.CONTENT_LEN, Long.toString(entity
.getContentLength()));
response.setHeader(contentLength);
}
}
代码示例来源:origin: com.gluonhq/robovm-rt
public void process(final HttpResponse response, final HttpContext context)
throws HttpException, IOException {
if (response == null) {
throw new IllegalArgumentException
("HTTP response may not be null.");
}
int status = response.getStatusLine().getStatusCode();
if ((status >= HttpStatus.SC_OK) &&
!response.containsHeader(HTTP.DATE_HEADER)) {
String httpdate = DATE_GENERATOR.getCurrentDate();
response.setHeader(HTTP.DATE_HEADER, httpdate);
}
}
代码示例来源:origin: ibinti/bugvm
@Override
public void process(final HttpResponse response, final HttpContext context)
throws HttpException, IOException {
Args.notNull(response, "HTTP response");
final int status = response.getStatusLine().getStatusCode();
if ((status >= HttpStatus.SC_OK) &&
!response.containsHeader(HTTP.DATE_HEADER)) {
final String httpdate = DATE_GENERATOR.getCurrentDate();
response.setHeader(HTTP.DATE_HEADER, httpdate);
}
}
代码示例来源:origin: com.bugvm/bugvm-rt
@Override
public void process(final HttpResponse response, final HttpContext context)
throws HttpException, IOException {
Args.notNull(response, "HTTP response");
final int status = response.getStatusLine().getStatusCode();
if ((status >= HttpStatus.SC_OK) &&
!response.containsHeader(HTTP.DATE_HEADER)) {
final String httpdate = DATE_GENERATOR.getCurrentDate();
response.setHeader(HTTP.DATE_HEADER, httpdate);
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpcore
public void process(final HttpResponse response, final HttpContext context)
throws HttpException, IOException {
Args.notNull(response, "HTTP response");
final int status = response.getStatusLine().getStatusCode();
if ((status >= HttpStatus.SC_OK) &&
!response.containsHeader(HTTP.DATE_HEADER)) {
final String httpdate = DATE_GENERATOR.getCurrentDate();
response.setHeader(HTTP.DATE_HEADER, httpdate);
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
@Override
public void process(final HttpResponse response, final HttpContext context)
throws HttpException, IOException {
Args.notNull(response, "HTTP response");
final int status = response.getStatusLine().getStatusCode();
if ((status >= HttpStatus.SC_OK) &&
!response.containsHeader(HTTP.DATE_HEADER)) {
final String httpdate = DATE_GENERATOR.getCurrentDate();
response.setHeader(HTTP.DATE_HEADER, httpdate);
}
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-common
@Override
public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException {
for (Header h : headers) {
response.setHeader(h);
}
response.setStatusCode(responseCode);
response.setEntity(entity);
}
内容来源于网络,如有侵权,请联系作者删除!