List of usage examples for com.google.gwt.http.client URL encodePathSegment
public static String encodePathSegment(String decodedURLComponent)
From source file:org.dataconservancy.dcs.access.client.SeadApp.java
License:Apache License
private static String encodeURLPath(String path) { return URL.encodePathSegment(path); }
From source file:org.dataconservancy.dcs.access.ui.client.Application.java
License:Apache License
private static String encodeURLPath(String path) { // String s = URL.encodeComponent(path); // Have to encode spaces (now plus) using %20 // return s.replace("+", "%20"); return URL.encodePathSegment(path); }
From source file:org.daxplore.presenter.client.ui.ImageButtonPanel.java
License:Open Source License
private String getCsvDownloadSrc() { String fileName = prefixProperties.getPageTitle() + " - " + queryDefinition.getPerspectiveShortText() + " - " + queryDefinition.getQuestionShortText() + ".csv"; fileName = URL.encodePathSegment(fileName); return baseUrl + "getCsv/" + fileName + "?q=" + queryDefinition.getAsString() + "&l=" + LocaleInfo.getCurrentLocale().getLocaleName() + "&prefix=" + prefixProperties.getPrefix(); }
From source file:org.eclipse.che.ide.ext.ssh.client.manage.SshKeyManagerPresenter.java
License:Open Source License
private void downloadPrivateKey(final String privateKey) { dialogFactory.createConfirmDialog(constant.downloadPrivateKeyTitle(), constant.downloadPrivateKeyMessage(), new ConfirmCallback() { @Override/*w ww. jav a 2s .c o m*/ public void accepted() { Window.open("data:application/x-pem-key," + URL.encodePathSegment(privateKey), "_blank", null); } }, getCancelCallback()).show(); }
From source file:org.eclipse.che.ide.navigation.NavigateToFilePresenter.java
License:Open Source License
private void search(String fileName, final AsyncCallback<List<ItemReference>> callback) { final String url = SEARCH_URL + "/?name=" + URL.encodePathSegment(fileName); final Message message = new MessageBuilder(GET, url).header(ACCEPT, APPLICATION_JSON).build(); final Unmarshallable<List<ItemReference>> unmarshaller = dtoUnmarshallerFactory .newWSListUnmarshaller(ItemReference.class); try {/*from w ww. j a va2s . c o m*/ wsMessageBus.send(message, new RequestCallback<List<ItemReference>>(unmarshaller) { @Override protected void onSuccess(List<ItemReference> result) { callback.onSuccess(result); } @Override protected void onFailure(Throwable exception) { final String message = dtoFactory.createDtoFromJson(exception.getMessage(), ServiceError.class) .getMessage(); callback.onFailure(new Exception(message)); } }); } catch (WebSocketException e) { callback.onFailure(e); } }
From source file:org.eclipse.che.ide.workspace.WorkspaceServiceClient.java
License:Open Source License
/** * Updates command.//ww w . jav a2 s . c om * * @return a promise that resolves to the {@link WorkspaceImpl}, or rejects with an error */ public Promise<WorkspaceImpl> updateCommand(String wsId, String commandName, CommandImpl commandUpdate) { final String url = baseHttpUrl + '/' + wsId + "/command/" + URL.encodePathSegment(commandName); final CommandDto commandDto = dtoFactory.createDto(CommandDto.class).withName(commandUpdate.getName()) .withCommandLine(commandUpdate.getCommandLine()).withType(commandUpdate.getType()) .withAttributes(commandUpdate.getAttributes()); return asyncRequestFactory.createRequest(PUT, url, commandDto, false).header(ACCEPT, APPLICATION_JSON) .header(CONTENT_TYPE, APPLICATION_JSON).loader(loaderFactory.newLoader("Updating command...")) .send(dtoUnmarshallerFactory.newUnmarshaller(WorkspaceDto.class)) .then((Function<WorkspaceDto, WorkspaceImpl>) WorkspaceImpl::new); }
From source file:org.eclipse.che.ide.workspace.WorkspaceServiceClient.java
License:Open Source License
/** * Removes command from workspace.// w w w . ja va 2 s .co m * * @param wsId workspace ID * @param commandName the name of the command to remove * @return a promise that will resolve when the command has been stopped, or rejects with an error */ public Promise<Void> deleteCommand(String wsId, String commandName) { final String url = baseHttpUrl + '/' + wsId + "/command/" + URL.encodePathSegment(commandName); return asyncRequestFactory.createDeleteRequest(url).loader(loaderFactory.newLoader("Deleting command...")) .send(); }
From source file:org.eclipse.che.ide.workspace.WorkspaceServiceClientImpl.java
License:Open Source License
private void updateCommand(@NotNull final String wsId, @NotNull final CommandDto commandUpdate, final String commandName, @NotNull AsyncCallback<WorkspaceDto> callback) { final String url = baseHttpUrl + '/' + wsId + "/command/" + URL.encodePathSegment(commandName); asyncRequestFactory.createRequest(PUT, url, commandUpdate, false).header(ACCEPT, APPLICATION_JSON) .header(CONTENT_TYPE, APPLICATION_JSON).loader(loaderFactory.newLoader("Updating command...")) .send(newCallback(callback, dtoUnmarshallerFactory.newUnmarshaller(WorkspaceDto.class))); }
From source file:org.eclipse.che.ide.workspace.WorkspaceServiceClientImpl.java
License:Open Source License
private void deleteCommand(@NotNull final String wsId, @NotNull final String commandName, @NotNull AsyncCallback<WorkspaceDto> callback) { final String url = baseHttpUrl + '/' + wsId + "/command/" + URL.encodePathSegment(commandName); asyncRequestFactory.createDeleteRequest(url).header(ACCEPT, APPLICATION_JSON) .loader(loaderFactory.newLoader("Deleting command...")) .send(newCallback(callback, dtoUnmarshallerFactory.newUnmarshaller(WorkspaceDto.class))); }
From source file:org.gss_project.gss.web.client.commands.GetUserCommand.java
License:Open Source License
@Override public void execute() { String path = GSS.get().getApiPath() + "users/" + URL.encodePathSegment(userName); GetCommand<UserSearchResource> gg = new GetCommand<UserSearchResource>(UserSearchResource.class, path, false, null) {/*from ww w.jav a2 s.c o m*/ @Override public void onComplete() { final UserSearchResource result = getResult(); for (UserResource user : result.getUsers()) { String username = user.getUsername(); String _userFullName = user.getName(); GSS.get().putUserToMap(username, _userFullName); } } @Override public void onError(Throwable t) { GWT.log("", t); GSS.get().displayError("Unable to fetch user's full name from the given username " + userName); } }; DeferredCommand.addCommand(gg); }