/** * Compare this URI to another object. * * @param obj the object to be compared. * @return 0, if it's same, * -1, if failed, first being compared with in the authority component * @throws ClassCastException not URI argument */ public int compareTo(Object obj) throws ClassCastException { URI another = (URI) obj; if (!equals(_authority, another.getRawAuthority())) { return -1; } return toString().compareTo(another.toString()); }
uri = http.getURI().toString(); } catch (URIException uriex) { throw new EsHadoopTransportException("Invalid target URI " + request, uriex);
public String getDownloadUrl() { try { return getMethod.getURI().toString(); } catch (URIException e) { return null; } }
public String getRequestUrl() { try { return httpMethod.getURI().toString(); } catch (URIException ex) { throw new IllegalStateException(ex); } }
/** * @param method * @return the http status code of the execution * @throws IOException * @throws HttpException */ private int executeMethod(HttpMethod method) throws IOException, HttpException { String host = method.getURI().getHost(); if (host != null && nonProxyHosts.contains(host.toLowerCase())) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine( "Bypassing proxy config due to nonProxyHosts for " + method.getURI().toString()); } return client.executeMethod(hostConfigNoProxy, method); } return client.executeMethod(method); }
/** * Return the request URI */ public String getUri() { try { return method.getURI().toString(); } catch (URIException e) { } return null; // shouldn't happen }
@Override protected void performHistoryReferenceActions (List<HistoryReference> hrefs) { StringBuilder sb = new StringBuilder(); for (HistoryReference href : hrefs) { sb.append(href.getURI().toString()); sb.append("\n"); } Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents( new StringSelection(sb.toString()), this ); }
public String getPath() { try { return (method == null ? null : method.getURI().toString()); } catch (URIException e) {return null;} }
public String getPath() { try { return (method == null ? null : method.getURI().toString()); } catch (URIException e) { return null; } }
@Override public URI getUri() throws URISyntaxException { try { return new URI(postMethod.getURI().toString()); } catch (URIException ex) { throw new URISyntaxException("", ex.getMessage()); } }
/** * Check if the parameter should be excluded by the scanner * @param msg the message that is currently under scanning * @param param the Value/Name param object thta is currently under scanning * @return true if the parameter should be excluded */ public boolean isToExclude(HttpMessage msg, NameValuePair param) { return ((paramType == NameValuePair.TYPE_UNDEFINED) || (param.getType() == paramType)) && ((urlPattern == null) || urlPattern.matcher(msg.getRequestHeader().getURI().toString().toUpperCase(Locale.ROOT)).matches()) && (paramNamePattern.matcher(param.getName()).matches()); }
/** * Returns the FORM parameters for the given URL based on the parser associated with the * first context found that includes the URL, or the default parser if it is not * in a context * @param uri * @param formData * @return * @throws URIException */ public Map<String, String> getFormParams(URI uri, String formData) throws URIException { return this.getFormParamParser(uri.toString()).parse(formData); }
private String normalize(String uri) throws URISyntaxException { try { URI normalized = new URI(uri, DefaultHTTPClient.isUrlEncoded(uri)); normalized.normalize(); return normalized.toString(); } catch (URIException e) { LOG.warn("Invalid uri: {}", uri); LOG.error("Can not convert URL", e); throw new URISyntaxException(uri, e.getMessage()); } }
/** * Return the prime header (first line). */ @Override public String getPrimeHeader() { return getMethod() + " " + getURI().toString() + " " + getVersion(); } /*
/** * Override if handling callbacks * @param msg the HTTP message containing the API request and response * @return the API response (set in the HTTP response body) * @throws ApiException if an error occurred while handling the API callback */ public String handleCallBack(HttpMessage msg) throws ApiException { throw new ApiException (ApiException.Type.URL_NOT_FOUND, msg.getRequestHeader().getURI().toString()); }
/** * Sets the {@code HttpMessage} that will be set to the new alert. * * @param httpMessage * the {@code HttpMessage} that will be set to the new alert */ public void setHttpMessage(HttpMessage httpMessage) { this.httpMessage = httpMessage; setParamNames(httpMessage.getParamNames()); this.alertUrl.setText(httpMessage.getRequestHeader().getURI().toString()); this.historyRef = null; }
@Override public void addAuthentication(HttpMethod forMethod, HttpClient forClient) { try { forMethod.addRequestHeader("Authorization", "token " + accessToken); String url = forMethod.getURI().toString(); String separator = url.contains("?") ? "&" : "?"; url += separator + "access_token=" + getAccessToken(); forMethod.setURI(new URI(url, true)); } catch (URIException e) { throw new SourceControlException("Failed to decode/encode given URI. " + e.getMessage(), e); } }
private boolean isValidForCurrentMode(URI uri) { switch (Control.getSingleton().getMode()) { case safe: return false; case protect: return Model.getSingleton().getSession().isInScope(uri.toString()); default: return true; } }
public void raiseAlert(int risk, int confidence, String name, String description, String uri, String param, String attack, String otherInfo, String solution, String evidence, int cweId, int wascId, HttpMessage msg) { Alert alert = new Alert(getPluginId(), risk, confidence, name); alert.setDetail(description, msg.getRequestHeader().getURI().toString(), param, attack, otherInfo, solution, null, evidence, cweId, wascId, msg); // Left out reference to match ScriptsActiveScanner this.parent.raiseAlert(currentHRefId, alert); }
private void showBrowser(HistoryReference ref) { if (! supported) { return; } try { this.getBrowserLauncher().openURLinBrowser(ref.getURI().toString()); } catch (Exception e) { extension.getView().showWarningDialog(Constant.messages.getString("history.browser.warning")); } }