@Override public void configure(final Message capabilitiesMessage) { configured = true; if (!isSSESupported()) { hosed = true; unsupportedReason = UNSUPPORTED_MESSAGE_NO_SERVER_SUPPORT; logger.warn("this browser does not support SSE"); return; } this.sseEntryPoint = URL.encode(clientMessageBus.getApplicationLocation(clientMessageBus.getInServiceEntryPoint())) + "?&sse=1&clientId=" + URL.encodePathSegment(clientMessageBus.getClientId()); }
for (final Map.Entry<String, String> entry : parmsMap.entrySet()) { extraParmsString.append("&").append( URL.encodePathSegment(entry.getKey())).append("=").append(URL.encodePathSegment(entry.getValue()) ); RequestBuilder.POST, URL.encode(messageBus.getApplicationLocation(serviceEntryPoint)) + "?z=" + getNextRequestNumber() + "&clientId=" + URL.encodePathSegment(messageBus.getClientId()) + extraParmsString.toString() ); builder.setHeader("Content-Type", "application/json; charset=utf-8");
@Override public String encodePathSegment(String decodedPathSegment) { return URL.encodePathSegment(decodedPathSegment); }
@Override public String encodePathSegment(String decodedPathSegment) { return URL.encodePathSegment(decodedPathSegment); }
@Override public String encodePathSegment(String decodedURLComponent) { return URL.encodePathSegment(decodedURLComponent); }
public static String mergeDcAndCluster(String dataCenter, String cluster, boolean toEncode) { if (StringHelper.isNullOrEmpty(cluster)) { return toEncode ? URL.encodePathSegment(dataCenter) : dataCenter; } return toEncode ? URL.encodePathSegment(dataCenter) + "/" //$NON-NLS-1$ + URL.encodePathSegment(cluster) : dataCenter + "/" //$NON-NLS-1$ + cluster; }
public String getEncodedPathWithParameters() { StringBuilder builder = new StringBuilder(URL.encodePathSegment(path)); for (String matrixParamName : matrixParameters.keySet()) { builder .append(";" + matrixParamName + "=") .append(URL.encodePathSegment(matrixParameters.getFirst(matrixParamName))); } return builder.toString(); }
if (pathSegments != null && pathSegments.length > 0) { for (final String segment : pathSegments) { pathBuilder.append(URL.encodePathSegment(segment)); pathBuilder.append(';').append(URL.encodePathSegment(param)); } else { pathBuilder.append(';').append(URL.encodePathSegment(param)); if (value != null) { pathBuilder.append('=').append(URL.encodePathSegment(value));
@Override public void configure(final Message capabilitiesMessage) { configured = true; if (!isSSESupported()) { hosed = true; unsupportedReason = UNSUPPORTED_MESSAGE_NO_SERVER_SUPPORT; logger.warn("this browser does not support SSE"); return; } this.sseEntryPoint = URL.encode(clientMessageBus.getApplicationLocation(clientMessageBus.getInServiceEntryPoint())) + "?&sse=1&clientId=" + URL.encodePathSegment(clientMessageBus.getClientId()); }
/** * Removes command from workspace. * * @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(); } }
for (final Map.Entry<String, String> entry : parmsMap.entrySet()) { extraParmsString.append("&").append( URL.encodePathSegment(entry.getKey())).append("=").append(URL.encodePathSegment(entry.getValue()) ); RequestBuilder.POST, URL.encode(messageBus.getApplicationLocation(serviceEntryPoint)) + "?z=" + getNextRequestNumber() + "&clientId=" + URL.encodePathSegment(messageBus.getClientId()) + extraParmsString.toString() ); builder.setHeader("Content-Type", "application/json; charset=utf-8");
/** * Creates the file by given {@code path} with given {@code content}. Content may be an empty. * * @param path path to the future file * @param content the file content * @return {@link Promise} with the {@link ItemReference} * @see ItemReference * @see Path * @since 4.4.0 */ public Promise<ItemReference> createFile(Path path, String content) { final String url = getBaseUrl() + FILE + encodePath(path.parent()) + "?name=" + encodePathSegment(path.lastSegment()); return reqFactory .createPostRequest(url, null) .data(content) .loader(loaderFactory.newLoader("Creating file...")) .send(unmarshaller.newUnmarshaller(ItemReference.class)); }
/** * Updates command. * * @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); }