br.edu.unifesspa.lcc.indexer.teste.java Source code

Java tutorial

Introduction

Here is the source code for br.edu.unifesspa.lcc.indexer.teste.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.edu.unifesspa.lcc.indexer;

import static br.edu.unifesspa.lcc.indexer.Processar.headers;
import domain.Input_presenteDTO;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

/**
 *
 * @author HansGuido
 */
public class teste {
    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 {
            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) {

        }
    }
}