Package org.springframework.core.io

Examples of org.springframework.core.io.DefaultResourceLoader$ClassPathContextResource


   * a path. Subclasses may override to customize the resource loader used.
   * @see #getResourceFactory()
   * @return the resource loader
   */
  protected ResourceLoader createResourceLoader() {
    return new DefaultResourceLoader();
  }
View Full Code Here


  /**
   * Creates a new flow definition resource factory using a default resource loader.
   */
  public FlowDefinitionResourceFactory() {
    this.resourceLoader = new DefaultResourceLoader();
  }
View Full Code Here

    protected Resource createResource(Element resourceDefinition) {
        String path = resourceDefinition.getAttribute(LOCATION_ATTR);
        if (!StringUtils.hasText(path)) {
            throw new ValidationConfigurationException("Resoruce path is required and cannot be empty");
        }
        return new DefaultResourceLoader().getResource(path);
    }
View Full Code Here

    private Properties properties;

    public String getSecret(String appKey) {
        if (properties == null) {
            try {
                DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
                Resource resource = resourceLoader.getResource(appSecretFile);
                properties =   PropertiesLoaderUtils.loadProperties(resource);
            } catch (IOException e) {
                throw new RopException("在类路径下找不到rop.appSecret.properties的应用密钥的属性文件", e);
            }
        }
View Full Code Here

    }


    @Override
    public Map<String, Object> load(Collection<String> loadScripts) {
        ResourceLoader loader = new DefaultResourceLoader();
        Map<String, Object> retVal = new HashMap<>();
        for (String script : loadScripts) {
            try (InputStream stream = loader.getResource(script).getInputStream()) {
                List<String> lines = IOUtils.readLines(stream);
                String content = String.join("\n", lines);

                retVal.putAll(transaction.exec(() -> execute(content)));
            } catch (IOException e) {
View Full Code Here

    private RSSPortlet rssPortlet;
   
    @Override
    public void setUp()
    {
        servletContext = new MockServletContext(new DefaultResourceLoader());
        servletConfig = new MockServletConfig(servletContext);
        ((MockServletConfig) servletConfig).addInitParameter("spring-configuration", "/test-spring-init-servlet-beans.xml");
       
        springInitServlet = new SpringInitServlet();
       
        try
        {
            springInitServlet.init(servletConfig);
        }
        catch (ServletException e)
        {
            fail("Failed to initialize spring init servlet: " + e);
        }
       
        portletContext = new MockPortletContext(new DefaultResourceLoader());
        portletConfig = new MockPortletConfig(portletContext);
        ((MockPortletConfig) portletConfig).addInitParameter("stylesheet", "/test-rss.xsl");
        ResourceBundle bundle = new ListResourceBundle()
        {
            protected Object[][] getContents()
View Full Code Here

            return new UrlResource((URL) res);
        }
        if (res instanceof URI) {
            return new UrlResource(((URI) res).toURL());
        }
        return new DefaultResourceLoader().getResource(res.toString());
    }
View Full Code Here

  private ContentService contentService;

  public void testPersistContent() throws Exception {
    String buildName = "BUILD_100600601234";
    ResourceLoader loader = new DefaultResourceLoader();
    Resource resource = loader.getResource("testfile.txt");
    getContentService().persistContent(MudConstants.BUILD_NODE_STRUCTURE, buildName,
        resource.getInputStream());
    InputStream stream = getContentService().getContent(MudConstants.BUILD_NODE_STRUCTURE, buildName);
    getContentService().removeContent(MudConstants.BUILD_NODE_STRUCTURE, buildName);
    assertNotNull(stream);
View Full Code Here

   * Create a new MockServletContext.
   * @param resourceBasePath the WAR root directory (should not end with a slash)
   * @param resourceLoader the ResourceLoader to use (or null for the default)
   */
  public MockServletContext(String resourceBasePath, ResourceLoader resourceLoader) {
    this.resourceLoader = (resourceLoader != null ? resourceLoader : new DefaultResourceLoader());
    this.resourceBasePath = (resourceBasePath != null ? resourceBasePath : "");

    // Use JVM temp dir as ServletContext temp dir.
    String tempDir = System.getProperty(TEMP_DIR_SYSTEM_PROPERTY);
    if (tempDir != null) {
View Full Code Here

    public void setSettings(SessionSettings settings) {
        this.settings = settings;
    }

    private Resource getResource() {
        ResourceLoader loader = new DefaultResourceLoader();
        return loader.getResource(this.configuration);
    }
View Full Code Here

TOP

Related Classes of org.springframework.core.io.DefaultResourceLoader$ClassPathContextResource

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.