Java Code Examples for javax.ws.rs.HttpMethod#HEAD
The following examples show how to use
javax.ws.rs.HttpMethod#HEAD .
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: OkHttpReplicationClient.java From nifi with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") private HttpUrl buildUrl(final OkHttpPreparedRequest request, final String uri) { HttpUrl.Builder urlBuilder = HttpUrl.parse(uri).newBuilder(); switch (request.getMethod().toUpperCase()) { case HttpMethod.DELETE: case HttpMethod.HEAD: case HttpMethod.GET: case HttpMethod.OPTIONS: if (request.getEntity() instanceof MultivaluedMap) { final MultivaluedMap<String, String> entityMap = (MultivaluedMap<String, String>) request.getEntity(); for (final Entry<String, List<String>> queryEntry : entityMap.entrySet()) { final String queryName = queryEntry.getKey(); for (final String queryValue : queryEntry.getValue()) { urlBuilder = urlBuilder.addQueryParameter(queryName, queryValue); } } } break; } return urlBuilder.build(); }
Example 2
Source File: ThreadPoolRequestReplicator.java From localization_nifi with Apache License 2.0 | 5 votes |
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder, final NodeIdentifier nodeId, final String method, final URI uri, final String requestId, final Map<String, String> headers) { final ClientResponse clientResponse; final long startNanos = System.nanoTime(); logger.debug("Replicating request to {} {}, request ID = {}, headers = {}", method, uri, requestId, headers); switch (method.toUpperCase()) { case HttpMethod.DELETE: clientResponse = resourceBuilder.delete(ClientResponse.class); break; case HttpMethod.GET: clientResponse = resourceBuilder.get(ClientResponse.class); break; case HttpMethod.HEAD: clientResponse = resourceBuilder.head(); break; case HttpMethod.OPTIONS: clientResponse = resourceBuilder.options(ClientResponse.class); break; case HttpMethod.POST: clientResponse = resourceBuilder.post(ClientResponse.class); break; case HttpMethod.PUT: clientResponse = resourceBuilder.put(ClientResponse.class); break; default: throw new IllegalArgumentException("HTTP Method '" + method + "' not supported for request replication."); } return new NodeResponse(nodeId, method, uri, clientResponse, System.nanoTime() - startNanos, requestId); }
Example 3
Source File: ThreadPoolRequestReplicator.java From localization_nifi with Apache License 2.0 | 5 votes |
private boolean isMutableRequest(final String method, final String uriPath) { switch (method.toUpperCase()) { case HttpMethod.GET: case HttpMethod.HEAD: case HttpMethod.OPTIONS: return false; default: return true; } }
Example 4
Source File: MCRRestAuthorizationFilter.java From mycore with GNU General Public License v3.0 | 5 votes |
@Override public void filter(ContainerRequestContext requestContext) { MCRRestAPIACLPermission permission; switch (requestContext.getMethod()) { case HttpMethod.OPTIONS: return; case HttpMethod.GET: case HttpMethod.HEAD: permission = MCRRestAPIACLPermission.READ; break; case HttpMethod.DELETE: permission = MCRRestAPIACLPermission.DELETE; break; default: permission = MCRRestAPIACLPermission.WRITE; } Optional.ofNullable(resourceInfo.getResourceClass().getAnnotation(Path.class)) .map(Path::value) .ifPresent(path -> { checkRestAPIAccess(requestContext, permission, path); MultivaluedMap<String, String> pathParameters = requestContext.getUriInfo().getPathParameters(); checkBaseAccess(requestContext, permission, pathParameters.getFirst(PARAM_MCRID), pathParameters.getFirst(PARAM_DERID), pathParameters.getFirst(PARAM_DER_PATH)); }); checkDetailLevel(requestContext, requestContext.getAcceptableMediaTypes() .stream() .map(m -> m.getParameters().get(MCRDetailLevel.MEDIA_TYPE_PARAMETER)) .toArray(String[]::new)); }
Example 5
Source File: ThreadPoolRequestReplicator.java From nifi with Apache License 2.0 | 5 votes |
private boolean isMutableRequest(final String method, final String uriPath) { switch (method.toUpperCase()) { case HttpMethod.GET: case HttpMethod.HEAD: case HttpMethod.OPTIONS: return false; default: return true; } }
Example 6
Source File: HEADAnnotationHandler.java From minnal with Apache License 2.0 | 4 votes |
@Override protected String getHttpMethod() { return HttpMethod.HEAD; }