Example usage for org.springframework.http HttpMethod GET

List of usage examples for org.springframework.http HttpMethod GET

Introduction

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

Prototype

HttpMethod GET

To view the source code for org.springframework.http HttpMethod GET.

Click Source Link

Usage

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   ww  w . j a v a  2 s  .  co 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:com.example.user.UserEndpoint.java

public static void main(String[] args) {
    final ObjectMapper objectMapper = new ObjectMapper().registerModule(new Jackson2HalModule())
            .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
            .setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
    final MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(objectMapper);
    converter.setSupportedMediaTypes(Collections.singletonList(MediaTypes.HAL_JSON));
    final RestTemplate restTemplate = new RestTemplate(Collections.singletonList(converter));
    final ResponseEntity<PagedResources<Resource<UserEntity>>> entity = restTemplate.exchange(
            "http://localhost:5000/db-app/users", HttpMethod.GET, null,
            new ParameterizedTypeReference<PagedResources<Resource<UserEntity>>>() {
            });/*from ww w  . j av  a  2 s.  c om*/
    System.out.println(entity.getStatusCode());
    final PagedResources<Resource<UserEntity>> body = entity.getBody();
    System.out.println(body);
    final Collection<Resource<UserEntity>> contents = body.getContent();
    final List<UserEntity> userEntities = contents.stream().map(Resource::getContent).collect(toList());
}

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: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:io.fabric8.che.starter.client.StackClient.java

public List<Stack> listStacks(String cheServerUrl) {
    String url = CheRestEndpoints.LIST_STACKS.generateUrl(cheServerUrl);
    RestTemplate template = new RestTemplate();
    ResponseEntity<List<Stack>> response = template.exchange(url, HttpMethod.GET, null,
            new ParameterizedTypeReference<List<Stack>>() {
            });//from  w  ww  . j a v  a 2s  .c om
    return response.getBody();
}

From source file:com.github.ibm.domino.client.DominoRestClient.java

public List<Calendar> getCalendars() {

    init();//from   ww w .j a va  2s  .c  o m
    ResponseEntity<CalendarWrapper> response = restTemplate.exchange(getUri(), HttpMethod.GET, getHttpEntity(),
            CalendarWrapper.class);
    CalendarWrapper calendars = response.getBody();
    return calendars.getCalendars();

}

From source file:net.paslavsky.springrest.MetadataBuilder.java

MetadataBuilder() {
    metadata = new RestMethodMetadata();
    metadata.setHttpMethod(HttpMethod.GET);
    metadata.setMethodReturnType(Void.TYPE);
    metadata.setResponseClass(Void.class);
    metadata.setQueryParameters(new HashMap<String, Integer>());
    metadata.setUriVarParameters(new HashMap<String, Integer>());
    metadata.setRequestHeaderParameters(new HashMap<String, Integer>());
}

From source file:nl.iwelcome.connector.google.RestInvoker.java

public static RestInvoker prepareGetTo(String uri) {
    return new RestInvoker(HttpMethod.GET, uri);
}

From source file:org.apache.http.hacked.GetUriRegexMatcher.java

public GetUriRegexMatcher(String uriRegex) {
    super(HttpMethod.GET.toString(), uriRegex);
}

From source file:com.pepaproch.gtswsdlclient.impl.AvailabilityCheckImpl.java

/**
 *
 * @param addrId/*from w w  w .  jav  a  2  s .c om*/
 * @return
 */
public AvailabilityResponse checkAvailability(String addrId) {
    URI toUri = new AvailabilityCheckQueryBuilderImpl(restContext.getBASE_URL() + AVAILABILITY_CHECK_PATH)
            .buildQuery(addrId).encode().toUri();
    ResponseEntity<AvailabilityResponse> response = restContext.getRestTemplate().exchange(toUri,
            HttpMethod.GET, null, AvailabilityResponse.class);
    return response.getBody();
}