Get the contents from the request URL.

@param url URL to get the response from
@param layer the raster layer
@return {@link InputStream} with the content
@throws IOException cannot get content
428935
public InputStream getStream(String url, RasterLayer layer) throws IOException {
		if (layer instanceof ProxyLayerSupport) {
			ProxyLayerSupport proxyLayer = (ProxyLayerSupport) layer;
			if (proxyLayer.isUseCache() && null != cacheManagerService) {
				Object cachedObject = cacheManagerService.get(proxyLayer, CacheCategory.RASTER, url);
				if (null != cachedObject) {
					testRecorder.record(TEST_RECORDER_GROUP, TEST_RECORDER_GET_FROM_CACHE);
					return new ByteArrayInputStream((byte[]) cachedObject);
				} else {
					testRecorder.record(TEST_RECORDER_GROUP, TEST_RECORDER_PUT_IN_CACHE);
					InputStream stream = super.getStream(url, proxyLayer);
					ByteArrayOutputStream os = new ByteArrayOutputStream();
					int b;
					while ((b = stream.read()) >= 0) {
						os.write(b);
					}
					cacheManagerService.put(proxyLayer, CacheCategory.RASTER, url, os.toByteArray(),
							getLayerEnvelope(proxyLayer));
					return new ByteArrayInputStream((byte[]) os.toByteArray());
				}
			}
		}
		return super.getStream(url, layer);
	}
1334014
private InputStream getInputStream(String url) throws Exception {
        HttpGet getMethod = new HttpGet(url);
        DefaultHttpClient client = new DefaultHttpClient(m_cManager);
        client.getParams().setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, TIMEOUT_SECONDS * 1000);
        UsernamePasswordCredentials creds = getCreds(url);
        if (creds != null) {
            client.getCredentialsProvider().setCredentials(AuthScope.ANY, creds);
            client.addRequestInterceptor(new PreemptiveAuth());
        }
        client.getParams().setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, true);
        HttpInputStream in = new HttpInputStream(client, getMethod);
        if (in.getStatusCode() != 200) {
            try {
                in.close();
            } catch (Exception e) {
            }
            throw new IOException("HTTP request failed.  Got status code "
                    + in.getStatusCode()
                    + " from remote server while attempting to GET " + url);
        } else {
            return in;
        }
    }
757138
function(url) {
        var matches = OpenLayers.Util.isEquivalentUrl(this.url, url);
        if(!matches && this.layerUrls) {
            for(var i=0, len=this.layerUrls.length; i<len; ++i) {
                if(OpenLayers.Util.isEquivalentUrl(this.layerUrls[i], url)) {
                    matches = true;
                    break;
                }
            }
        }
        return matches;
    }
925485
public InputStream getInputStream()
        throws java.io.IOException
    {
        if (!_urlString.endsWith("!/"))
            return super.getInputStream();
        
        URL url = new URL(_urlString.substring(4,_urlString.length()-2));
        return url.openStream();
    }
928525
public static Element getContentElementByUrl(String url) throws Exception {
//        HttpRequest request = new HttpRequest(url);
        String html = okHttpRequester.getResponse(url).html();
        return getContentElementByHtml(html, url);
    }
975467
public JSONObject makeHttpRequest(String url) throws IOException {

        InputStream is = null;
        JSONObject jObj = null;
        String json = null;
        // Making HTTP request
        try {

            is = new URL(url).openStream();


        } catch (Exception ex) {
            Log.d("Networking", ex.getLocalizedMessage());
            throw new IOException("Error connecting");
        }

        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(
                is, "iso-8859-1"), 8);
            StringBuilder sb = new StringBuilder();
            String line = null;
            while ((line = reader.readLine()) != null) {
                sb.append(line + "\n");
            }
            json = sb.toString();
            reader.close();

        } catch (Exception e) {
            Log.e("Buffer Error", "Error converting result " + e.toString());
        } finally{
            try {
                is.close();
            }catch (Exception ex){}
        }

        // try parse the string to a JSON object
        try {
            jObj = new JSONObject(json);
        } catch (JSONException e) {
            Log.e("JSON Parser", "Error parsing data " + e.toString());
        }

        // return JSON String
        return jObj;

    }
