Example usage for org.springframework.http HttpHeaders entrySet

List of usage examples for org.springframework.http HttpHeaders entrySet

Introduction

In this page you can find the example usage for org.springframework.http HttpHeaders entrySet.

Prototype

@Override
    public Set<Entry<String, List<String>>> entrySet() 

Source Link

Usage

From source file:guru.nidi.ramltester.spring.SpringUtils.java

static Values headerValuesOf(HttpHeaders headers) {
    final Values values = new Values();
    for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
        values.addValues(entry.getKey(), entry.getValue());
    }// w  w  w  . j a  va2 s  .co  m
    return values;
}

From source file:org.jasig.springframework.web.client.HttpServletProxyResponse.java

@Override
public void setHttpHeaders(HttpHeaders headers) {
    for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
        String headerName = entry.getKey();
        if (!this.excludedHeaders.contains(headerName)) {
            for (String headerValue : entry.getValue()) {
                this.servletResponse.addHeader(headerName, headerValue);
            }/*from  w ww.j a v  a  2  s .  c  o  m*/
        }
    }
}

From source file:org.jasig.springframework.web.client.PortletResourceProxyResponse.java

@Override
public void setHttpHeaders(HttpHeaders headers) {
    for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
        String headerName = entry.getKey();
        if (!this.excludedHeaders.contains(headerName)) {
            for (String headerValue : entry.getValue()) {
                this.resourceResponse.addProperty(headerName, headerValue);
            }/* www. ja v a  2s. c om*/
        }
    }
}

From source file:org.dthume.spring.http.client.httpcomponents.HttpComponentsClientHttpRequest.java

private void addHeaders(final HttpUriRequest request, final HttpHeaders headers) {
    for (Map.Entry<String, List<String>> entry : headers.entrySet())
        for (final String value : entry.getValue())
            request.addHeader(entry.getKey(), value);
}

From source file:ar.com.aleatoria.ue.rest.SimpleBufferingClientHttpRequest.java

@Override
protected ClientHttpResponse executeInternal(HttpHeaders headers, byte[] bufferedOutput) throws IOException {
    for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
        String headerName = entry.getKey();
        for (String headerValue : entry.getValue()) {
            this.connection.addRequestProperty(headerName, headerValue);
        }/*from  ww w .j  av a 2  s.  c o m*/
    }

    if (this.connection.getDoOutput()) {
        this.connection.setFixedLengthStreamingMode(bufferedOutput.length);
    }
    this.connection.connect();
    if (this.connection.getDoOutput()) {
        FileCopyUtils.copy(bufferedOutput, this.connection.getOutputStream());
    }

    return new SimpleClientHttpResponse(this.connection);
}

From source file:ar.com.aleatoria.ue.rest.SimpleStreamingClientHttpRequest.java

private void writeHeaders(HttpHeaders headers) {
    for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
        String headerName = entry.getKey();
        for (String headerValue : entry.getValue()) {
            if (shouldAllowConnectionReuse(headerName, headerValue)) {
                this.connection.addRequestProperty(headerName, headerValue);
            }//from   w w  w .  j  av  a 2  s. c o  m
        }
    }
}

From source file:com.codeabovelab.dm.gateway.filestorage.GetResponseExtractor.java

@Override
public Object extractData(ClientHttpResponse response) throws IOException {
    HttpHeaders headers = new HttpHeaders();
    headers.putAll(response.getHeaders());
    for (Map.Entry<String, List<String>> e : headers.entrySet()) {
        List<String> values = e.getValue();
        for (int i = 0; i < values.size(); i++) {
            final String key = e.getKey();
            if (FORBIDDEN_HEADERS.contains(key)) {
                continue;
            }/*from   w w w . ja va  2 s.  c  o  m*/
            servletResponse.setHeader(key, values.get(i));
        }
    }
    try (InputStream is = response.getBody(); ServletOutputStream os = servletResponse.getOutputStream()) {
        IOUtils.copy(is, os);
        servletResponse.flushBuffer();

    }
    return null;
}

From source file:com.huoqiu.framework.rest.HttpComponentsClientHttpRequest.java

@Override
public ClientHttpResponse executeInternal(HttpHeaders headers, byte[] bufferedOutput) throws IOException {
    for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
        String headerName = entry.getKey();
        if (!headerName.equalsIgnoreCase(HTTP.CONTENT_LEN)
                && !headerName.equalsIgnoreCase(HTTP.TRANSFER_ENCODING)) {
            for (String headerValue : entry.getValue()) {
                this.httpRequest.addHeader(headerName, headerValue);
            }/*from  w  w w.j a v  a 2 s.com*/
        }
    }
    if (this.httpRequest instanceof HttpEntityEnclosingRequest) {
        HttpEntityEnclosingRequest entityEnclosingReq = (HttpEntityEnclosingRequest) this.httpRequest;
        HttpEntity requestEntity = new ByteArrayEntity(bufferedOutput);
        entityEnclosingReq.setEntity(requestEntity);
    }
    HttpResponse httpResponse = httpClient.execute(this.httpRequest, this.httpContext);
    return new HttpComponentsClientHttpResponse(httpResponse);
}

From source file:com.nimble.http.client.GzipClientHttpRequest.java

protected ClientHttpResponse executeInternal(HttpHeaders headers, byte[] bufferedOutput) throws IOException {
    for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
        String headerName = entry.getKey();
        for (String headerValue : entry.getValue()) {
            this.connection.addRequestProperty(headerName, headerValue);
        }//from  w ww  . j a  va 2  s . com
    }

    if (this.connection.getDoOutput()) {
        this.connection.setFixedLengthStreamingMode(bufferedOutput.length);
    }
    this.connection.connect();
    if (this.connection.getDoOutput()) {
        FileCopyUtils.copy(bufferedOutput, this.connection.getOutputStream());
    }

    return new GzipClientHttpResponse(this.connection);
}

From source file:grails.plugin.cloudfoundry.GrailsHttpRequest.java

protected ClientHttpResponse executeInternal(HttpHeaders headers,
        @SuppressWarnings("hiding") byte[] bufferedOutput) throws IOException {
    for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
        String headerName = entry.getKey();
        for (String headerValue : entry.getValue()) {
            connection.addRequestProperty(headerName, headerValue);
        }/*  w ww  .j  av  a 2  s  . c  o  m*/
    }

    if (connection.getDoOutput()) {
        connection.setFixedLengthStreamingMode(bufferedOutput.length);
    }

    connection.connect();

    if (connection.getDoOutput()) {
        FileCopyUtils.copy(bufferedOutput, connection.getOutputStream());
    }

    return new GrailsHttpResponse(connection);
}