Skip to content

Instantly share code, notes, and snippets.

@samuelcatalano-zz
Created November 28, 2018 19:44
Show Gist options
  • Save samuelcatalano-zz/2a81e183e37474ab78502b6c1057a001 to your computer and use it in GitHub Desktop.
Save samuelcatalano-zz/2a81e183e37474ab78502b6c1057a001 to your computer and use it in GitHub Desktop.
final ObjectMapper mapper = new ObjectMapper();
try {
usuario = mapper.writeValueAsString(usuarioRaichu);
final Client client = ClientBuilder.newClient();
response = client
.target(host)
.request().header("Authorization", authToken)
.accept(MediaType.APPLICATION_JSON)
.post(Entity.entity(usuario, "application/json"));
} catch (final JsonProcessingException e) {
log.log(Level.SEVERE, "Erro ao criar usuário às {0} - {1}",
new Object[]{LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_TIME),
e.getMessage()});
throw new UserException("Erro ao criar usuário");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment