Skip to content

Instantly share code, notes, and snippets.

Samuel Catalano samuelcatalano

View GitHub Profile
View REST.java
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"));
View BuilderExample.java
public class ConsumidorBuilder {
private Consumidor consumidor;
public ConsumidorBuilder() {
this.consumidor = new Consumidor();
}
public ConsumidorBuilder idExterno(String idExterno) {
this.consumidor.setIdExterno(idExterno);
@samuelcatalano
samuelcatalano / ResponseError.java
Last active Nov 28, 2018
Returning message error using javax.ws.rs.core.Response
View ResponseError.java
//javax.ws.rs.core.Response return message error
// catch Expection
JsonObject error = new JsonObject();
error.put("erro", e.getMessage());
return Response.status(HttpStatus.SC_BAD_REQUEST).entity(error.toString()).type(MediaType.APPLICATION_JSON).build();
View RGBColors.java
package src.main.java;
import java.util.Scanner;
/**
* {@link RGBColors}.
* @author Samuel Catalano
*/
public class RGBColors{
You can’t perform that action at this time.