List of usage examples for com.google.common.net UrlEscapers urlFragmentEscaper
public static Escaper urlFragmentEscaper()
From source file:com.aliyuncs.fc.auth.AcsURLEncoder.java
/** * used for encoding url path segment/*from w ww . j av a2 s .c o m*/ */ public static String urlEncode(String path) throws URISyntaxException { if (isNullOrEmpty(path)) return path; return UrlEscapers.urlFragmentEscaper().escape(path); }
From source file:com.spectralogic.ds3client.commands.spectrads3.PutGroupSpectraS3Request.java
public PutGroupSpectraS3Request(final String name) { this.name = name; this.getQueryParams().put("name", UrlEscapers.urlFragmentEscaper().escape(name).replace("+", "%2B")); }
From source file:helper.DefaultLabelResolver.java
private static String lookup(String uri, String language, RDFFormat format, String accept) { List<String> collectLabels = new ArrayList<>(); try {/*from w w w. jav a 2s . c o m*/ String ecodedUri = UrlEscapers.urlFragmentEscaper().escape(uri).replaceAll(" ", "%20").replaceAll(",", "%2C"); Collection<Statement> statements = RdfUtils.readRdfToGraph(new URL(ecodedUri), format, accept); List<Statement> prefLabels = statements.stream().filter((s) -> { boolean isLabel = prefLabel.equals(s.getPredicate().stringValue()); boolean isSubjectOfInterest = ecodedUri.equals(s.getSubject().stringValue()); return isLabel && isSubjectOfInterest; }).collect(Collectors.toList()); for (Statement s : prefLabels) { if (s.getObject() instanceof Literal) { Literal literal = normalizeLiteral((Literal) s.getObject()); collectLabels.add(literal.stringValue()); String label = getLabelInLanguage(literal, language); if (label != null) return label; } } } catch (Exception e) { throw new RuntimeException(e); } if (collectLabels.isEmpty()) return uri; return collectLabels.toString(); }
From source file:com.spectralogic.ds3client.commands.spectrads3.DelegateCreateUserSpectraS3Request.java
public DelegateCreateUserSpectraS3Request(final String name) { this.name = name; this.getQueryParams().put("name", UrlEscapers.urlFragmentEscaper().escape(name).replace("+", "%2B")); }
From source file:com.spectralogic.ds3client.commands.spectrads3.PutPoolPartitionSpectraS3Request.java
public PutPoolPartitionSpectraS3Request(final String name, final PoolType type) { this.name = name; this.type = type; this.getQueryParams().put("name", UrlEscapers.urlFragmentEscaper().escape(name).replace("+", "%2B")); this.getQueryParams().put("type", type.toString()); }
From source file:com.spectralogic.ds3client.commands.spectrads3.PutBucketSpectraS3Request.java
public PutBucketSpectraS3Request(final String name) { this.name = name; this.getQueryParams().put("name", UrlEscapers.urlFragmentEscaper().escape(name).replace("+", "%2B")); }
From source file:com.spectralogic.ds3client.commands.spectrads3.PutGlobalDataPolicyAclForUserSpectraS3Request.java
public PutGlobalDataPolicyAclForUserSpectraS3Request(final String userId) { this.userId = userId; this.getQueryParams().put("user_id", UrlEscapers.urlFragmentEscaper().escape(userId).replace("+", "%2B")); }
From source file:com.spectralogic.ds3client.commands.spectrads3.PutGlobalDataPolicyAclForGroupSpectraS3Request.java
public PutGlobalDataPolicyAclForGroupSpectraS3Request(final String groupId) { this.groupId = groupId; this.getQueryParams().put("group_id", UrlEscapers.urlFragmentEscaper().escape(groupId).replace("+", "%2B")); }
From source file:com.spectralogic.ds3client.commands.spectrads3.GetJobChunksReadyForClientProcessingSpectraS3Request.java
public GetJobChunksReadyForClientProcessingSpectraS3Request(final String job) { this.job = job; this.getQueryParams().put("job", UrlEscapers.urlFragmentEscaper().escape(job).replace("+", "%2B")); }
From source file:ratpack.http.internal.DefaultHttpUriBuilder.java
@Override public HttpUriBuilder host(String host) { escaper = UrlEscapers.urlFragmentEscaper(); this.host = escaper.escape(host); return this; }