public static void main(String[] args) { try { EncryptServiceImpl pp = new EncryptServiceImpl(); SecurityServiceImpl ss = new SecurityServiceImpl(); Client client = Client.create(); WebResource webResource = client.resource( "http://localhost:8080/DondeEstacionoServer/rest/find/byParking/byId/frequencytyperequest"); FrequencyTypeRequest frequencyTypeRequest = new FrequencyTypeRequest(); frequencyTypeRequest.setParkingIdentificationCode("OTT"); frequencyTypeRequest.setId(1L); DESRequest request = new DESRequest(); request.setUserHash("HASH-PUBLIC-WEB"); request.setPayload(frequencyTypeRequest); request.setMac(ss.buildMac(DESUtils.convertObjectToJson(frequencyTypeRequest))); String requestJson = DESUtils.convertObjectToJson(request); System.out.println("request json " + requestJson); String ppp = pp.encrypt(requestJson); System.out.println("request json encrypted " + ppp); String response = webResource.type("application/json").post(String.class, ppp); System.out.println("RESULT encripted: " + response); String dencryptedMessage = pp.dencrypt(response); System.out.println("RESULT dencripted: " + dencryptedMessage); // DESResponse resp = // DESUtils.convertJsonToObject(dencryptedMessage, // DESResponse.class); // System.out.println(resp.toString()); } catch (Exception e) { e.printStackTrace(); } }
public static ErrorMessageCache getInstance() { if (DESUtils.isNull(instance)) { instance = new ErrorMessageCache(); } return instance; }