List of usage examples for org.springframework.http HttpEntity HttpEntity
public HttpEntity(MultiValueMap<String, String> headers)
From source file:cz.muni.fi.pa165.rentalofconstructionmachinery.restclient.MachineRestController.java
public static void deleteMachine(Long id) throws URISyntaxException { String url = MACHINE_URL + id; rt.exchange(new URI(url), HttpMethod.DELETE, new HttpEntity<>(httpHeaders), Object.class); }
From source file:org.trustedanalytics.h2oscoringengine.publisher.http.HttpCommunication.java
public static HttpEntity<String> simpleJsonRequest() { return new HttpEntity<>(createJsonHeaders()); }
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:com.goldengekko.meetr.service.salesforce.SalesforceService.java
protected static HttpEntity getRequestEntity(String accessToken) { HttpHeaders headers = new HttpHeaders(); final String auth = String.format("OAuth %s", accessToken); headers.add("Authorization", auth); LOG.info("Salesforce Authorization: {}", auth); final HttpEntity requestEntity = new HttpEntity(headers); return requestEntity; }
From source file:cz.muni.fi.pa165.rentalofconstructionmachinery.restclient.MachineRestController.java
public static MachineDTO machineDetails(Long id) throws URISyntaxException { String url = MACHINE_URL + id; HttpEntity re = rt.exchange(new URI(url), HttpMethod.GET, new HttpEntity<>(httpHeaders), MachineDTO.class); return (MachineDTO) re.getBody(); }
From source file:com.royclarkson.springagram.RestUtils.java
public static HttpEntity<Void> getRequestEntity() { if (requestEntity == null) { HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.setAccept(Collections.singletonList(new MediaType("application", "hal+json"))); requestEntity = new HttpEntity<Void>(requestHeaders); }//from w ww. j a v a2 s. c om return requestEntity; }
From source file:cz.muni.fi.pa165.rentalofconstructionmachinery.restclient.MachineRestController.java
public static List<MachineDTO> listMachines() throws URISyntaxException { HttpEntity re = rt.exchange(new URI(MACHINE_URL), HttpMethod.GET, new HttpEntity<>(httpHeaders), MachineDTO[].class); return Arrays.asList((MachineDTO[]) re.getBody()); }
From source file:com.design.perpetual.ecobeethermostat.app.requests.AuthorizationTokenRequestor.java
public Optional<AuthorizationToken> getAuthorization(AppKey appKey) { if (appKey.isValidToken()) { HttpEntity<String> request = new HttpEntity(GenericRequestor.setContentTypeHeader()); String url = String.format(URL, appKey.getToken()); return (Optional<AuthorizationToken>) genericRequestor.request(url, HttpMethod.POST, AuthorizationToken.class, request); }//from www . ja v a2s .c o m return Optional.empty(); }
From source file:org.intermine.app.net.request.GetRequest.java
protected byte[] loadBytes(String uriString, Map<String, ?> params) { RestTemplate rtp = getRestTemplate(); HttpHeaders headers = getHeaders();/*from w ww . j ava 2 s . c om*/ HttpEntity<String> req = new HttpEntity<>(headers); ResponseEntity<byte[]> res; URI uri = URI.create(expandQuery(uriString, params)); res = rtp.exchange(uri, GET, req, byte[].class); return res.getBody(); }
From source file:com.hatta.consumer.App.java
@SuppressWarnings({ "unchecked" }) private static AuthTokenInfo sendTokenRequest() { RestTemplate restTemplate = new RestTemplate(); HttpEntity<String> request = new HttpEntity<String>(getHeadersWithClientCredentials()); ResponseEntity<Object> response = restTemplate.exchange(AUTH_SERVER_URI + QPM_PASSWORD_GRANT, HttpMethod.POST, request, Object.class); LinkedHashMap<String, Object> map = (LinkedHashMap<String, Object>) response.getBody(); AuthTokenInfo tokenInfo = null;/* w ww. j a v a 2s . c om*/ if (map != null) { tokenInfo = new AuthTokenInfo(); tokenInfo.setAccess_token((String) map.get("access_token")); tokenInfo.setToken_type((String) map.get("token_type")); tokenInfo.setRefresh_token((String) map.get("refresh_token")); tokenInfo.setExpires_in((int) map.get("expires_in")); tokenInfo.setScope((String) map.get("scope")); System.out.println(tokenInfo); System.out.println("access_token =" + map.get("access_token") + ", token_type=" + map.get("token_type") + ", refresh_token=" + map.get("refresh_token") + ", expires_in=" + map.get("expires_in") + ", scope=" + map.get("scope")); ; } else { System.out.println("No user exist----------"); } return tokenInfo; }