Example usage for org.apache.ibatis.io Resources getUrlAsReader

List of usage examples for org.apache.ibatis.io Resources getUrlAsReader

Introduction

In this page you can find the example usage for org.apache.ibatis.io Resources getUrlAsReader.

Prototype

public static Reader getUrlAsReader(String urlString) throws IOException 

Source Link

Document

Gets a URL as a Reader

Usage

From source file:com.ibatis.sqlmap.engine.builder.XmlSqlMapConfigParser.java

License:Apache License

@NodeEvent("/sqlMapConfig/sqlMap")
public void sqlMapConfigsqlMap(XNode context) throws Exception {
    String resource = context.getStringAttribute("resource");
    String url = context.getStringAttribute("url");

    Reader reader = null;/*  w ww .ja  v  a 2s.c om*/
    if (resource != null) {
        reader = Resources.getResourceAsReader(resource);
    } else if (url != null) {
        reader = Resources.getUrlAsReader(url);
    } else {
        throw new SqlMapException("The sqlMap element requires either a resource or a url attribute.");
    }
    new XmlSqlMapParser(this, reader).parse();
}