Refine search
String addr = "http://172.26.41.18:8080/domain/list"; URL url = new URL(addr); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); httpCon.setUseCaches(false); httpCon.setAllowUserInteraction(false); httpCon.addRequestProperty("Authorization", "Basic YWRtaW4fYFgjkl5463"); System.out.println(httpCon.getResponseCode()); System.out.println(httpCon.getResponseMessage());
final URLConnection connection = url.openConnection(); if (parameters != null) { if (parameters.containsKey("connectTimeout")) { connection.setAllowUserInteraction(DefaultGroovyMethods.asType(parameters.get("allowUserInteraction"), Boolean.class));
String userPassword = "login:password"; URL url = new URL(ksGateUrl); // URLConnection urlc = url.openConnection(); URLConnection urlc = new URLConnection(url); urlc.setDoOutput(true); urlc.setUseCaches(false); urlc.setAllowUserInteraction(false); urlc.setRequestProperty("Authorization", "Basic " + new sun.misc.BASE64Encoder().encode (userPassword.getBytes())); urlc.connect();
URL url = new URL("http","www.google.com"); HttpURLConnection urlc = (HttpURLConnection)url.openConnection(); urlc.setAllowUserInteraction( false ); urlc.setDoInput( true ); urlc.setDoOutput( false ); urlc.setUseCaches( true ); urlc.setRequestMethod("GET"); urlc.connect(); // check you have received an status code 200 to indicate OK // get the encoding from the Content-Type header BufferedReader in = new BufferedReader(new InputStreamReader(urlc.getInputStream())); String line = null; while((line = in.readLine()) != null) { System.out.println(line); } // close sockets, handle errors, etc.
private InputStream OpenHttpConnection(URL url, String cookies) throws IOException { InputStream in = null; URLConnection conn = url.openConnection(); if ((cookies != null) && !cookies.trim() .equals("")) { conn.setRequestProperty("Cookie", cookies); } conn.setAllowUserInteraction(false); conn.connect(); in = conn.getInputStream(); return in; }
HttpURLConnection c = null; try { URL u = new URL(url); c = (HttpURLConnection) u.openConnection(); c.setRequestMethod("GET"); c.setRequestProperty("Content-length", "0"); c.setUseCaches(false); c.setAllowUserInteraction(false); c.setConnectTimeout(timeout); c.setReadTimeout(timeout);
public InputStream asStream() throws IOException { URLConnection connection = getURL().openConnection(); connection.setAllowUserInteraction(false); connection.setUseCaches(true); return connection.getInputStream(); }
HttpURLConnection c = null; try { URL u = new URL(url); c = (HttpURLConnection) u.openConnection(); c.setRequestMethod("GET"); c.setRequestProperty("Content-length", "0"); c.setUseCaches(false); c.setAllowUserInteraction(false); c.setConnectTimeout(timeout); c.setReadTimeout(timeout);
@Override @NotNull public Image getImage() throws IOException { final URLConnection urlConnection = _url.openConnection(); urlConnection.setAllowUserInteraction( false ); urlConnection.setDoInput( true ); urlConnection.setUseCaches( true ); final Image image = (Image)urlConnection.getContent( new Class<?>[] { Image.class } ); if ( image == null ) { throw new IOException( "Failed to load image from " + _url ); } return image; }
URL url = new URL(INSERT_HERE_YOUR_URL); String query = INSERT_HERE_YOUR_URL_PARAMETERS; URLConnection urlc = url.openConnection(); urlc.setAllowUserInteraction(false);
@Override InputStream getInputStream(PluginProgress progress) throws IOException { URLConnection urlConnection = getSource().openConnection(); urlConnection.setUseCaches(false); urlConnection.setAllowUserInteraction(false); //urlConnection.connect(); return openConnectionCheckRedirects(urlConnection); }
int response = -1; URL url = new URL(urlString); URLConnection conn = url.openConnection(); httpConn.setAllowUserInteraction(false); httpConn.setInstanceFollowRedirects(true); httpConn.setRequestMethod("GET");
public String getpage(URL url) { try { // try opening the URL URLConnection urlConnection = url.openConnection(); urlConnection.setAllowUserInteraction(false); InputStream urlStream = url.openStream(); byte buffer[] = new byte[1000]; int numRead = urlStream.read(buffer); String content = new String(buffer, 0, numRead); while ((numRead != -1) && (content.length() < MAX_PAGE_SIZE)) { numRead = urlStream.read(buffer); if (numRead != -1) { String newContent = new String(buffer, 0, numRead); content += newContent; } } return content; } catch (IOException e) { e.printTrackStace(); }catch(IndexOutOfBoundsException e1){ e1.printTrackStace(); } }
URL url = new URL(absoluteURI); OutputStream urlOutStream = null; String protocol = url.getProtocol(); URLConnection urlCon = url.openConnection(); urlCon.setDoInput(false); urlCon.setDoOutput(true); urlCon.setUseCaches(false); urlCon.setAllowUserInteraction(false);
public long lastModified() { try { URLConnection connection = getURL().openConnection(); connection.setAllowUserInteraction(false); connection.setUseCaches(true); connection.setIfModifiedSince(mLastModified); mLastModified = connection.getLastModified(); } catch (IOException ignore) { } return mLastModified; } }
URL url = new URL(absoluteURI); OutputStream urlOutStream = null; String protocol = url.getProtocol(); URLConnection urlCon = url.openConnection(); urlCon.setDoInput(false); urlCon.setDoOutput(true); urlCon.setUseCaches(false); urlCon.setAllowUserInteraction(false);
public static String converse(URL url, String postBody) throws IOException { URLConnection conn = url.openConnection(); boolean post = postBody != null; if (post) conn.setDoInput(true); conn.setDoOutput(true); conn.setAllowUserInteraction(true); conn.connect(); if (post) { PrintWriter out = new PrintWriter(conn.getOutputStream()); out.println(postBody); out.close(); // Important! } StringBuilder sb = new StringBuilder(); BufferedReader in = new BufferedReader( new InputStreamReader(conn.getInputStream())); String line; while ((line = in.readLine()) != null) { sb.append(line); } in.close(); return sb.toString(); } }
URL url = new URL(absoluteURI); OutputStream urlOutStream = null; String protocol = url.getProtocol(); URLConnection urlCon = url.openConnection(); urlCon.setDoInput(false); urlCon.setDoOutput(true); urlCon.setUseCaches(false); urlCon.setAllowUserInteraction(false);
private void reconnect() throws IOException { connection = (HttpURLConnection) connection.getURL().openConnection(); connection.setRequestMethod(method); headerFields = null; Iterator properties = requestProperties.entrySet().iterator(); while (properties.hasNext()) { Map.Entry property = (Map.Entry) properties.next(); String key = (String) property.getKey(); StringBuffer value = new StringBuffer(); Iterator values = ((List) property.getValue()).iterator(); while (values.hasNext()) { value.append(values.next()); if (values.hasNext()) value.append(", "); } connection.setRequestProperty(key, value.toString()); } connection.setAllowUserInteraction(allowUserInteraction); connection.setDoInput(doInput); connection.setDoOutput(doOutput); connection.setIfModifiedSince(ifModifiedSince); connection.setUseCaches(useCaches); }
URL url = new URL(absoluteURI); OutputStream urlOutStream = null; String protocol = url.getProtocol(); URLConnection urlCon = url.openConnection(); urlCon.setDoInput(false); urlCon.setDoOutput(true); urlCon.setUseCaches(false); urlCon.setAllowUserInteraction(false);