Examples of EncodedResource


Examples of org.springframework.core.io.support.EncodedResource

  public void testRefToSingleton() throws Exception {
    DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
    reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
    Resource resource = new ClassPathResource("reftypes.xml", getClass());
    reader.loadBeanDefinitions(new EncodedResource(resource, "ISO-8859-1"));

    TestBean jen = (TestBean) xbf.getBean("jenny");
    TestBean dave = (TestBean) xbf.getBean("david");
    TestBean jenks = (TestBean) xbf.getBean("jenks");
    ITestBean davesJen = dave.getSpouse();
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * @return the number of bean definitions found
   * @throws BeanDefinitionStoreException in case of loading or parsing errors
   * @see #loadBeanDefinitions(org.springframework.core.io.Resource, String)
   */
  public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException {
    return loadBeanDefinitions(new EncodedResource(resource), null);
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * (can be empty or <code>null</code>)
   * @return the number of bean definitions found
   * @throws BeanDefinitionStoreException in case of loading or parsing errors
   */
  public int loadBeanDefinitions(Resource resource, String prefix) throws BeanDefinitionStoreException {
    return loadBeanDefinitions(new EncodedResource(resource), prefix);
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

  Document loadDocument(Resource resource) {

    Assert.notNull(resource);

    EncodedResource encodedResource = new EncodedResource(resource, "UTF-8");

    InputStream inputStream = null;
    try {
      // this will throw an IOException if the stream cannot be opened
      inputStream = encodedResource.getResource().getInputStream();
    }
    catch (IOException e) {
      throw new ConfigurationException(
          "Could not load module definition, as unable to obtain input stream for resource "
              + encodedResource.getResource(), e);
    }

    Document document = null;

    DefaultDocumentLoader loader = new DefaultDocumentLoader();
    try {
      InputSource inputSource = new InputSource(inputStream);
      inputSource.setEncoding(encodedResource.getEncoding());
      document = loader.loadDocument(inputSource, null, new SimpleSaxErrorHandler(logger),
          XmlBeanDefinitionReader.VALIDATION_NONE, false);
    }
    catch (Exception e) {
      throw new ConfigurationException("Unable to load XML module definition document from resource "
          + encodedResource.getResource(), e);
    }
    finally {
      try {
        if (inputStream != null)
          inputStream.close();
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * @param resource the resource descriptor for the XML file
   * @return the number of bean definitions found
   * @throws BeanDefinitionStoreException in case of loading or parsing errors
   */
  public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException {
    return loadBeanDefinitions(new EncodedResource(resource));
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * @param resource the resource descriptor for the XML file
   * @return the number of bean definitions found
   * @throws BeanDefinitionStoreException in case of loading or parsing errors
   */
  public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException {
    return loadBeanDefinitions(new EncodedResource(resource));
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * and continueOnError was <code>false</code>
   */
  protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException {

    Resource resource = this.applicationContext.getResource(sqlResourcePath);
    SimpleJdbcTestUtils.executeSqlScript(this.simpleJdbcTemplate, new EncodedResource(resource,
      this.sqlScriptEncoding), continueOnError);
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

  protected void executeSqlScript(String sqlResourcePath, boolean continueOnError)
      throws DataAccessException {

    Resource resource = this.applicationContext.getResource(sqlResourcePath);
    SimpleJdbcTestUtils.executeSqlScript(
        this.simpleJdbcTemplate, new EncodedResource(resource, this.sqlScriptEncoding), continueOnError);
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

  protected void executeSqlScript(String sqlResourcePath, boolean continueOnError)
      throws DataAccessException {

    Resource resource = this.applicationContext.getResource(sqlResourcePath);
    SimpleJdbcTestUtils.executeSqlScript(
        this.simpleJdbcTemplate, new EncodedResource(resource, this.sqlScriptEncoding), continueOnError);
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * and continueOnError was <code>false</code>
   */
  public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate,
      Resource resource, boolean continueOnError) throws DataAccessException {

    executeSqlScript(simpleJdbcTemplate, new EncodedResource(resource), continueOnError);
  }
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.