Java Code Examples for javax.ws.rs.HttpMethod#DELETE
The following examples show how to use
javax.ws.rs.HttpMethod#DELETE .
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: ResourceMethod.java From jweb-cms with GNU Affero General Public License v3.0 | 5 votes |
private String httpMethod(Method method) { if (method.isAnnotationPresent(GET.class)) { return HttpMethod.GET; } else if (method.isAnnotationPresent(POST.class)) { return HttpMethod.POST; } else if (method.isAnnotationPresent(PUT.class)) { return HttpMethod.PUT; } else if (method.isAnnotationPresent(DELETE.class)) { return HttpMethod.DELETE; } else { return null; } }
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: AnnotationProcessor.java From carbon-device-mgt with Apache License 2.0 | 5 votes |
/** * Read Method annotations indicating HTTP Methods * * @param annotation */ private String getHTTPMethodAnnotation(Annotation annotation) { if (annotation.annotationType().getName().equals(GET.class.getName())) { return HttpMethod.GET; } else if (annotation.annotationType().getName().equals(POST.class.getName())) { return HttpMethod.POST; } else if (annotation.annotationType().getName().equals(OPTIONS.class.getName())) { return HttpMethod.OPTIONS; } else if (annotation.annotationType().getName().equals(DELETE.class.getName())) { return HttpMethod.DELETE; } else if (annotation.annotationType().getName().equals(PUT.class.getName())) { return HttpMethod.PUT; } return null; }
Example 6
Source File: DcRequest.java From io with Apache License 2.0 | 4 votes |
/** * DELETEメソッドとしてDcRequestオブジェクトを生成する. * @param url URL * @return req DcRequestオブジェクト */ public static DcRequest delete(String url) { DcRequest req = new DcRequest(url); req.method = HttpMethod.DELETE; return req; }
Example 7
Source File: DeleteMethodCreator.java From minnal with Apache License 2.0 | 4 votes |
@Override protected String getHttpMethod() { return HttpMethod.DELETE; }
Example 8
Source File: DELETEAnnotationHandler.java From minnal with Apache License 2.0 | 4 votes |
@Override protected String getHttpMethod() { return HttpMethod.DELETE; }
Example 9
Source File: Recipient.java From pagarme-java with The Unlicense | 4 votes |
public void deleteAnticipation(BulkAnticipation anticipation) throws PagarMeException{ validateId(); String path = String.format("/%s/%s/%s/%s", getClassName(), getId(), anticipation.getClassName(), anticipation.getId()); final PagarMeRequest request = new PagarMeRequest(HttpMethod.DELETE, path); request.execute(); }