Example usage for org.springframework.http HttpHeaders HttpHeaders

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

Introduction

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

Prototype

public HttpHeaders() 

Source Link

Document

Construct a new, empty instance of the HttpHeaders object.

Usage

From source file:io.github.restdocsext.jersey.JerseyResponseConverter.java

/**
 * Convert {@code MultivaluedMap} headers to {@code HttpHeaders}.
 *
 * @param mapHeaders the Jersey map of headers.
 * @return the converted Spring HTTP Headers.
 */// w  w w .  ja v a  2  s  .  c o  m
private static HttpHeaders extractHeaders(MultivaluedMap<String, String> mapHeaders) {
    HttpHeaders headers = new HttpHeaders();
    for (String header : mapHeaders.keySet()) {
        for (String val : mapHeaders.get(header)) {
            headers.add(header, val);
        }
    }
    return headers;
}

From source file:pl.hycom.jira.plugins.gitlab.integration.util.TemplateFactory.java

public TemplateFactory getHttpHeaders() {
    this.headers = new HttpHeaders();

    return this;
}

From source file:eu.falcon.semantic.client.DenaClient.java

public static String addInstances(String fileClassPath, String format) {

    RestTemplate restTemplate = new RestTemplate();
    LinkedMultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
    //final String uri = "http://localhost:8090/api/v1/ontology/instances/publish";
    final String uri = "http://falconsemanticmanager.euprojects.net/api/v1/ontology/instances/publish";

    map.add("file", new ClassPathResource(fileClassPath));
    map.add("format", format);
    HttpHeaders headers = new HttpHeaders();

    headers.setContentType(MediaType.MULTIPART_FORM_DATA);

    HttpEntity<LinkedMultiValueMap<String, Object>> entity = new HttpEntity<LinkedMultiValueMap<String, Object>>(
            map, headers);/*from   w  ww.j  a v  a2s.c om*/

    String result = restTemplate.postForObject(uri, entity, String.class);

    return result;

}

From source file:org.bonitasoft.web.designer.controller.ResourceControllerAdvice.java

/**
 * Construct Header to specify content-type
 *//*from w ww. ja  va  2 s. c o  m*/
public static HttpHeaders getHttpHeaders() {
    HttpHeaders headers = new HttpHeaders();
    headers.add("Content-Type", MediaType.APPLICATION_JSON_VALUE);
    return headers;
}

From source file:id.co.teleanjar.ppobws.restclient.RestClientService.java

public HttpHeaders createHeaders(final String username, final String password) {
    return new HttpHeaders() {
        {/*  ww w  . j  av  a  2s. c om*/
            String auth = username + ":" + password;
            byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset.forName("US-ASCII")));
            String authHeader = "Basic " + new String(encodedAuth);
            set("Authorization", authHeader);
        }
    };
}

From source file:org.spearal.spring.rest.SpearalEntity.java

private static HttpHeaders toHeaders(SpearalFactory factory,
        SpearalPropertyFilterBuilder serverPropertyFilterBuilder) {
    HttpHeaders headers = new HttpHeaders();
    if (serverPropertyFilterBuilder == null)
        return headers;
    headers.put(PROPERTY_FILTER_HEADER, serverPropertyFilterBuilder.toHeaders(factory.getContext()));
    return headers;
}

From source file:monkeys.web.MonkeysController.java

@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Monkey>> getAllMonkeys() {
    List<Monkey> monkeyList = (List<Monkey>) monkeyRepository.findAll();
    HttpHeaders headers = new HttpHeaders();
    return new ResponseEntity<>(monkeyList, headers, HttpStatus.OK);
}

From source file:net.eusashead.hateoas.conditional.interceptor.SyncTestController.java

@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<String> get() {
    HttpHeaders headers = new HttpHeaders();
    headers.setETag("\"123456\"");
    return new ResponseEntity<String>("hello", headers, HttpStatus.OK);
}

From source file:org.trustedanalytics.h2oscoringengine.publisher.http.HttpCommunication.java

private static HttpHeaders createJsonHeaders() {
    HttpHeaders headers = new HttpHeaders();
    headers.add("Accept", JSON_ACCEPT_HEADER_VALUE);
    headers.add(CONTENT_TYPE_HEADER_NAME, JSON_ACCEPT_HEADER_VALUE);

    return headers;
}

From source file:com.cisco.cta.taxii.adapter.httpclient.HttpHeadersAppenderTest.java

@Before
public void setUp() throws Exception {
    appender = new HttpHeadersAppender();
    headers = new HttpHeaders();
}