Package java.net

Examples of java.net.URL


  private VDBRepository vdbRepository;
 

  public void start() {
    try {
      URL url = Thread.currentThread().getContextClassLoader().getResource(CoreConstants.SYSTEM_VDB);
      if (url == null) {
        throw new TeiidRuntimeException(RuntimeMetadataPlugin.Util.getString("system_vdb_not_found")); //$NON-NLS-1$
      }
      // uri conversion is only to remove the spaces in URL, note this only with above kind situation 
      URI uri = new URI(url.getProtocol(), url.getPath(), null);
      this.vdbRepository.setSystemStore(new IndexMetadataFactory(uri.toURL()).getMetadataStore(null));
    } catch (URISyntaxException e) {
      throw new TeiidRuntimeException(e, RuntimePlugin.Util.getString("system_vdb_load_error")); //$NON-NLS-1$
    } catch (IOException e) {
      throw new TeiidRuntimeException(e, RuntimePlugin.Util.getString("system_vdb_load_error")); //$NON-NLS-1$
View Full Code Here


        InputStreamReader inSR  = null;
        BufferedReader buffReader = null;
       
        try {
            // create the URL object
            URL url = new URL(yahooUrl);
           
            // create the connection to the URL
            URLConnection conn = url.openConnection();

            // establish the connection to the URL                         
            conn.connect();
           
            // get the stream from the commection
View Full Code Here

  private final URL url;
  private final HttpVerb verb;
 
  public HttpRequest(String url, HttpVerb verb) {
    try {
      this.url = new URL(url);
      this.verb = verb;
    } catch (MalformedURLException e) {
      logger.error("Malformed URL: {}", e.getMessage());
      throw new RuntimeException(e);
    }
View Full Code Here

      Vector sections = Section.listAll();
      Mapping.rollback();
      for (int i = 0; i < sections.size(); i++) {
        Section section = (Section) sections.get(i);
        try {
          URL url =
            new URL(
              frontUrl+"/section/"
                + section.getId()
                + ".html?static=true&nocache=true");
          BufferedReader reader =
            new BufferedReader(
              new InputStreamReader(url.openStream()));
          String content = "<!-- �ON static export -->";
          String line = "";
          while (line != null) {
            line = reader.readLine();
            if (line != null) {
              content += line;
            }
          }

          ZipEntry ze =
            new ZipEntry("section/" + section.getId() + ".html");
          zip.putNextEntry(ze);
          zip.write(content.getBytes());
          zip.closeEntry();
        } catch (Exception e) {
          System.out.println(
            "Static export error, section " + section.getId());
        }
      }

      // add publications
      Mapping.begin();
      Vector publications = Publication.listAll();
      Mapping.rollback();
      for (int i = 0; i < publications.size(); i++) {
        Publication publication = (Publication) publications.get(i);
        try {
          URL url =
            new URL(
              frontUrl+"/publication/"
                + publication.getId()
                + ".html?static=true&nocache=true");
          BufferedReader reader =
            new BufferedReader(
              new InputStreamReader(url.openStream()));
          String content = "<!-- �ON static export -->";
          String line = "";
          while (line != null) {
            line = reader.readLine();
            if (line != null) {
              content += line;
            }
          }
          ZipEntry ze =
            new ZipEntry(
              "publication/" + publication.getId() + ".html");
          zip.putNextEntry(ze);
          zip.write(content.getBytes());
          zip.closeEntry();
        } catch (Exception e) {
          System.out.println(
            "Static export error, publication "
              + publication.getId());
        }
      }

      // add index
      URL url =
        new URL(
          frontUrl+"?static=true&nocache=true");
      BufferedReader reader =
        new BufferedReader(new InputStreamReader(url.openStream()));
      String content = "<!-- �ON static export -->";
      String line = "";
      while (line != null) {
        line = reader.readLine();
        if (line != null) {
View Full Code Here

    throws Exception
  {
    System.out.println("URLs will be logged to urls.txt\n\n");

    WebRobot robby = new WebRobot();
    robby.setStartURL(new URL("http://www.matuschek.net"));
    robby.setMaxDepth(1);
    robby.setSleepTime(0);

    FileWriter logfile = new FileWriter("urls.txt");
    URLLogger log = new URLLogger(logfile);
View Full Code Here



  public void run() throws Exception {
    WebRobot robby = new WebRobot();
    robby.setStartURL(new URL("http://www.matuschek.net"));
    robby.setMaxDepth(1);
    robby.setSleepTime(0);

    // download only the first 5 documents
    DownloadStopper stopit = new DownloadStopper(5,robby);
View Full Code Here

  public ExtendedURL fillForm(URL baseURL, Element form) {
    ExtendedURL eurl = new ExtendedURL();
    String formURL = form.getAttribute("action");
    String type = form.getAttribute("method");
    FormHandler handler;
    URL absoluteFormURL = null;

    try {
      absoluteFormURL = new URL(baseURL, formURL);
    } catch( MalformedURLException e) {
      log.info("MalformedURLException in fillForm(): "+e.getMessage());
    }

    if (! form.getNodeName().equals("form")) {
      log.error("not a form !");
      return null;
    }

    handler = getFormHandler(absoluteFormURL.toString());
    if (handler == null) {
      log.debug("found no form handler for URL "+formURL);
      return null;
    }
View Full Code Here

      // jdk1.1/docs/guide/misc/resources.html
      Utils utils = new Utils();
      Enumeration<URL> urls = utils.getClass().getClassLoader().getResources(resourceName);
      boolean first = true;
      while (urls.hasMoreElements()) {
  URL url = urls.nextElement();
  if (first) {
    defaultProps.load(url.openStream());
    first = false;
  }
  else {
    Properties props = new Properties(defaultProps);
    props.load(url.openStream());
    defaultProps = props;
  }
      }
    } catch (Exception ex) {
      System.err.println("Warning, unable to load properties file(s) from "
View Full Code Here

   * configure URLCheck
   */
  private void addCookie() {
    String cookieStr = JOptionPane.showInputDialog(this, "Cookie string:");
    String domain = JOptionPane.showInputDialog(this, "Domain:");
    URL url;
  try {
    url = new URL("http://"+domain);
  } catch (MalformedURLException e1) {
    JOptionPane.showMessageDialog(this, "Domain invalid: "+e1.getMessage());
    return;
  }
  try {
View Full Code Here

  private boolean updateRobotFromDialog() {

    // start URL
    String startUrl = urlField.getText();
    try {
      URL u = new URL(startUrl);
      jobobase.getRobot().setStartURL(u);
    } catch (MalformedURLException e) {
      JOptionPane.showMessageDialog(this,"URL "+startUrl+" is invalid");
      return false;
    }
View Full Code Here

TOP

Related Classes of java.net.URL

Copyright © 2018 www.massapicom. 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.