171371
public static String get(String url,
                             Map<String, String> header,
                             Map<String, String> param) throws IOException {

        // 参数
        if (param != null) {
            url += "?" + Utils.getUrlParamsByMap(param);
        }

        HttpURLConnection httpUrlConn = httpUrlConn(url);
        httpUrlConn.setDoInput(true);
        httpUrlConn.setRequestMethod(Constant.RequestMethodGet);

        // header
        if (header != null) {
            header(header, httpUrlConn);
        }

        httpUrlConn.connect();

        return readIO(httpUrlConn);
    }
459820
private static InputStream inputStreamFromFile(URL resourceUrl)
      throws IOException, URISyntaxException {
    File resourceFile = new File(resourceUrl.toURI());
    return new FileInputStream(resourceFile);
  }
217689
public static ReadableByteChannel getInstance(URL url) throws IOException
    {
        ProtocolHandler ph = map.get(url.getProtocol());
        if (ph != null)
        {
            return ph.create(url);
        }
        else
        {
            return Channels.newChannel(url.openStream());
        }
    }
110895
public static InputStream getInputStreamFromHttp(String httpFileURL) throws IOException {

        URLConnection urlConnection = null;
        urlConnection = new URL(httpFileURL).openConnection();
        urlConnection.connect();
        return urlConnection.getInputStream();
    }
81954
public InputStream getInputStream() throws IOException {
        if (null == inputStream) {
            if (readFromCache) {
                inputStream = new FileInputStream(cacheFile.toFile());
            } else {
                WriteCacheFileInputStream wis = new WriteCacheFileInputStream(delegate.getInputStream(),
                        new FileOutputStream(cacheFile.toFile()));
                wis.onInputStreamClose(() -> {
                    try {
                        final int responseCode = delegate.getResponseCode();
                        if (responseCode == HTTP_OK) {
                            cache.saveCachedDataInfo(cacheFile, cachedDataInfo);
                        } else {
                            if (logger.isWarnEnabled()) {
                                logger.warn("not caching because of response code {}: {}", responseCode, getURL());
                            }
                        }
                    } catch (final IOException e) {
                        if (logger.isWarnEnabled()) {
                            logger.warn("cannot retrieve response code");
                        }
                    }
                });
                inputStream = wis;
            }
        }
        return inputStream;
    }
1343219
@Api
	public void setUrl(String url) throws LayerException {
		try {
			this.url = url;
			Map<String, Object> params = new HashMap<String, Object>();
			params.put("url", url);
			DataStore store = DataStoreFactory.create(params);
			setDataStore(store);
		} catch (IOException ioe) {
			throw new LayerException(ioe, ExceptionCode.INVALID_SHAPE_FILE_URL, url);
		}
	}
802376
protected InputStream getStream(HttpClient httpClient, String url) {
        try {
            HttpEntity entity = get(httpClient, url);
            if (entity == null) return null;
            return entity.getContent();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
982633
public static String get(String url, String params) throws IOException {
        return HttpUtil.get(url, null, params);
    }
364507
public byte[] simpleGetBytes(String url) throws IOException {
		final AtomicReference<byte[]> bytes = new AtomicReference<>();
		simpleGetInternal(url, inputStream -> {
            try {
                bytes.set(IOUtils.toByteArray(inputStream));
            } catch (IOException e) {
                throw new IllegalStateException(e);
            }
        }, null);

		return bytes.get();
	}
1364025
@Override
    public InputStream getContent() {
        // todo - this needs to be more complete so the proxy information will
        // make it up to the higher levels. Ie, so one can pass back the response information
        try {
            return getResourceUri().toURL().openStream();
        } catch (final IOException e) {
            throw new ExternalContentAccessException("Problems getting external content : " + e.getMessage(), e);
        }
    }
1230017
public static InputStream getUrlAsStream(URL url, String acceptValue) throws IOException {
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestMethod("GET");
        if (acceptValue != null && !acceptValue.trim().isEmpty()) {
            connection.setRequestProperty("Accept", acceptValue);
        }
        final int responseCode = connection.getResponseCode();
        if (responseCode == HttpURLConnection.HTTP_OK) {
            return connection.getInputStream();
        } else {
            if (isEventEnabled(tc)) {
                Tr.event(tc, "Did not find resource at " + url + ".  ResponseCode: " + responseCode);
            }
        }
        return null;
    }