private static UriBuilder setQueryParam(UriBuilder uriBuilder, String name, Object[] values) { if (values == null || values.length == 0 || (values.length == 1 && values[0] == null)) { return uriBuilder.replaceQueryParam(name, (Object[]) null); } checkForNullValues(name, values); return uriBuilder.queryParam(name, values); }
private static UriBuilder setQueryParam(UriBuilder uriBuilder, String name, Object[] values) { if (values == null || values.length == 0 || (values.length == 1 && values[0] == null)) { return uriBuilder.replaceQueryParam(name, (Object[]) null); } checkForNullValues(name, values); return uriBuilder.queryParam(name, values); }
public static URI updateWithQueryParameters( URI uri, Map<String, String> queryParameters) { if ((queryParameters == null) || queryParameters.isEmpty()) { return uri; } for (Map.Entry<String, String> parameter : queryParameters.entrySet()) { UriBuilder uriBuilder = UriBuilder.fromUri(uri); uri = uriBuilder.replaceQueryParam( parameter.getKey(), parameter.getValue() ).build(); } return uri; }
private static UriBuilder setQueryParam(UriBuilder uriBuilder, String name, Object[] values) { if (values == null || values.length == 0 || (values.length == 1 && values[0] == null)) { return uriBuilder.replaceQueryParam(name, (Object[]) null); } checkForNullValues(name, values); return uriBuilder.queryParam(name, values); }
public static URI updateWithQueryParameters( String url, Map<String, String> queryParameters) { if ((queryParameters == null) || queryParameters.isEmpty()) { return getURI(url); } URI uri = null; for (Map.Entry<String, String> parameter : queryParameters.entrySet()) { UriBuilder uriBuilder = UriBuilder.fromUri(url); uri = uriBuilder.replaceQueryParam( parameter.getKey(), parameter.getValue() ).build(); } return uri; }
@Override public ResteasyWebTarget queryParam(String name, Object... values) throws NullPointerException { client.abortIfClosed(); if (name == null) throw new NullPointerException(Messages.MESSAGES.nameWasNull()); UriBuilder copy = uriBuilder.clone(); if (values == null || (values.length == 1 && values[0] == null)) { copy.replaceQueryParam(name, null); } else { String[] stringValues = toStringValues(values); copy.queryParam(name, stringValues); } return newInstance(client, copy, configuration); }
public LinkBuilder replaceQueryParam(String name, Object... values) throws IllegalArgumentException { uriBuilder.replaceQueryParam(name, values); return this; }
public Builder<T> setLinks(String self, int limit) { this.self = UriBuilder.fromUri(self).replaceQueryParam("startAt", startAt).replaceQueryParam("maxResults", limit).build(); if (!isLastPage) { this.nextPage = UriBuilder.fromUri(self).replaceQueryParam("startAt", startAt + values.size()).replaceQueryParam("maxResults", limit).build(); } return this; }
public static URI setHostsOverride(URI location, String... hosts) { return UriBuilder.fromUri(location) .replaceQueryParam(HOST_PARAM, hosts) .build(); }
public static URI setZkConnectionStringOverride(URI location, String zkConnectionString) { return UriBuilder.fromUri(location) .replaceQueryParam(ZK_CONNECTION_STRING_PARAM, zkConnectionString) .build(); }
/** * strip out unwanted query parameters and redirect so bookmarks don't retain oauth protocol bits */ protected String stripOauthParametersFromRedirect() { StringBuffer buf = request.getRequestURL().append("?").append(request.getQueryString()); UriBuilder builder = UriBuilder.fromUri(buf.toString()) .replaceQueryParam("code", null) .replaceQueryParam("state", null); return builder.build().toString(); }
/** * Replaces the current query with the new value. * @param queryParam query param name * @param value the new value, providing a null is * equivalent to calling resetQuery(). * @return updated WebClient */ public WebClient replaceQueryParam(String queryParam, Object... value) { getCurrentBuilder().replaceQueryParam(queryParam, value); return this; }
/** * Replaces the current query with the new value. * @param queryParam query param name * @param value the new value, providing a null is * equivalent to calling resetQuery(). * @return updated WebClient */ public WebClient replaceQueryParam(String queryParam, Object... value) { getCurrentBuilder().replaceQueryParam(queryParam, value); return this; }
private static UriBuilder setQueryParam(UriBuilder uriBuilder, String name, Object[] values) { if (values == null || values.length == 0 || (values.length == 1 && values[0] == null)) { return uriBuilder.replaceQueryParam(name, (Object[]) null); } checkForNullValues(name, values); return uriBuilder.queryParam(name, values); }
private static UriBuilder setQueryParam(UriBuilder uriBuilder, String name, Object[] values) { if (values == null || values.length == 0 || (values.length == 1 && values[0] == null)) { return uriBuilder.replaceQueryParam(name, (Object[]) null); } checkForNullValues(name, values); return uriBuilder.queryParam(name, values); }
protected HALLink createHALLinkFromURIWithModifiedPageNumber(URI requestURI, int pageNumber){ UriBuilder hrefBuilder = UriBuilder.fromUri(requestURI); hrefBuilder.replaceQueryParam(AbstractWebResource.QUERY_PARAM_PAGE, pageNumber); HALLink link = new HALLink.Builder(hrefBuilder.build()).build(); return link; }
@Override public WebTarget queryParam(String name, Object... values) { checkClosed(); checkNullValues(name, values); UriBuilder thebuilder = getUriBuilder(); if (values == null || values.length == 1 && values[0] == null) { thebuilder.replaceQueryParam(name, (Object[])null); } else { thebuilder.queryParam(name, values); } return newWebTarget(thebuilder); }
@Override public WebTarget queryParam(String name, Object... values) { checkClosed(); checkNullValues(name, values); UriBuilder thebuilder = getUriBuilder(); if (values == null || values.length == 1 && values[0] == null) { thebuilder.replaceQueryParam(name, (Object[])null); } else { thebuilder.queryParam(name, values); } return newWebTarget(thebuilder); }
@Override protected Model loadEntity(ClientResponse response) { Model model = ModelFactory.createDefaultModel(); model.read(response.getEntityInputStream(), null, "JSONLD"); // remove the flag=fs query param from the url if there. Any gedcomx-java hyperlinks used to get to this endpoint would have the flag=fs parameter // as of 06/14/2018. This Uri becomes the name/id of the Resource object and should not have that query param as part of the name/id for // getVocabElementList() to work. this.resourceDescribingList = model.getResource(UriBuilder.fromUri(this.request.getURI()).replaceQueryParam("flag", (Object[]) null).build().toString()); // this.resourceDescribingList = model.getResource(this.request.getURI().toString()); return model; }
public PersonMatchResultsState updateMatchStatus(Entry entry, MatchStatus status, StateTransitionOption... options) { URI updateStatusUri = UriBuilder.fromUri(getSelfUri()).replaceQueryParam(FamilySearchOptions.STATUS, status.name().toLowerCase()).build(); ClientRequest request = createAuthenticatedRequest() .type(GedcomxConstants.GEDCOMX_JSON_MEDIA_TYPE) .accept(AtomModel.ATOM_GEDCOMX_JSON_MEDIA_TYPE) .entity(new Gedcomx().person(new Person().identifier(new Identifier(entry.getId(), IdentifierType.Persistent)))) .build(updateStatusUri, HttpMethod.POST); return ((FamilySearchStateFactory)this.stateFactory).newPersonMatchResultsState(request, invoke(request, options), this.accessToken); }