Package java.net

Examples of java.net.URL.openConnection()


   * @throws IOException
   */
  public static HttpURLConnection openConnection(String url, String method, String contentType, String ssic) throws IOException
  {
    URL realURL = new URL(url);
    HttpURLConnection conn = (HttpURLConnection) realURL.openConnection();
    //conn.setRequestProperty("User-Agent", "IIC2.0/PC "+FetionClient.PROTOCOL_VERSION);
    conn.setRequestProperty("User-Agent", "IIC2.0/PC 4.0.0000");
    conn.setRequestProperty("Cookie", "ssic="+ssic);
    conn.setRequestProperty("Host", realURL.getHost());
    conn.setRequestProperty("Accept", "*/*");
 
View Full Code Here


   * @throws JDOMException
   */
  public void load(User user) throws IOException, JDOMException
  {
        URL url = new URL(FetionConfig.getString("server.nav-system-uri"));
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("POST");
        conn.setDoOutput(true);
        conn.addRequestProperty("User-Agent", "IIC2.0/PC "+FetionClient.PROTOCOL_VERSION);
       
        String accountType = null;
View Full Code Here

  {
      String picurl = setting.getNodeText("/config/servers/get-pic-code");
      if(picurl==null) picurl = FetionConfig.getString("server.verify-pic-uri");
      picurl +="?algorithm="+alg;
          URL url = new URL(picurl);
          HttpURLConnection conn = (HttpURLConnection) url.openConnection();
          conn.addRequestProperty("User-Agent", "IIC2.0/PC "+FetionClient.PROTOCOL_VERSION);    //必须要加这个,否则失败  很奇怪
          if(conn.getResponseCode()==HttpURLConnection.HTTP_OK) {
            Element e = XMLHelper.build(conn.getInputStream());
        Element pic = XMLHelper.find(e, "/results/pic-certificate");
        String pid = pic.getAttributeValue("id");
View Full Code Here

   * @throws IOException
   */
  private URLConnection getConnection(String uri) throws IOException
  {
    URL url = new URL(uri);
    return url.openConnection();
  }
 
  /**
   * 生成URL
   * @param user
View Full Code Here

    try {
      URL urlToRetrieve = new URL(uri);

      URLConnection conn = null;
      try {
        conn = urlToRetrieve.openConnection();

        if (conn instanceof HttpURLConnection) {

          HttpURLConnection httpConn = (HttpURLConnection) conn;
View Full Code Here

        logger.error("Could not create URL for " + feedUrl);
      }

      URLConnection conn = null;
      try {
        conn = aURL.openConnection();

        if (conn instanceof HttpURLConnection) {

          HttpURLConnection httpConn = (HttpURLConnection) conn;
View Full Code Here

            return new File(jarURL.getFile()).lastModified();
          } else {
            // Use the URL mechanism
            URLConnection jarConn=null;
            try {
              jarConn=jarURL.openConnection();
              return jarConn.getLastModified();
            } catch (IOException e) {
              return -1;
            } finally {
              try {
View Full Code Here

          citeseerURLString.append(OAI_URL);
          citeseerURLString.append(OAI_ACTION);
          citeseerURLString.append("&" + OAI_METADATAPREFIX);
                    citeseerURLString.append("&" + "identifier=").append(key);
          URL citeseerUrl = new URL( citeseerURLString.toString());
          HttpURLConnection citeseerConnection = (HttpURLConnection)citeseerUrl.openConnection();       
          saxParser.parse(citeseerConnection.getInputStream(), new CiteSeerUndoHandler(dummyNamedCompound, newEntry, panel, dummyBoolean));
          database.insertEntry(newEntry);
          citationCounter++;
          UpdateProgressBarTwoValue updateValue = new UpdateProgressBarTwoValue(citationCounter);
          SwingUtilities.invokeLater(updateValue);
View Full Code Here

                      citeseerURLString.append(OAI_URL);
                      citeseerURLString.append(OAI_ACTION);
                      citeseerURLString.append("&" + OAI_METADATAPREFIX);
                        citeseerURLString.append("&" + "identifier=").append(identifier);
                      URL citeseerUrl = new URL( citeseerURLString.toString());
                      HttpURLConnection citeseerConnection = (HttpURLConnection)citeseerUrl.openConnection();       
                      saxParser.parse(citeseerConnection.getInputStream(), new CiteSeerCitationHandler(citationHashTable));
                    } else {
                      int row = panel.mainTable.findEntry(currentEntry);
                      rejectedEntries.put(new Integer(row+1),currentEntry);                    
                    }
View Full Code Here

          citeseerURLString.append(OAI_URL);
          citeseerURLString.append(OAI_ACTION);
          citeseerURLString.append("&" + OAI_METADATAPREFIX);
                citeseerURLString.append("&" + "identifier=").append(identifier);
                    URL citeseerUrl = new URL( citeseerURLString.toString());
                    HttpURLConnection citeseerConnection = (HttpURLConnection)citeseerUrl.openConnection();                 
          InputStream inputStream  = citeseerConnection.getInputStream();
          DefaultHandler handlerBase = new CiteSeerUndoHandler(citeseerNC, be, panel, newValue, overwriteAll, overwriteNone);

          saxParser.parse(inputStream, handlerBase);
        } else {
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.