Package java.net

Examples of java.net.URL.openStream()


      // same with URL-extension
      serverURL = new URL("http://"
          + serverBinding.getInetAddress().getHostAddress() + ":"
          + serverBinding.getPort()
          + "/application/test-dir/test-data.txt?bar.html");
      remoteStream = serverURL.openStream();
      resourceStream = ApplicationServerHandler.class
          .getResourceAsStream("/META-INF/web/application/test-dir/test-data.txt");
      for (int i = resourceStream.read(); i > -1; i = resourceStream
          .read()) {
        assertEquals(i, remoteStream.read());
View Full Code Here


public class TestManagedUtil {

  @Test public void testTempURL() throws Exception {
    ByteArrayInputStream bais = new ByteArrayInputStream(new byte[100]);
    URL url = ManagedUtil.getTempURL(bais);
    assertEquals(100, ObjectConverterUtil.convertToByteArray(url.openStream()).length);
  }
 
}
View Full Code Here

         {
            url = cl.getResource(name + ".properties");
         }
         if (url != null)
         {
            InputStream is = url.openStream();
            try
            {
               byte[] buf = IOUtil.getStreamContentAsBytes(is);
               return new String(buf, "UTF-8");
            }
View Full Code Here

            }
         }

         if (url != null)
         {
            InputStream is = url.openStream();
            try
            {
               byte[] buf = IOUtil.getStreamContentAsBytes(is);
               return new String(buf, "UTF-8");
            }
View Full Code Here

      sb.append(":").append(new Integer(properties.getProperty("jbpm.console.server.port")));
      sb.append("/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/");
      sb.append(URLEncoder.encode(id, "UTF-8"));
      sb.append("-image.png");
      URL url = new URL(sb.toString());
      InputStream is = url.openStream();
      if (is != null) {
        return url;
      }
    } catch (Throwable t) {
      t.printStackTrace();
View Full Code Here

  public @WebResult(name="albums") FeedType listAlbums(@WebParam(name = "crediential") Crediential crediential) {
    try {
      //TODO from JNDI property
      URL       albumURL   = new URL("http://picasaweb.google.com/data/feed/api/user/"+crediential.getUsername()+"?kind=album");
      Unmarshaller   um       = context.createUnmarshaller();
      FeedType ob = um.unmarshal(new StreamSource(albumURL.openStream()),FeedType.class).getValue();
      return ob;
    } catch (Exception e) {
      e.printStackTrace();
      throw new Error("Album request failed",e);
    }
View Full Code Here

          @WebParam(name = "albumUrl", partName = "albumUrl")
          String albumUrl) {
    try {
      URL       albumURL   = new URL(albumUrl);
      Unmarshaller   um       = context.createUnmarshaller();
      FeedType ob = um.unmarshal(new StreamSource(albumURL.openStream()),FeedType.class).getValue();
      return ob;
    } catch (Exception e) {
      e.printStackTrace();
      throw new Error("Album request failed",e);
    }
View Full Code Here

    Properties props = new Properties();
    InputStream inputStream = null;
    try {
      log.info("Reading Dozer properties from URL [{}]", url);
      inputStream = url.openStream();
      props.load(inputStream);
    } catch (IOException e) {
      MappingUtils.throwMappingException("Problem loading Dozer properties from URL [" + propFileName + "]", e);
    } finally {
      if (inputStream != null) {
View Full Code Here

      String fileName = systemId.substring(systemId.indexOf(DozerConstants.XSD_NAME));
      log.debug("Trying to locate [{}] in classpath", fileName);
      try {
        DozerClassLoader classLoader = BeanContainer.getInstance().getClassLoader();
        URL url = classLoader.loadResource(fileName);
        InputStream stream = url.openStream();
        InputSource source = new InputSource(stream);
        source.setPublicId(publicId);
        source.setSystemId(systemId);
        log.debug("Found beanmapping XML Schema [{}] in classpath", systemId);
        return source;
View Full Code Here

      } else {
        allPath += "&nocache=true";
      }
      URL url = new URL(allPath);
      BufferedReader reader =
        new BufferedReader(new InputStreamReader(url.openStream()));
      String content = "<!-- �ON smart cache for url : " + path + " -->";
      String line = "";
      while (line != null) {
        line = reader.readLine();
        if (line != null) {
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.