Package java.net

Examples of java.net.URL.openConnection()


   
    URL url = new URL("https://www.amazon.de/");
    System.setProperty("https.proxyHost", "localhost");
    System.setProperty("https.proxyPort", Integer.toString(proxy.getLocalPort()));

    URLConnection con =  url.openConnection();

   
    StringBuilder sb = new StringBuilder();
    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
    String inputLine;
View Full Code Here


      if (path == null || closed && !path.equals(graphs.get(context))) {
        return;
      }
      URL url = findURL(path);
      Long since = lastModified.get(url);
      URLConnection urlCon = url.openConnection();
      if (since != null) {
        urlCon.setIfModifiedSince(since);
      }
      if (accept != null) {
        urlCon.setRequestProperty("Accept", accept);
View Full Code Here

        //Try it as a url
        try {
            Matcher       m = Pattern.compile(" ").matcher(resourceName);
            String        encodedUrl = m.replaceAll("%20");
            URL           dataUrl    = new URL(encodedUrl);
            URLConnection connection = dataUrl.openConnection();
            s = connection.getInputStream();
        } catch (Exception exc) {}

        return s;
    }
View Full Code Here

        //Try it as a url
        try {
            Matcher       m = Pattern.compile(" ").matcher(resourceName);
            String        encodedUrl = m.replaceAll("%20");
            URL           dataUrl    = new URL(encodedUrl);
            URLConnection connection = dataUrl.openConnection();
            s = connection.getInputStream();
        } catch (Exception exc) {}

        return s;
    }
View Full Code Here

      sParams += aParams[p].getName()+"="+URLEncoder.encode(aParams[p].getValue(), "UTF-8");
      if (p<aParams.length-1) sParams += "&";
    } // next
  } // fi

    HttpURLConnection oCon = (HttpURLConnection) oUrl.openConnection();
   
    oCon.setUseCaches(false);
    oCon.setFollowRedirects(false);
    oCon.setInstanceFollowRedirects(false);
    oCon.setDoInput (true);
View Full Code Here

    throws Exception
  {
    System.out.println("Put file to " + location);

    URL url = new URL(location);
    HttpURLConnection conn = (HttpURLConnection)url.openConnection();
    conn.setRequestMethod("PUT");
    conn.setDoOutput(true);

    RDFFormat dataFormat = RDFFormat.forFileName(file, RDFFormat.RDFXML);
    conn.setRequestProperty("Content-Type", dataFormat.getDefaultMIMEType());
View Full Code Here

  private void delete(String location)
    throws Exception
  {
    URL url = new URL(location);
    HttpURLConnection conn = (HttpURLConnection)url.openConnection();
    conn.setRequestMethod("DELETE");

    conn.connect();

    int responseCode = conn.getResponseCode();
View Full Code Here

  {
    location += "?query=" + URLEncoder.encode(query, "UTF-8") + "&queryLn=" + queryLn.getName();

    URL url = new URL(location);

    HttpURLConnection conn = (HttpURLConnection)url.openConnection();

    // Request SPARQL-XML formatted results:
    conn.setRequestProperty("Accept", TupleQueryResultFormat.SPARQL.getDefaultMIMEType());

    conn.connect();
View Full Code Here

      try {
        URL url = new URL(serverURL);

        System.out.println("connecting to the server...");
        HttpURLConnection con = (HttpURLConnection)url.openConnection();
        con.setDoOutput(true);
        con.setRequestMethod("POST");

        if (keyString != null) {
          String form = HttpClientUtil.encodeParameter(SesameServer.SHUTDOWN_KEY_PARAM, keyString);
View Full Code Here

  if (null==oReferUrl)
    oUrl = new URL(sUrl);
  else
    oUrl = new URL(oReferUrl, sUrl);

    HttpURLConnection oCon = (HttpURLConnection) oUrl.openConnection();
   
    oCon.setUseCaches(false);
    oCon.setFollowRedirects(false);
    oCon.setInstanceFollowRedirects(false);
    oCon.setDoInput (true);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.