Package org.springframework.core.io

Examples of org.springframework.core.io.UrlResource


    @Test
    public void testReadDocumentWithoutAttachmentElements() throws MalformedURLException {
        ExternalAttachmentProvider eap = new ExternalAttachmentProvider();
        URL url = ExternalAttachmentProviderTest.class.getResource("resources/attachments1.xml");
        String uri = url.toExternalForm();
        eap.setLocation(new UrlResource(uri));
        eap.readDocument();
        assertTrue(eap.getAttachments().isEmpty());
    }
View Full Code Here


    @Test
    public void testReadDocumentAttachmentElementWithoutAppliesTo() throws MalformedURLException {
        ExternalAttachmentProvider eap = new ExternalAttachmentProvider();
        URL url = ExternalAttachmentProviderTest.class.getResource("resources/attachments2.xml");
        String uri = url.toExternalForm();
        eap.setLocation(new UrlResource(uri));
        eap.readDocument();
        assertTrue(eap.getAttachments().isEmpty());
    }
View Full Code Here

        URL url = ExternalAttachmentProviderTest.class.getResource("resources/attachments3.xml");
        String uri = url.toExternalForm();
       
        control.replay();
        ExternalAttachmentProvider eap = new ExternalAttachmentProvider(bus);
        eap.setLocation(new UrlResource(uri));
        try {
            eap.readDocument();
            fail("Expected PolicyException not thrown.");
        } catch (PolicyException ex) {
            // expected
View Full Code Here

       
        control.replay();
        ExternalAttachmentProvider eap = new ExternalAttachmentProvider(bus);
        URL url = ExternalAttachmentProviderTest.class.getResource("resources/attachments4.xml");
        String uri = url.toExternalForm();
        eap.setLocation(new UrlResource(uri));
        eap.readDocument();
        assertEquals(1, eap.getAttachments().size());
        PolicyAttachment pa = eap.getAttachments().iterator().next();
        assertSame(p, pa.getPolicy());
        assertEquals(1, pa.getDomainExpressions().size());
View Full Code Here

   }

   public Resource getResource()
   {
      if (resource == null)
         resource = new UrlResource(fileURL);
      return resource;
   }
View Full Code Here

      BeanFactory beanFactory = null;
      ClassLoader cl = Thread.currentThread().getContextClassLoader();
      try
      {
         Thread.currentThread().setContextClassLoader(di.ucl);
         beanFactory = createBeanFactory(defaultName, new UrlResource(docURL));
      }
      finally
      {
         Thread.currentThread().setContextClassLoader(cl);
      }
View Full Code Here

           
            DbLoaderConfiguration config = new DbLoaderConfiguration(
                    this.dropTables,
                    this.createTables,
                    this.populateTables,
                    new UrlResource(this.tables),
                    new UrlResource(this.data),
                    null)
            ;

            String dataString = "(no data definition)";
            if (dataURL != null) {
View Full Code Here

        for (int i = 0; i < resources.length; i++)
        {
            ConfigResource resource = resources[i];
            if(resource.getUrl()!=null)
            {
                configResources[i] = new UrlResource(resource.getUrl());
            }
            else
            {
                try
                {
View Full Code Here

        // Try all distribution points and stop at first fetch that succeeds
        X509CRL crl = null;
        for (int i = 0; i < urls.length && crl == null; i++) {
           this.log.info("Attempting to fetch CRL at " + urls[i]);
           try {
               crl = CertUtils.fetchCRL(new UrlResource(urls[i]));
               this.log.info("Success. Caching fetched CRL.");
               this.crlCache.put(new Element(urls[i], crl));
           } catch (Exception e) {
               this.log.error("Error fetching CRL at " + urls[i], e);
           }
View Full Code Here

    public static Descriptor buildDescriptor(URL url) {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(DescriptorFactory.class.getClassLoader());
            ResourceXmlApplicationContext context = new ResourceXmlApplicationContext(
                            new UrlResource(url),
                            Arrays.asList(new Object[] { new XBeanProcessor() }));
            Descriptor descriptor = (Descriptor) context.getBean("jbi");
            checkDescriptor(descriptor);
            return descriptor;
        } finally {
View Full Code Here

TOP

Related Classes of org.springframework.core.io.UrlResource

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.