/** * Sets the URI for this method. * * @param uri URI to be set * * @throws URIException if a URI cannot be set * * @since 3.0 */ public void setURI(URI uri) throws URIException { // only set the host if specified by the URI if (uri.isAbsoluteURI()) { this.httphost = new HttpHost(uri); } // set the path, defaulting to root setPath( uri.getPath() == null ? "/" : uri.getEscapedPath() ); setQueryString(uri.getEscapedQuery()); }
private static String createBaseUriWithCleanedPath( org.apache.commons.httpclient.URI uri, HandleParametersOption handleParameters, boolean handleODataParametersVisited) throws URIException { StringBuilder uriBuilder = new StringBuilder(createBaseUri(uri)); uriBuilder.append(getCleanedPath(uri.getEscapedPath(), handleParameters, handleODataParametersVisited)); return uriBuilder.toString(); }
private static void logBadRequest(HttpMessage msg, Exception cause) { logger.warn( "Bad request to API endpoint [" + msg.getRequestHeader().getURI().getEscapedPath() + "] from [" + msg.getRequestHeader().getSenderAddress().getHostAddress() + "]:", cause); }
protected String encodeAndFixUrl(String url) throws URIException { String originalUrl = URIUtil.encodePath(url); if (restoreHostName && originalUrl.startsWith("http")) { String targetPath = new URI(originalUrl, true).getEscapedPath(); originalUrl = getEscapedUrlFromPath(targetPath); } return originalUrl; }
String fullpath = baseUri.getEscapedPath(); if (fullpath == null) { fullpath = "";
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 { 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; } }
String fullfilename = responseMessage.getRequestHeader().getURI().getEscapedPath(); if (fullfilename != null && (SVN_SQLITE_FILENAME_PATTERN.matcher(fullfilename).find() || SVN_XML_FILENAME_PATTERN.matcher(fullfilename).find()
/** * Sets the URI for this method. * * @param uri URI to be set * * @throws URIException if a URI cannot be set * * @since 3.0 */ @Override public void setURI(URI uri) throws URIException { // only set the host if specified by the URI if (uri.isAbsoluteURI()) { this.httphost = new HttpHost(uri); } // set the path, defaulting to root setPath( uri.getPath() == null ? "/" : uri.getEscapedPath() ); setQueryString(uri.getEscapedQuery()); }
/** * Sets the URI for this method. * * @param uri URI to be set * * @throws URIException if a URI cannot be set * * @since 3.0 */ public void setURI(URI uri) throws URIException { // only set the host if specified by the URI if (uri.isAbsoluteURI()) { this.httphost = new HttpHost(uri); } // set the path, defaulting to root setPath( uri.getPath() == null ? "/" : uri.getEscapedPath() ); setQueryString(uri.getEscapedQuery()); }
/** * Sets the URI for this method. * * @param uri URI to be set * * @throws URIException if a URI cannot be set * * @since 3.0 */ public void setURI(URI uri) throws URIException { // only set the host if specified by the URI if (uri.isAbsoluteURI()) { this.httphost = new HttpHost(uri); } // set the path, defaulting to root setPath( uri.getPath() == null ? "/" : uri.getEscapedPath() ); setQueryString(uri.getEscapedQuery()); }
/** * Sets the URI for this method. * * @param uri URI to be set * * @throws URIException if a URI cannot be set * * @since 3.0 */ public void setURI(URI uri) throws URIException { // only set the host if specified by the URI if (uri.isAbsoluteURI()) { this.httphost = new HttpHost(uri); } // set the path, defaulting to root setPath( uri.getPath() == null ? "/" : uri.getEscapedPath() ); setQueryString(uri.getEscapedQuery()); }
/** * Sets the URI for this method. * * @param uri URI to be set * * @throws URIException if a URI cannot be set * * @since 3.0 */ public void setURI(URI uri) throws URIException { // only set the host if specified by the URI if (uri.isAbsoluteURI()) { this.httphost = new HttpHost(uri); } // set the path, defaulting to root setPath( uri.getPath() == null ? "/" : uri.getEscapedPath() ); setQueryString(uri.getEscapedQuery()); }
@SuppressWarnings("deprecation") public void setURI(org.apache.commons.httpclient.HttpMethodBase m, URI uri) throws URIException { HostConfiguration conf = m.getHostConfiguration(); if (uri.isAbsoluteURI()) { conf.setHost(new HttpHost(uri)); m.setHostConfiguration(conf); } m.setPath(uri.getPath() != null ? uri.getEscapedPath() : "/"); m.setQueryString(uri.getQuery()); }