List of usage examples for org.apache.commons.httpclient URI setEscapedPath
public void setEscapedPath(String escapedPath) throws URIException
From source file:davmail.exchange.dav.DavExchangeSession.java
protected String getEscapedUrlFromPath(String escapedPath) throws URIException { URI uri = new URI(httpClient.getHostConfiguration().getHostURL(), true); uri.setEscapedPath(escapedPath); return uri.getEscapedURI(); }
From source file:org.parosproxy.paros.core.scanner.VariantDdnPath.java
private String setParameter(HttpMessage msg, NameValuePair originalPair, String name, String value, boolean escaped) { URI uri = msg.getRequestHeader().getURI(); String[] paths = uri.getEscapedPath().split("/"); if (originalPair.getPosition() < paths.length) { String encodedValue = (escaped) ? value : getEscapedValue(value); paths[originalPair.getPosition()] = encodedValue; String path = String.join("/", paths); try {//ww w . j a v a2 s . c om uri.setEscapedPath(path); } catch (URIException e) { // Looks like it wasn't escaped after all try { uri.setPath(path); } catch (URIException e1) { LOGGER.debug(e1.getMessage(), e1); } LOGGER.warn(e.getMessage(), e); } } return value; }
From source file:org.parosproxy.paros.core.scanner.VariantURLPath.java
/** * * @param msg//from ww w .j ava2 s . c o m * @param originalPair * @param name * @param value * @param escaped * @return */ private String setParameter(HttpMessage msg, NameValuePair originalPair, String name, String value, boolean escaped) { try { URI uri = msg.getRequestHeader().getURI(); String[] paths = msg.getRequestHeader().getURI().getPath().toString().split("/"); if (originalPair.getPosition() < paths.length) { String encodedValue = (escaped) ? value : getEscapedValue(value); paths[originalPair.getPosition()] = encodedValue; String path = StringUtils.join(paths, "/"); try { uri.setEscapedPath(path); } catch (URIException e) { // Looks like it wasnt escaped after all uri.setPath(path); } } } catch (URIException e) { logger.error(e.getMessage(), e); } return value; }