List of usage examples for org.springframework.web.util UriComponentsBuilder queryParam
@Override
public UriComponentsBuilder queryParam(String name, @Nullable Collection<?> values)
From source file:ca.qhrtech.services.implementations.BGGServiceImpl.java
private URI buildUriForQuery(Game game) { UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(BASE_BGG_URL + END_POINT_SEARCH); builder.queryParam("query", game.getName()); builder.queryParam("type", "boardgame"); return builder.build().encode().toUri(); }
From source file:com.playhaven.android.req.OpenRequest.java
@Override protected UriComponentsBuilder createUrl(android.content.Context context) throws PlayHavenException { UriComponentsBuilder builder = super.createUrl(context); builder.queryParam("tz", TimeZoneFormatter.getDefaultTimezone()); SharedPreferences pref = PlayHaven.getPreferences(context); int scount = pref.getInt(SCOUNT, 0); long ssum = pref.getLong(SSUM, 0); long stime = pref.getLong(STIME, 0); ssum += stime;//from w w w . ja va2 s . com builder.queryParam(SCOUNT, scount); builder.queryParam(SSUM, ssum); SharedPreferences.Editor edit = pref.edit(); // Increment count scount++; edit.putInt(SCOUNT, scount); // Clear current game time edit.putLong(STIME, 0); // Don't alter the previous sum until success // Save a start time Calendar rightNow = Calendar.getInstance(); Date date = rightNow.getTime(); edit.putLong(SSTART, date.getTime()); // Commit changes edit.commit(); return builder; }
From source file:org.jasig.cas.web.flow.FrontChannelLogoutAction.java
@Override protected Event doInternalExecute(final HttpServletRequest request, final HttpServletResponse response, final RequestContext context) throws Exception { final List<LogoutRequest> logoutRequests = WebUtils.getLogoutRequests(context); final Integer startIndex = getLogoutIndex(context); if (logoutRequests != null && startIndex != null) { for (int i = startIndex; i < logoutRequests.size(); i++) { final LogoutRequest logoutRequest = logoutRequests.get(i); if (logoutRequest.getStatus() == LogoutRequestStatus.NOT_ATTEMPTED) { // assume it has been successful logoutRequest.setStatus(LogoutRequestStatus.SUCCESS); // save updated index putLogoutIndex(context, i + 1); // redirect to application with SAML logout message final UriComponentsBuilder builder = UriComponentsBuilder .fromHttpUrl(logoutRequest.getService().getId()); builder.queryParam("SAMLRequest", URLEncoder .encode(logoutManager.createFrontChannelLogoutMessage(logoutRequest), "UTF-8")); return result(REDIRECT_APP_EVENT, "logoutUrl", builder.build().toUriString()); }// www .ja v a 2s . c o m } } // no new service with front-channel logout -> finish logout return new Event(this, FINISH_EVENT); }
From source file:com.gooddata.auditevent.AuditEventPageRequest.java
@Override public UriComponentsBuilder updateWithPageParams(final UriComponentsBuilder builder) { UriComponentsBuilder builderWithPaging = super.updateWithPageParams(builder); if (from != null) { builderWithPaging.queryParam("from", from.toDateTime(DateTimeZone.UTC)); }/* ww w. ja v a 2s . c om*/ if (to != null) { builderWithPaging.queryParam("to", to.toDateTime(DateTimeZone.UTC)); } if (type != null) { builderWithPaging.queryParam("type", type); } return builderWithPaging; }
From source file:com.orange.clara.cloud.cf.servicebroker.log.infrastructure.SplunkDashboardUrlFactory.java
@Override public String getAppDashboardUrl(String appGuid) { UriComponentsBuilder urlBuilder = UriComponentsBuilder.fromHttpUrl(logServerUrl); urlBuilder.path(SEARCH_PATH);/*w w w. j av a 2 s .c o m*/ //uncomment to enable auto pause mode //urlBuilder.queryParam("auto_pause", "true"); urlBuilder.queryParam("q", "search index=\"*\" source=\"tcp:12345\" appname=\"" + appGuid + "\""); return urlBuilder.build().encode().toUriString(); }
From source file:de.appsolve.padelcampus.external.cloudflare.CloudFlareApiClient.java
private String getDnsEntriesUrl(String zoneId, String recordType, String recordName) { UriComponentsBuilder builder = UriComponentsBuilder .fromHttpUrl(CLOUDFLARE_API_URL + "zones/" + zoneId + "/dns_records"); if (!StringUtils.isEmpty(recordType)) { builder.queryParam("type", recordType); }//w w w . ja va 2 s . c o m if (!StringUtils.isEmpty(recordName)) { builder.queryParam("name", recordName); } return builder.toUriString(); }
From source file:org.mitre.uma.web.ClaimsCollectionEndpoint.java
@RequestMapping(method = RequestMethod.GET) public String collectClaims(@RequestParam("client_id") String clientId, @RequestParam(value = "redirect_uri", required = false) String redirectUri, @RequestParam("ticket") String ticketValue, @RequestParam(value = "state", required = false) String state, Model m, OIDCAuthenticationToken auth) { ClientDetailsEntity client = clientService.loadClientByClientId(clientId); PermissionTicket ticket = permissionService.getByTicket(ticketValue); if (client == null || ticket == null) { logger.info("Client or ticket not found: " + clientId + " :: " + ticketValue); m.addAttribute(HttpCodeView.CODE, HttpStatus.NOT_FOUND); return HttpCodeView.VIEWNAME; }/*from ww w.j a va 2 s . c o m*/ // we've got a client and ticket, let's attach the claims that we have from the token and userinfo // subject Set<Claim> claimsSupplied = Sets.newHashSet(ticket.getClaimsSupplied()); String issuer = auth.getIssuer(); UserInfo userInfo = auth.getUserInfo(); claimsSupplied.add(mkClaim(issuer, "sub", new JsonPrimitive(auth.getSub()))); if (userInfo.getEmail() != null) { claimsSupplied.add(mkClaim(issuer, "email", new JsonPrimitive(userInfo.getEmail()))); } if (userInfo.getEmailVerified() != null) { claimsSupplied.add(mkClaim(issuer, "email_verified", new JsonPrimitive(userInfo.getEmailVerified()))); } if (userInfo.getPhoneNumber() != null) { claimsSupplied .add(mkClaim(issuer, "phone_number", new JsonPrimitive(auth.getUserInfo().getPhoneNumber()))); } if (userInfo.getPhoneNumberVerified() != null) { claimsSupplied.add(mkClaim(issuer, "phone_number_verified", new JsonPrimitive(auth.getUserInfo().getPhoneNumberVerified()))); } if (userInfo.getPreferredUsername() != null) { claimsSupplied.add(mkClaim(issuer, "preferred_username", new JsonPrimitive(auth.getUserInfo().getPreferredUsername()))); } if (userInfo.getProfile() != null) { claimsSupplied.add(mkClaim(issuer, "profile", new JsonPrimitive(auth.getUserInfo().getProfile()))); } ticket.setClaimsSupplied(claimsSupplied); PermissionTicket updatedTicket = permissionService.updateTicket(ticket); if (Strings.isNullOrEmpty(redirectUri)) { if (client.getClaimsRedirectUris().size() == 1) { redirectUri = client.getClaimsRedirectUris().iterator().next(); // get the first (and only) redirect URI to use here logger.info("No redirect URI passed in, using registered value: " + redirectUri); } else { throw new RedirectMismatchException("Unable to find redirect URI and none passed in."); } } else { if (!client.getClaimsRedirectUris().contains(redirectUri)) { throw new RedirectMismatchException("Claims redirect did not match the registered values."); } } UriComponentsBuilder template = UriComponentsBuilder.fromUriString(redirectUri); template.queryParam("authorization_state", "claims_submitted"); if (!Strings.isNullOrEmpty(state)) { template.queryParam("state", state); } String uriString = template.toUriString(); logger.info("Redirecting to " + uriString); return "redirect:" + uriString; }
From source file:org.springframework.data.web.config.EnableSpringDataWebSupportIntegrationTests.java
@Test // DATACMNS-630 public void createsProxyForInterfaceBasedControllerMethodParameter() throws Exception { WebApplicationContext applicationContext = WebTestUtils.createApplicationContext(SampleConfig.class); MockMvc mvc = MockMvcBuilders.webAppContextSetup(applicationContext).build(); UriComponentsBuilder builder = UriComponentsBuilder.fromUriString("/proxy"); builder.queryParam("name", "Foo"); builder.queryParam("shippingAddresses[0].zipCode", "ZIP"); builder.queryParam("shippingAddresses[0].city", "City"); builder.queryParam("billingAddress.zipCode", "ZIP"); builder.queryParam("billingAddress.city", "City"); builder.queryParam("date", "2014-01-11"); mvc.perform(post(builder.build().toString())).// andExpect(status().isOk());// www.j a v a2 s .co m }
From source file:com.playhaven.android.req.ContentRequest.java
@Override protected UriComponentsBuilder createUrl(Context context) throws PlayHavenException { UriComponentsBuilder builder = super.createUrl(context); if (placementResId != -1) placementTag = context.getResources().getString(placementResId); if (placementTag != null) builder.queryParam("placement_id", placementTag); builder.queryParam("preload", isPreload() ? "1" : "0"); SharedPreferences pref = PlayHaven.getPreferences(context); Calendar rightNow = Calendar.getInstance(); Date date = rightNow.getTime(); long end = date.getTime(); long start = pref.getLong(SSTART, end); long stime = ((end - start) / 1000); // in seconds builder.queryParam(STIME, stime);/*from w w w . j av a2 s . c om*/ // Store current stime for consumption by open requests SharedPreferences.Editor edit = pref.edit(); edit.putLong(STIME, stime); edit.commit(); return builder; }
From source file:com.wavemaker.tools.deployment.tomcat.TomcatManager.java
private String getUrl(String application, Command command) { if (!application.startsWith("/")) { application = "/" + application; }// w ww . ja v a 2 s .c o m UriComponentsBuilder uri = newUriBuilder(); uri.path(this.managerPath); uri.pathSegment(command.toString().toLowerCase()); uri.queryParam("path", application); return uri.build().toUriString(); }