List of usage examples for org.apache.http.client.utils URIBuilder addParameter
public URIBuilder addParameter(final String param, final String value)
From source file:com.github.tmyroadctfig.icloud4j.ICloudService.java
/** * Populates the URI parameters for a request. * * @param uriBuilder the URI builder./*from w w w . jav a2s .co m*/ */ public void populateUriParameters(URIBuilder uriBuilder) { uriBuilder.addParameter("clientId", getClientId()).addParameter("clientBuildNumber", clientBuildNumber); String dsid = getSessionId(); if (!Strings.isNullOrEmpty(dsid)) { uriBuilder.addParameter("dsid", dsid); } }
From source file:com.collective.celos.CelosClient.java
public void rerunSlot(WorkflowID workflowID, ScheduledTime scheduledTime) throws Exception { URIBuilder uriBuilder = new URIBuilder(address); uriBuilder.setPath(uriBuilder.getPath() + RERUN_PATH); uriBuilder.addParameter(ID_PARAM, workflowID.toString()); uriBuilder.addParameter(TIME_PARAM, scheduledTime.toString()); executePost(uriBuilder.build());//from ww w . ja v a 2 s. co m }
From source file:com.collective.celos.CelosClient.java
public void setWorkflowPaused(WorkflowID workflowID, Boolean paused) throws Exception { URIBuilder uriBuilder = new URIBuilder(address); uriBuilder.setPath(uriBuilder.getPath() + PAUSE_PATH); uriBuilder.addParameter(ID_PARAM, workflowID.toString()); uriBuilder.addParameter(PAUSE_NODE, paused.toString()); executePost(uriBuilder.build());//from w w w .ja v a2 s.com }
From source file:com.collective.celos.CelosClient.java
public void deleteRegistersWithPrefix(BucketID bucket, String prefix) throws Exception { URIBuilder uriBuilder = new URIBuilder(address); uriBuilder.setPath(uriBuilder.getPath() + REGISTER_PATH); uriBuilder.addParameter(BUCKET_PARAM, bucket.toString()); uriBuilder.addParameter(PREFIX_PARAM, prefix); executeDelete(uriBuilder.build());//from w w w . j a v a 2s . c om }
From source file:io.fabric8.etcd.impl.dsl.DeleteDataImpl.java
@Override public HttpUriRequest createRequest(OperationContext context) { try {/*from ww w .j a va 2 s . com*/ URIBuilder builder = new URIBuilder(context.getBaseUri()).setPath(Keys.makeKey(key)) .addParameter("dir", String.valueOf(dir)).addParameter("recursive", String.valueOf(recursive)) .addParameter("prevExists", String.valueOf(prevExists)); if (prevValue != null) { builder = builder.addParameter("prevValue", prevValue).addParameter("prevIndex", String.valueOf(prevIndex)); } return new HttpDelete(builder.build()); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:com.collective.celos.CelosClient.java
/** * Deletes the specified register value. *//*from w w w .ja va2s . co m*/ public void deleteRegister(BucketID bucket, RegisterKey key) throws Exception { URIBuilder uriBuilder = new URIBuilder(address); uriBuilder.setPath(uriBuilder.getPath() + REGISTER_PATH); uriBuilder.addParameter(BUCKET_PARAM, bucket.toString()); uriBuilder.addParameter(KEY_PARAM, key.toString()); executeDelete(uriBuilder.build()); }
From source file:com.collective.celos.CelosClient.java
/** * Sets the specified register value./*from w ww .j a va 2 s.co m*/ */ public void putRegister(BucketID bucket, RegisterKey key, JsonNode value) throws Exception { URIBuilder uriBuilder = new URIBuilder(address); uriBuilder.setPath(uriBuilder.getPath() + REGISTER_PATH); uriBuilder.addParameter(BUCKET_PARAM, bucket.toString()); uriBuilder.addParameter(KEY_PARAM, key.toString()); executePut(uriBuilder.build(), new StringEntity(Util.JSON_WRITER.writeValueAsString(value), StandardCharsets.UTF_8)); }
From source file:com.collective.celos.CelosClient.java
public SlotState getSlotState(WorkflowID workflowID, ScheduledTime scheduledTime) throws Exception { URIBuilder uriBuilder = new URIBuilder(address); uriBuilder.setPath(uriBuilder.getPath() + SLOT_STATE_PATH); uriBuilder.addParameter(ID_PARAM, workflowID.toString()); uriBuilder.addParameter(TIME_PARAM, scheduledTime.toString()); HttpGet workflowListGet = new HttpGet(uriBuilder.build()); HttpResponse getResponse = execute(workflowListGet); InputStream content = getResponse.getEntity().getContent(); return SlotState.fromJSONNode(workflowID, Util.JSON_READER.withType(ObjectNode.class).readValue(content)); }
From source file:org.wso2.carbon.identity.application.authentication.framework.handler.request.impl.DefaultPostAuthenticationHandler.java
private void handlePostAuthenticationForMissingClaimsRequest(HttpServletRequest request, HttpServletResponse response, AuthenticationContext context) throws FrameworkException { AuthenticatedUser user = context.getSequenceConfig().getAuthenticatedUser(); if (user == null) { // no authenticated user found. Cannot process claims context.setProperty(FrameworkConstants.POST_AUTHENTICATION_EXTENSION_COMPLETED, true); return;//from w w w . j a v a 2 s . c o m } Map<String, String> mappedAttrs = new HashMap<>(); Map<ClaimMapping, String> userAttributes = user.getUserAttributes(); if (userAttributes != null) { Map<String, String> spToCarbonClaimMapping = new HashMap<>(); Object object = context.getProperty(FrameworkConstants.SP_TO_CARBON_CLAIM_MAPPING); if (object != null && object instanceof Map) { spToCarbonClaimMapping = (Map<String, String>) object; } for (Map.Entry<ClaimMapping, String> entry : userAttributes.entrySet()) { String localClaimUri = entry.getKey().getLocalClaim().getClaimUri(); //getting the carbon claim uri mapping for other claim dialects if (MapUtils.isNotEmpty(spToCarbonClaimMapping) && spToCarbonClaimMapping.get(localClaimUri) != null) { localClaimUri = spToCarbonClaimMapping.get(localClaimUri); } mappedAttrs.put(localClaimUri, entry.getValue()); } } Map<String, String> mandatoryClaims = context.getSequenceConfig().getApplicationConfig() .getMandatoryClaimMappings(); String missingClaims = getMissingClaims(mappedAttrs, mandatoryClaims); if (StringUtils.isNotBlank(missingClaims)) { if (log.isDebugEnabled()) { log.debug("Mandatory claims missing for the application : " + missingClaims); } //need to request for the missing claims before completing authentication request.setAttribute(FrameworkConstants.RequestParams.FLOW_STATUS, AuthenticatorFlowStatus.INCOMPLETE); context.setProperty(FrameworkConstants.POST_AUTHENTICATION_EXTENSION_COMPLETED, false); try { URIBuilder uriBuilder = new URIBuilder("/authenticationendpoint/claims.do"); uriBuilder.addParameter(FrameworkConstants.MISSING_CLAIMS, missingClaims); uriBuilder.addParameter(FrameworkConstants.SESSION_DATA_KEY, context.getContextIdentifier()); uriBuilder.addParameter("spName", context.getSequenceConfig().getApplicationConfig().getApplicationName()); response.sendRedirect(uriBuilder.build().toString()); context.setProperty(FrameworkConstants.POST_AUTHENTICATION_REDIRECTION_TRIGGERED, true); if (log.isDebugEnabled()) { log.debug("Redirecting to outside to pick mandatory claims"); } } catch (IOException e) { throw new FrameworkException("Error while redirecting to request claims", e); } catch (URISyntaxException e) { throw new FrameworkException("Error while building redirect URI", e); } } else { context.setProperty(FrameworkConstants.POST_AUTHENTICATION_EXTENSION_COMPLETED, true); } }
From source file:org.yql4j.YqlQuery.java
/** * Returns a newly constructed URI for this query. * //from www . j a v a2 s . c o m * @return the URI */ private URI compileUri() { try { boolean oAuth = (consumerKey != null) && (consumerSecret != null); boolean aliasQuery = queryString == null; String baseUri = oAuth ? QUERY_URL_OAUTH : QUERY_URL_PUBLIC; if (aliasQuery) { baseUri += "/" + aliasPrefix + "/" + aliasName; } URIBuilder builder = new URIBuilder(baseUri); // Set parameters builder.addParameter("diagnostics", Boolean.toString(diagnostics)); for (String env : environmentFiles) { builder.addParameter("env", env); } if (format != null) { builder.addParameter("format", format.name().toLowerCase()); } if (!aliasQuery) { String useTablesPrefix = ""; for (Entry<String, String> entry : tableFiles.entrySet()) { useTablesPrefix += "USE '" + entry.getKey() + "' AS " + entry.getValue() + "; "; } builder.addParameter("q", useTablesPrefix + queryString); } for (Entry<String, String> varDef : variables.entrySet()) { builder.addParameter(varDef.getKey(), varDef.getValue()); } return builder.build(); } catch (URISyntaxException e) { logger.error(e.getMessage(), e); return null; } }