private <ResourceType extends ClientResource> JerseyRequest<ResourceType> preparePatchResourceRequest( Class<ResourceType> resourceTypeClass) { JerseyRequest<ResourceType> request = buildRequest(sessionStorage, resourceTypeClass, new String[] {"/resources", resourceUri}); request.setAccept( MimeTypeUtil.toCorrectContentMime( sessionStorage.getConfiguration(), ResourcesTypeResolverUtil.getMimeType(resourceTypeClass))); request.addHeader("X-HTTP-Method-Override", "PATCH"); return request; }
private JerseyRequest<ClientResource> prepareCreateOrUpdateRequest(ClientResource resource) { Class<? extends ClientResource> resourceType = ResourcesTypeResolverUtil.getResourceType(resource); JerseyRequest<? extends ClientResource> request = buildRequest( sessionStorage, resourceType, new String[] {"/resources", resourceUri}, new DefaultErrorHandler()); request.setContentType( MimeTypeUtil.toCorrectContentMime( sessionStorage.getConfiguration(), ResourcesTypeResolverUtil.getMimeType(resourceType))); request.addParams(params); return (JerseyRequest<ClientResource>) request; }