@Override public Void call() throws Exception { final WebResource votesResource = client.resource(votesUri); votesResource.post(); return null; } });
@Override public String searchForMetadataAsString(String searchTerms) { WebResource resource = createResource(searchTerms); return resource.post(String.class); }
@Override public void stop(String text) throws IOException { WebResource resource = applicationResource(ACTION_STOP); resource.post(text); }
@Override public void stop(String text) throws IOException { WebResource resource = applicationResource(ACTION_STOP); resource.post(text); }
@Override public Void call() throws Exception { final WebResource votesResource = client.resource(votesUri); votesResource.post(); return null; } });
public ClientResponse createUserRequest(final String remoteUserEmail) { final Map<String, String> map = new HashMap<String, String>(); map.put("remote_user_email", remoteUserEmail); return super.getWebResource().post(ClientResponse.class, write(map)); }
/** * Enable/Link the given repository * * @param repositoryId The repository to sync */ @Nonnull public void linkRepository(final int repositoryId) { publicApi(repositoryId) .path("enable") .post(); }
@Test public void uploadFile() throws Exception { String address = "http://0.0.0.0:8000/r/upload"; WebResource r = Client.create().resource(address); Form form = new Form(); form.add("name", "test"); form.add("content", "SOME CONTENT GOES HERE"); String s = r.post(String.class, form); System.out.println(s); }
/** {@inheritDoc} */ @Override public void disable(String uid) { if (uid == null || uid.isEmpty()) { throw new IllegalArgumentException(FEATURE_IDENTIFIER_CANNOT_BE_NULL_NOR_EMPTY); } ClientResponse cRes = getStore().path(uid).path(OPERATION_DISABLE).post(ClientResponse.class); if (Status.NOT_FOUND.getStatusCode() == cRes.getStatus()) { throw new FeatureNotFoundException(uid); } }
/** {@inheritDoc} */ @Override public void enable(String uid) { if (uid == null || uid.isEmpty()) { throw new IllegalArgumentException(FEATURE_IDENTIFIER_CANNOT_BE_NULL_NOR_EMPTY); } ClientResponse cRes = getStore().path(uid).path(OPERATION_ENABLE).post(ClientResponse.class); if (Status.NOT_FOUND.getStatusCode() == cRes.getStatus()) { throw new FeatureNotFoundException(uid); } }
@Override protected void processTuple(T t) { if (t instanceof Map) { resource.type(MediaType.APPLICATION_JSON).post(new JSONObject((Map<?, ?>)t).toString()); } else { resource.post(t.toString()); } }
/** {@inheritDoc} */ public void clear() { Util.assertHasLength(url); WebResource wr = getJerseyClient().resource(url).path(RESOURCE_PROPERTYSTORE).path(STORE_CLEAR); if (null != authorization) { wr.header(HEADER_AUTHORIZATION, authorization); } ClientResponse cRes = wr.post(ClientResponse.class); if (Status.OK.getStatusCode() != cRes.getStatus()) { throw new FeatureAccessException("Cannot clear property store - " + cRes.getStatus()); } }
/** {@inheritDoc} */ @Override public void createSchema() { Util.assertHasLength(url); WebResource wr = getJerseyClient().resource(url).path(RESOURCE_STORE).path(STORE_CREATESCHEMA); if (null != authorization) { wr.header(HEADER_AUTHORIZATION, authorization); } ClientResponse cRes = wr.post(ClientResponse.class); if (Status.OK.getStatusCode() != cRes.getStatus()) { throw new FeatureAccessException("Cannot create schema for property store - " + cRes.getStatus()); } }
@Override public Void execute(final CommandContext commandContext) { commandContext.getImJaxrsUrlHelper().user(userId.getId()).path(ImJaxrsUrls.PATH_ACTIVATE_EMAIL) .path(activationCode).post(); return null; }
@Override public Void execute(final CommandContext commandContext) { commandContext.getImJaxrsUrlHelper().selfRegisteredUser().path(userId.getId()).path(PATH_SEND_ACTIVATION_EMAIL) .post(); return null; }
public ClientAuthEntity authorizeClient(ClientEntity clientEntity, String scope) { client.addFilter(new HTTPBasicAuthFilter("manager", "test".getBytes())); WebResource webResource = client.resource("http://localhost:9998/testsuite/rest/clientAuth"); ClientAuthEntity clientAuthEntity = webResource. queryParam("client_id", clientEntity.getClientId()). queryParam("scope", scope). post(ClientAuthEntity.class); return clientAuthEntity; }
@Override public QualifiedUserName execute(final CommandContext commandContext) { final QualifiedUserNameType result = commandContext.getImJaxrsUrlHelper().selfRegisteredUser().path(userId.getId()).path(PATH_ACTIVATE_USER) .path(activationCode).post(QualifiedUserNameType.class); return QualifiedUserName.newInstance(result.getUserName(), result.getTenantName()); }