Created
July 16, 2017 14:53
-
-
Save lynas/c9e487378f1fcc60aa83ca370bb9acef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Response postPatchDelete(HttpServletRequest request, String url, String method, Object object) { | |
Client client = ClientBuilder.newClient(); | |
try { | |
return client | |
.target(REST_URL_BASE + url) | |
.request() | |
.header(X_AUTH_TOKEN, getToken(request)) | |
.build( | |
method, | |
Entity.entity( | |
mapper.writeValueAsString(object), | |
MediaType.APPLICATION_JSON)) | |
.invoke(); | |
} catch (JsonProcessingException e) { | |
e.printStackTrace(); | |
return null; | |
} | |
} | |
public Response get(HttpServletRequest request,String url){ | |
System.out.println(REST_URL_BASE+url); | |
Client client = ClientBuilder.newClient(); | |
return client. | |
target(REST_URL_BASE + url) | |
.request() | |
.header(X_AUTH_TOKEN, getToken(request)) | |
.get(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment