List of usage examples for java.net MalformedURLException MalformedURLException
public MalformedURLException(String msg)
From source file:cn.openwatch.internal.http.loopj.AsyncHttpRequest.java
private void makeRequest() throws Exception { if (isCancelled()) { return;//w ww. j a v a 2 s. co m } // Fixes #115 if (request.getURI().getScheme() == null) { // subclass of IOException so processed in the caller throw new MalformedURLException("No valid URI scheme was provided"); } HttpResponse response = client.execute(request, context); if (isCancelled()) { return; } // Carry out pre-processing for this response. responseHandler.onPreProcessResponse(responseHandler, response); if (isCancelled()) { return; } // The response is ready, handle it. responseHandler.sendResponseMessage(response); if (isCancelled()) { return; } // Carry out post-processing for this response. responseHandler.onPostProcessResponse(responseHandler, response); }
From source file:org.wso2.carbon.automation.extensions.selenium.BrowserManager.java
private static void getRemoteWebDriver() throws MalformedURLException, XPathExpressionException { URL url;//from w w w . j av a 2 s . co m String browserName = automationContext .getConfigurationNodeList(String.format(XPathConstants.SELENIUM_BROWSER_TYPE)).item(0) .getFirstChild().getNodeValue(); String remoteWebDriverURL = automationContext .getConfigurationValue(String.format(XPathConstants.SELENIUM_REMOTE_WEB_DRIVER_URL)); if (log.isDebugEnabled()) { log.debug("Browser selection " + browserName); log.debug("Remote WebDriverURL " + remoteWebDriverURL); } try { url = new URL(remoteWebDriverURL); } catch (MalformedURLException e) { log.error("Malformed URL " + e); throw new MalformedURLException("Malformed URL " + e); } DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setJavascriptEnabled(true); capabilities.setBrowserName(browserName); driver = new RemoteWebDriver(url, capabilities); }
From source file:com.fdwills.external.http.AsyncHttpRequest.java
private void makeRequest() throws IOException { if (isCancelled()) { return;//from w ww . j a v a 2s . c o m } // Fixes #115 if (request.getURI().getScheme() == null) { // subclass of IOException so processed in the caller throw new MalformedURLException("No valid URI scheme was provided"); } if (responseHandler instanceof RangeFileAsyncHttpResponseHandler) { ((RangeFileAsyncHttpResponseHandler) responseHandler).updateRequestHeaders(request); } HttpResponse response = client.execute(request, context); if (isCancelled() || responseHandler == null) { return; } // Carry out pre-processing for this response. responseHandler.onPreProcessResponse(responseHandler, response); if (isCancelled()) { return; } // The response is ready, handle it. responseHandler.sendResponseMessage(response); if (isCancelled()) { return; } // Carry out post-processing for this response. responseHandler.onPostProcessResponse(responseHandler, response); }
From source file:com.loopj.android_async_http.http.AsyncHttpRequest.java
private void makeRequest() throws IOException { if (isCancelled()) { return;//from w ww. j av a 2 s. co m } Log.d("daizhx", "url=" + request.getURI()); // Fixes #115 if (request.getURI().getScheme() == null) { // subclass of IOException so processed in the caller throw new MalformedURLException("No valid URI scheme was provided"); } if (responseHandler instanceof RangeFileAsyncHttpResponseHandler) { ((RangeFileAsyncHttpResponseHandler) responseHandler).updateRequestHeaders(request); } HttpResponse response = client.execute(request, context); if (isCancelled() || responseHandler == null) { return; } // Carry out pre-processing for this response. responseHandler.onPreProcessResponse(responseHandler, response); if (isCancelled()) { return; } // The response is ready, handle it. responseHandler.sendResponseMessage(response); if (isCancelled()) { return; } // Carry out post-processing for this response. responseHandler.onPostProcessResponse(responseHandler, response); }
From source file:com.predic8.membrane.core.transport.http.HttpClient.java
private void setRequestURI(Request req, String dest) throws MalformedURLException { if (proxy != null || req.isCONNECTRequest()) req.setUri(dest);/*from w w w . ja va 2s. c om*/ else { if (!dest.startsWith("http")) throw new MalformedURLException("The exchange's destination URL (" + dest + ") does not start with 'http'. Please specify a <target> within your <serviceProxy>."); req.setUri(HttpUtil.getPathAndQueryString(dest)); } }
From source file:cn.com.loopj.android.http.AsyncHttpRequest.java
private void makeRequest() throws IOException { if (isCancelled()) { return;//from w w w . j a v a 2s . c om } // Fixes #115 if (request.getURI().getScheme() == null) { // subclass of IOException so processed in the caller throw new MalformedURLException("No valid URI scheme was provided"); } if (responseHandler instanceof RangeFileAsyncHttpResponseHandler) { ((RangeFileAsyncHttpResponseHandler) responseHandler).updateRequestHeaders(request); } HttpResponse response = client.execute(request, context); if (isCancelled()) { return; } // Carry out pre-processing for this response. responseHandler.onPreProcessResponse(responseHandler, response); if (isCancelled()) { return; } // The response is ready, handle it. responseHandler.sendResponseMessage(response); if (isCancelled()) { return; } // Carry out post-processing for this response. responseHandler.onPostProcessResponse(responseHandler, response); }
From source file:org.broadleafcommerce.common.security.LocalRedirectStrategy.java
/** * Insure the url is valid (must begin with http or https) and local to the * application// w ww . j a v a 2 s . co m * * @param contextPath * the application context path * @param url * the url to validate * @param requestServerName * the server name of the request * @param requestServerPort * the port of the request * @throws MalformedURLException * if the url is invalid */ private void validateRedirectUrl(String contextPath, String url, String requestServerName, int requestServerPort) throws MalformedURLException { URL urlObject = new URL(url); if (urlObject.getProtocol().equals("http") || urlObject.getProtocol().equals("https")) { if (StringUtils.equals(requestServerName, urlObject.getHost())) { if (!enforcePortMatch || requestServerPort == urlObject.getPort()) { if (StringUtils.isEmpty(contextPath) || urlObject.getPath().startsWith("/" + contextPath)) { return; } } } } String errorMessage = "Invalid redirect url specified. Must be of the form /<relative view> or http[s]://<server name>[:<server port>][/<context path>]/..."; LOG.warn(errorMessage + ": " + url); throw new MalformedURLException(errorMessage + ": " + url); }
From source file:com.skydragon.gplay.loopj.android.http.AsyncHttpRequest.java
private void makeRequest() throws IOException { if (isCancelled()) { return;// w w w.j a v a2 s. co m } // Fixes #115 if (request.getURI().getScheme() == null) { // subclass of IOException so processed in the caller throw new MalformedURLException("No valid URI scheme was provided"); } if (responseHandler instanceof RangeFileAsyncHttpResponseHandler) { ((RangeFileAsyncHttpResponseHandler) responseHandler).updateRequestHeaders(request); } Log.d("AsyncHttpRequest", "makeRequest: " + request.getURI().toString()); HttpResponse response = client.execute(request, context); if (isCancelled()) { return; } // Carry out pre-processing for this response. responseHandler.onPreProcessResponse(responseHandler, response); if (isCancelled()) { return; } // The response is ready, handle it. responseHandler.sendResponseMessage(response); if (isCancelled()) { return; } // Carry out post-processing for this response. responseHandler.onPostProcessResponse(responseHandler, response); }
From source file:derson.com.httpsender.AsyncHttpClient.AsyncHttpRequest.java
private void makeRequest() throws IOException { if (isCancelled()) { return;/* w ww . j a v a2 s .c o m*/ } // Fixes #115 if (request.getURI().getScheme() == null) { // subclass of IOException so processed in the caller throw new MalformedURLException("No valid URI scheme was provided"); } if (responseHandler instanceof RangeFileAsyncHttpResponseHandler) { ((RangeFileAsyncHttpResponseHandler) responseHandler).updateRequestHeaders(request); } HttpResponse response = client.execute(request, context); if (isCancelled() || responseHandler == null) { return; } // Carry out pre-processing for this response. responseHandler.onPreProcessResponse(responseHandler, response); if (isCancelled()) { return; } // The response is ready, handle it. responseHandler.sendResponseMessage(response); if (isCancelled()) { return; } // Carry out post-processing for this response. responseHandler.onPostProcessResponse(responseHandler, response); }
From source file:com.linkedin.drelephant.clients.azkaban.AzkabanWorkflowClient.java
/** * Making this client more usable by allowing to setURL runtime and get the status * @param url/*from w ww. j av a 2 s . co m*/ * @throws URISyntaxException * @throws MalformedURLException */ public void setURL(String url) throws URISyntaxException, MalformedURLException { if (url == null || url.isEmpty()) { throw new MalformedURLException("The Azkaban url is malformed"); } this.setAzkabanServerUrl(url); this.setExecutionId(url); this._workflowExecutionUrl = url; }