List of usage examples for com.google.gwt.http.client RequestBuilder PUT
Method PUT
To view the source code for com.google.gwt.http.client RequestBuilder PUT.
Click Source Link
From source file:org.bonitasoft.web.toolkit.client.data.api.APICaller.java
License:Open Source License
/** * Update an item using its ID by submitting a HashMap *//*from w w w .j av a 2 s .c om*/ public void update(final APIID apiId, final Map<String, String> attributesToUpdate, final APICallback callback) { // Apply validators if (this.itemDefinition != null) { ModifierEngine.modify(attributesToUpdate, this.itemDefinition.getInputModifiers()); ValidatorEngine.validate(attributesToUpdate, this.itemDefinition.getValidators()); } this.send(RequestBuilder.PUT, this.url + "/" + apiId.toString(), JSonItemWriter.mapToJSON(attributesToUpdate), HttpRequest.CONTENT_TYPE_JSON, callback); }
From source file:org.bonitasoft.web.toolkit.client.data.api.request.APIUpdateRequest.java
License:Open Source License
@Override public void run() { this.request = new RequestBuilder(RequestBuilder.PUT, this.itemDefinition.getAPIUrl() + "/" + this.id); super.run();//from w w w.j a va 2 s. c o m }
From source file:org.eclipse.che.api.factory.gwt.client.FactoryServiceClientImpl.java
License:Open Source License
@Override public Promise<Factory> updateFactory(String id, Factory factory) { return asyncRequestFactory.createRequest(RequestBuilder.PUT, API_FACTORY_BASE_URL + id, factory, false) .header(HTTPHeader.CONTENT_TYPE, MimeType.APPLICATION_JSON) .loader(loaderFactory.newLoader("Updating factory...")) .send(unmarshallerFactory.newUnmarshaller(Factory.class)); }
From source file:org.eclipse.che.ide.api.workspace.WorkspaceServiceClientImpl.java
License:Open Source License
@Override public Promise<WorkspaceDto> update(String wsId, WorkspaceDto workspaceDto) { final String url = baseHttpUrl + '/' + wsId; return asyncRequestFactory.createRequest(RequestBuilder.PUT, url, workspaceDto, true) .send(dtoUnmarshallerFactory.newUnmarshaller(WorkspaceDto.class)); }
From source file:org.eclipse.che.ide.ext.github.client.GitHubClientServiceImpl.java
License:Open Source License
@Override public Promise<GitHubPullRequest> updatePullRequest(String owner, String repository, String pullRequestId, GitHubPullRequest updateInput) { final String url = baseUrl + PULL_REQUEST + '/' + owner + '/' + repository + '/' + pullRequestId; return asyncRequestFactory.createRequest(RequestBuilder.PUT, url, updateInput, false).loader(loader) .send(dtoUnmarshallerFactory.newUnmarshaller(GitHubPullRequest.class)); }
From source file:org.eclipse.che.ide.factory.FactoryServiceClientImpl.java
License:Open Source License
@Override public Promise<FactoryDto> updateFactory(String id, FactoryDto factory) { return asyncRequestFactory.createRequest(RequestBuilder.PUT, API_FACTORY_BASE_URL + id, factory, false) .header(HTTPHeader.CONTENT_TYPE, MimeType.APPLICATION_JSON) .loader(loaderFactory.newLoader("Updating factory...")) .send(unmarshallerFactory.newUnmarshaller(FactoryDto.class)); }
From source file:org.eclipse.che.ide.rest.AsyncRequestFactory.java
License:Open Source License
/** * Creates new PUT request to the specified {@code url} with the provided {@code data}. * * @param url//from w ww .j ava2 s. com * request URL * @param dtoData * the DTO to send as body of the request. Must implement {@link org.eclipse.che.ide.dto.JsonSerializable} interface. May be {@code * null}. * @param async * if <b>true</b> - request will be sent in asynchronous mode * @return new {@link AsyncRequest} instance to send POST request */ public AsyncRequest createPutRequest(String url, Object dtoData, boolean async) { return createRequest(RequestBuilder.PUT, url, dtoData, async); }
From source file:org.eclipse.che.multiuser.keycloak.ide.KeycloakAsyncRequestFactory.java
License:Open Source License
@Override protected AsyncRequest doCreateRequest(RequestBuilder.Method method, String url, Object dtoBody, boolean async) { AsyncRequest request = super.doCreateRequest(method, url, dtoBody, async); if (!isWsAgentRequest(url) && !keycloakProvider.isKeycloakDisabled()) { AsyncRequest asyncRequest = new KeycloakAsyncRequest(keycloakProvider, method, url, async); if (dtoBody != null) { if (dtoBody instanceof List<?>) { asyncRequest.data(dtoFactory.toJson((List<?>) dtoBody)); } else if (dtoBody instanceof String) { asyncRequest.data((String) dtoBody); } else { asyncRequest.data(dtoFactory.toJson(dtoBody)); }/* w w w . j av a 2 s . co m*/ asyncRequest.header(HTTPHeader.CONTENT_TYPE, MimeType.APPLICATION_JSON); } else if (method.equals(RequestBuilder.POST) || method.equals(RequestBuilder.PUT)) { /* Here we need to setup wildcard mime type in content-type header, because CORS filter responses with 403 error in case if user makes POST/PUT request with null body and without content-type header. Setting content-type header with wildcard mime type solves this problem. Note, this issue need to be investigated, because the problem may be occurred as a bug in CORS filter. */ asyncRequest.header(HTTPHeader.CONTENT_TYPE, MimeType.WILDCARD); } return asyncRequest; } return request; }
From source file:org.eclipse.che.multiuser.machine.authentication.ide.MachineAsyncRequestFactory.java
License:Open Source License
private boolean isModifyingMethod(RequestBuilder.Method method) { return method == RequestBuilder.POST || method == RequestBuilder.PUT || method == RequestBuilder.DELETE; }
From source file:org.eclipse.che.plugin.github.ide.GitHubClientServiceImpl.java
License:Open Source License
@Override public Promise<GitHubPullRequest> updatePullRequest(String owner, String repository, String pullRequestId, GitHubPullRequest updateInput) { final String url = baseUrl() + PULL_REQUEST + '/' + owner + '/' + repository + '/' + pullRequestId; return asyncRequestFactory.createRequest(RequestBuilder.PUT, url, updateInput, false).loader(loader) .send(dtoUnmarshallerFactory.newUnmarshaller(GitHubPullRequest.class)); }