Java Code Examples for javax.ws.rs.core.UriBuilder#segment()
The following examples show how to use
javax.ws.rs.core.UriBuilder#segment() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseRoleConnectHelper.java From emodb with Apache License 2.0 | 6 votes |
protected void httpPost(Map<String,Object> params, boolean isAdminPort, String... segments) throws Exception { UriBuilder builder = (isAdminPort) ? EmoUriBuilder.fromUri(URI.create(getAdminBaseURI())) : EmoUriBuilder.fromUri(URI.create(getServiceBaseURI())); builder.segment(segments); for (String lvalue : params.keySet()) { builder.queryParam(lvalue, params.get(lvalue)); } URI uri = builder.build(); //curl -XPOST http://localhost:8581/tasks/invalidate System.out.println (uri.toASCIIString()); Client client = getClient(); client.resource(uri) .type(MediaType.APPLICATION_JSON_TYPE) .header(HttpHeaders.AUTHORIZATION, null) .post(); }
Example 2
Source File: BaseRoleConnectHelper.java From emodb with Apache License 2.0 | 6 votes |
protected List<?> httpGetServicePortAsList(Map<String, Object> params, String... segments) throws Exception { Client client = getClient(); UriBuilder builder = EmoUriBuilder.fromUri(URI.create(getServiceBaseURI())); builder.segment(segments); for (String lvalue : params.keySet()) { builder.queryParam(lvalue, params.get(lvalue)); } URI uri = builder.build(); System.out.println (uri.toASCIIString()); return client.resource(uri) .accept(MediaType.APPLICATION_JSON_TYPE) .get(List.class); }