Package org.springframework.core.io

Examples of org.springframework.core.io.ResourceEditor


    // Set bean properties from init parameters.
    try {
      PropertyValues pvs = new FilterConfigPropertyValues(filterConfig, this.requiredProperties);
      BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
      ResourceLoader resourceLoader = new ServletContextResourceLoader(filterConfig.getServletContext());
      bw.registerCustomEditor(Resource.class, new ResourceEditor(resourceLoader));
      initBeanWrapper(bw);
      bw.setPropertyValues(pvs, true);
    } catch (BeansException ex) {
      String msg = "Failed to set bean properties on filter '" + filterConfig.getFilterName() + "': "
          + ex.getMessage();
View Full Code Here


  private PropertyValue parseConfigLocationProperty(Element element) {
    Resource resource = null;

    String configLocation = element.getAttribute("configLocation");
    if (StringUtils.hasText(configLocation)) {
      ResourceEditor resourceEditor = new ResourceEditor();
      resourceEditor.setAsText(configLocation);
      resource = (Resource) resourceEditor.getValue();
    }

    return new PropertyValue("configLocation", resource);
  }
View Full Code Here

    parserControl.replay();

    parser.doParse(BeanName.CACHE_PROVIDER_FACADE, element, registry);
    Resource configLocation = getConfigLocationFromCacheManager();

    ResourceEditor editor = new ResourceEditor();
    editor.setAsText(configElementBuilder.configLocation);
    String expectedContent = getResourceContent((Resource) editor.getValue());
    String actualContent = getResourceContent(configLocation);
    assertEquals("<Config resource content>", expectedContent, actualContent);

    assertCacheProviderFacadeHasCacheManagerAsProperty();
  }
View Full Code Here

  /**
   * Create a new FileEditor,
   * using the default ResourceEditor underneath.
   */
  public FileEditor() {
    this.resourceEditor = new ResourceEditor();
  }
View Full Code Here

  /**
   * Create a new URLEditor, using the default ResourceEditor underneath.
   */
  public URLEditor() {
    this.resourceEditor = new ResourceEditor();
  }
View Full Code Here

   * @see org.springframework.beans.propertyeditors.ClassEditor
   * @see org.springframework.beans.propertyeditors.URIEditor
   * @see org.springframework.core.io.support.ResourceArrayPropertyEditor
   */
  public void registerCustomEditors(PropertyEditorRegistry registry) {
    ResourceEditor baseEditor = new ResourceEditor(this.resourceLoader);
    registry.registerCustomEditor(Resource.class, baseEditor);
    registry.registerCustomEditor(InputStream.class, new InputStreamEditor(baseEditor));
    registry.registerCustomEditor(File.class, new FileEditor(baseEditor));
    registry.registerCustomEditor(URL.class, new URLEditor(baseEditor));

View Full Code Here

  /**
   * Create a new InputStreamEditor,
   * using the default ResourceEditor underneath.
   */
  public InputStreamEditor() {
    this.resourceEditor = new ResourceEditor();
  }
View Full Code Here

    // Set bean properties from init parameters.
    try {
      PropertyValues pvs = new ServletConfigPropertyValues(getServletConfig(), this.requiredProperties);
      BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
      ResourceLoader resourceLoader = new ServletContextResourceLoader(getServletContext());
      bw.registerCustomEditor(Resource.class, new ResourceEditor(resourceLoader));
      initBeanWrapper(bw);
      bw.setPropertyValues(pvs, true);
    }
    catch (BeansException ex) {
      logger.error("Failed to set bean properties on servlet '" + getServletName() + "'", ex);
View Full Code Here

            {
                resource = (Resource) value;
            }
            else
            {
                ResourceEditor editor = new ResourceEditor();
                key = value.toString();
                editor.setAsText(key);
                resource = (Resource) editor.getValue();
            }
        }
        BeanFactory context = loadContext(resource, key);
        Context answer = (Context) context.getBean("jndi");
        if (answer == null)
View Full Code Here

  /**
   * Create a new InputSourceEditor,
   * using the default ResourceEditor underneath.
   */
  public InputSourceEditor() {
    this.resourceEditor = new ResourceEditor();
  }
View Full Code Here

TOP

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

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.