List of usage examples for org.springframework.http HttpHeaders add
@Override public void add(String headerName, @Nullable String headerValue)
From source file:br.edu.unifesspa.lcc.indexer.teste.java
public static void main(String[] args) { int assunto = 215; RestTemplate rt = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", "Bearer d724997c-ba1d-42aa-8ed3-40a8a590558e"); HttpEntity<String> entity = new HttpEntity<>("parameters", headers); try {//from w ww. j ava 2 s . c o m System.out.println("Comeando a inserir os Inputs do assunto: " + assunto); ResponseEntity<domain.Input_presenteDTO[]> input = rt.exchange( "http://xingu.lcc.unifesspa.edu.br:8080/api/input_presentes/getInputPresenteByAssantoId/" + assunto, HttpMethod.GET, entity, Input_presenteDTO[].class); System.out.println("Fez o download do assunto: " + assunto); System.out.println("Tamano input: " + input.getBody().length + " Assunto: " + assunto); } catch (Exception e) { } }
From source file:cz.muni.fi.pa165.rentalofconstructionmachinery.restclient.App.java
public static int main(String[] args) { infoLogger.info("\n\nREST Sample Client\n\n"); HttpHeaders httpHeaders = new HttpHeaders(); String auth = REST_USERNAME + ":" + REST_PASSWORD; byte[] encodedAuthorisation = Base64.encode(auth.getBytes()); httpHeaders.add("Authorization", "Basic " + new String(encodedAuthorisation)); CustomerRestController.setHttpHeaders(httpHeaders); MachineRestController.setHttpHeaders(httpHeaders); try {/* w w w. j a v a2 s .c o m*/ switch (System.getProperty(ACTION, "")) { case "list": listEntities(); break; case "details": getDetails(); break; case "create": createEntity(); break; case "edit": editEntity(); break; case "delete": deleteEntity(); break; default: infoLogger.info("Please, see the usage guide for this client in the README file."); } } catch (Exception e) { errorLogger.error("Houston, we have a problem.", e); infoLogger.info("\n\n"); infoLogger.info("Ooops."); return 1; } infoLogger.info("\n\n"); infoLogger.info("The operation was successful."); return 0; }
From source file:com.carlomicieli.jtrains.infrastructure.web.Responses.java
public static ResponseEntity<Void> created(Link location) { HttpHeaders headers = new HttpHeaders(); headers.add("Location", location.getHref()); return new ResponseEntity<>(headers, HttpStatus.CREATED); }
From source file:org.trustedanalytics.h2oscoringengine.publisher.http.HttpCommunication.java
public static HttpEntity<String> basicAuthRequest(String basicAuthToken) { HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", "Basic " + basicAuthToken); return new HttpEntity<>(headers); }
From source file:org.trustedanalytics.h2oscoringengine.publisher.http.HttpCommunication.java
public static HttpEntity<String> postRequest(String body) { HttpHeaders headers = new HttpHeaders(); headers.add("Accept", JSON_ACCEPT_HEADER_VALUE); headers.add(CONTENT_TYPE_HEADER_NAME, "application/x-www-form-urlencoded"); return new HttpEntity<>(body, headers); }
From source file:org.trustedanalytics.h2oscoringengine.publisher.http.HttpCommunication.java
public static HttpHeaders basicAuthJsonHeaders(String basicAuthToken) { HttpHeaders headers = new HttpHeaders(); headers.add(CONTENT_TYPE_HEADER_NAME, JSON_ACCEPT_HEADER_VALUE); headers.add("Authorization", "Basic " + basicAuthToken); return headers; }
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:org.trustedanalytics.h2oscoringengine.publisher.http.HttpCommunication.java
public static HttpHeaders zipHeaders() { HttpHeaders bitsHeaders = new HttpHeaders(); bitsHeaders.add(CONTENT_TYPE_HEADER_NAME, "application/zip"); return bitsHeaders; }
From source file:org.zaizi.TestOAuthUtils.java
public static void addOAuth2AccessTokenToHeader(final HttpHeaders headers, String accessToken) { headers.add(OAuthConstants.AUTHORIZATION, OAuthUtils.getAuthorizationHeaderForAccessToken(accessToken)); }
From source file:org.bonitasoft.web.designer.controller.ResourceControllerAdvice.java
/** * Construct Header to specify content-type */// w w w .j a va 2 s . c o m public static HttpHeaders getHttpHeaders() { HttpHeaders headers = new HttpHeaders(); headers.add("Content-Type", MediaType.APPLICATION_JSON_VALUE); return headers; }