Package org.springframework.core.io

Examples of org.springframework.core.io.Resource


     * @param name The name of the template to be resolved.
     * @param encoding The encoding of the resolved template.
     * @return The resolved template.
     */
    public Template resolve(String name, String encoding) {
        Resource resource = loadTemplateResource(name, encoding);
        return engine.createTemplate(resource, encoding);
    }
View Full Code Here


  }
 
  public void testGetDocument() {
    DefaultRtfDocumentHandler documentHandler = new DefaultRtfDocumentHandler();
   
    Resource rtfResource = getRtfResource();
    Map description = new HashMap();
    InputStream inputStream = null;
    try {
      inputStream = rtfResource.getInputStream();
      Document document = documentHandler.doGetDocumentWithInputStream(description, inputStream);
      checkField(document, "contents", true);
      checkField(document, "filename", false);
    } catch(Exception ex) {
      ex.printStackTrace();
View Full Code Here

  }
 
  public void testGetDocument() {
    PoiWordDocumentHandler documentHandler = new PoiWordDocumentHandler();
   
    Resource wordResource = getWordResource();
    Map description = new HashMap();
    InputStream inputStream = null;
    try {
      inputStream = wordResource.getInputStream();
      Document document = documentHandler.doGetDocumentWithInputStream(description, inputStream);
      checkField(document, "contents", true);
      checkField(document, "filename", false);
    } catch(Exception ex) {
      ex.printStackTrace();
View Full Code Here

      // Jackrabbit-specific implementation.
      JackrabbitNodeTypeManager nodeTypeManager = (JackrabbitNodeTypeManager) ws.getNodeTypeManager();

      boolean debug = log.isDebugEnabled();
      for (int i = 0; i < nodeDefinitions.length; i++) {
        Resource resource = nodeDefinitions[i];
        if (debug)
          log.debug("adding node type definitions from " + resource.getDescription());

        nodeTypeManager.registerNodeTypes(resource.getInputStream(), contentType);
      }
    }
  }
View Full Code Here

  }
 
  public void testGetDocument() {
    JExcelDocumentHandler documentHandler = new JExcelDocumentHandler();
   
    Resource excelResource = getExcelResource();
    Map description = new HashMap();
    InputStream inputStream = null;
    try {
      inputStream = excelResource.getInputStream();
      Document document = documentHandler.doGetDocumentWithInputStream(description, inputStream);
      checkField(document, "contents", true);
      checkField(document, "filename", false);
    } catch(Exception ex) {
      ex.printStackTrace();
View Full Code Here

  }
 
  public void testGetDocument() {
    PdfBoxDocumentHandler documentHandler = new PdfBoxDocumentHandler();
   
    Resource pdfResource = getPdfResource();
    Map description = new HashMap();
    InputStream inputStream = null;
    try {
      inputStream = pdfResource.getInputStream();
      Document document = documentHandler.doGetDocumentWithInputStream(description, inputStream);
      checkField(document, "path", false);
      checkField(document, "url", false);
      checkField(document, "contents", true);
      checkField(document, "summary", true);
View Full Code Here

     */
    public void testResolveConfigurationResource() throws Exception {
      
        factory.resolveConfigurationResource();
        DefaultResourceLoader loader = new DefaultResourceLoader();
        Resource res = loader.getResource("/repository.xml");
        assertEquals(res, factory.getConfiguration());
        assertEquals(".", factory.getHomeDir().getFilename());
       
    }
View Full Code Here

  protected void setUp() throws Exception {
  }

  protected void tearDown() throws Exception {
    //Index deleting
    Resource resource = new ClassPathResource("/org/springmodules/lucene/index/support/segments");
    try {
      if( resource.exists() ) {
        File indexFile = resource.getFile();
        indexFile.delete();
      }
    } catch(FileNotFoundException ex) { ex.printStackTrace(); }
  }
View Full Code Here

                 "META-INF/velocity/LostPasswordEmail.vm", resources);
    }


    private void addInlineResource(MimeMessageHelper messageHelper, String resourcePath, String resourceIdentifier) throws MessagingException {
        Resource resource = new ClassPathResource(resourcePath);
        messageHelper.addInline(resourceIdentifier, resource);
    }
View Full Code Here

        logger.debug("Trying to locate [" + dtdFile + "] under ["
            + SEARCH_PACKAGE + "]");
      }

      try {
        Resource resource = new ClassPathResource(SEARCH_PACKAGE + dtdFile,
            getClass());
        InputSource source = new InputSource(resource.getInputStream());
        source.setPublicId(publicId);
        source.setSystemId(systemId);

        if (logger.isDebugEnabled()) {
          logger.debug("Found beans DTD [" + systemId + "] in classpath");
View Full Code Here

TOP

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

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.