@Test public void encodeFragment() { assertEquals("Invalid encoded result", "foobar", UriUtils.encodeFragment("foobar", CHARSET)); assertEquals("Invalid encoded result", "foo%20bar", UriUtils.encodeFragment("foo bar", CHARSET)); assertEquals("Invalid encoded result", "foobar/", UriUtils.encodeFragment("foobar/", CHARSET)); }
/** * Encodes the given fragment value. * * @param source must not be {@literal null}. * @return */ public static String encodeFragment(Object source) { Assert.notNull(source, "Fragment value must not be null!"); try { return UriUtils.encodeFragment(source.toString(), ENCODING); } catch (Throwable e) { throw new IllegalStateException(e); } } }
protected String utf8EncodeUriFragment(String consumerHsaId) { try { return UriUtils.encodeFragment(consumerHsaId, "utf-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); // not reachable, tied to "utf-8" } }
/** * Encodes the given fragment value. * * @param source must not be {@literal null}. * @return */ public static String encodeFragment(Object source) { Assert.notNull(source, "Fragment value must not be null!"); try { return UriUtils.encodeFragment(source.toString(), ENCODING); } catch (Throwable o_O) { throw new IllegalStateException(o_O); } } }
private String composeBatchRequestBody(SimpleValidationReport report) throws UnsupportedEncodingException { List<String> events = new ArrayList<>(); events.addAll(getContainerEvents(report)); report.getSimpleSignatureReports().forEach(sigReport -> events.add(createSignatureEvent(sigReport, report.getContainerType(), report.getUserIdentifier()))); StringBuilder requestBodyBuilder = new StringBuilder(); for (String event : events) { String encodedEvent = UriUtils.encodeFragment(event, "UTF-8"); requestBodyBuilder.append(encodedEvent + "\n"); } return requestBodyBuilder.toString(); }
sb.append(encodeFragment(fragment, encoding));
+ UriUtils.encodeFragment(service.getName(), "UTF-8") + "-" + service.getVersion() + ".wsdl", true );
serviceAndVersion = "/" + UriUtils.encodeFragment(serviceName, "UTF-8") + "/" + version; resourcePath = requestURI.substring(requestURI.indexOf(serviceAndVersion) + serviceAndVersion.length()); } catch (UnsupportedEncodingException e1) {