类 ImportSupport

java.lang.Object
org.apache.velocity.tools.generic.SafeConfig
org.apache.velocity.tools.generic.ImportSupport
直接已知子类:
JsonTool

@InvalidScope({"application","session","request"}) public class ImportSupport extends SafeConfig

Provides methods to import arbitrary local or remote resources as strings, generic version.

Based on ImportSupport from the JSTL taglib by Shawn Bayern

从以下版本开始:
VelocityTools 3.0
版本:
$$
作者:
Marino A. Jonsson, Claude Brisson
  • 字段详细资料

    • VALID_SCHEME_CHARS

      protected static final String VALID_SCHEME_CHARS
      另请参阅:
    • RESOURCE_KEY

      public static final String RESOURCE_KEY
      Configuration key for XmlTool and JsonTool, used to specify a local resource
      另请参阅:
    • URL_KEY

      public static final String URL_KEY
      Configuration key for ImportTool, XmlTool and JsonTool, used to specify a local or remote source URL
      另请参阅:
  • 构造器详细资料

    • ImportSupport

      public ImportSupport()
  • 方法详细资料

    • configure

      protected void configure(ValueParser values)
      Configure import support
      覆盖:
      configure 在类中 SafeConfig
      参数:
      values - configuration values
    • setSafeMode

      public void setSafeMode(boolean safe)
      Sets or clears safe mode
      覆盖:
      setSafeMode 在类中 SafeConfig
      参数:
      safe - flag value
    • acquireString

      public String acquireString(String url) throws IOException
      参数:
      url - the URL resource to return as string
      返回:
      the URL resource as string
      抛出:
      IOException - if operation failed
    • acquireRemoteURLString

      protected String acquireRemoteURLString(String url) throws IOException
      Aquire the content of a remote URL.
      参数:
      url - remote URL
      返回:
      the URL resource as string
      抛出:
      IOException - if operation failed
    • acquireLocalURLString

      protected String acquireLocalURLString(String url) throws IOException
      Aquire the content of a local URL.
      参数:
      url - local URL
      返回:
      the URL resource as string
      抛出:
      IOException - if operation failed
    • acquireReader

      public Reader acquireReader(String url) throws IOException
      Acquire a reader to an URL
      参数:
      url - the URL to read
      返回:
      a Reader for the InputStream created from the supplied URL
      抛出:
      IOException - if operation failed
    • acquireRemoteURLReader

      protected Reader acquireRemoteURLReader(String url) throws IOException
      Acquire a reader to a remote URL
      参数:
      url - the URL to read
      返回:
      a Reader for the InputStream created from the supplied URL
      抛出:
      IOException - if operation failed
    • acquireLocalURLReader

      protected Reader acquireLocalURLReader(String url) throws IOException
      Acquire a reader to a local URL - non applicable to the generic version of ImportSupport
      参数:
      url - the URL to read
      返回:
      a Reader for the InputStream created from the supplied URL
      抛出:
      IOException - if operation failed
    • isRemoteURL

      public static boolean isRemoteURL(String url)
      Returns whether an URL is remote or local
      参数:
      url - the url to check out
      返回:
      wether the URL is remote
    • getProtocol

      public static String getProtocol(String url)
      Returns protocol, or null for a local URL
      参数:
      url - the url to check out
      返回:
      found protocol or null for a local URL
    • getContentTypeAttribute

      public static String getContentTypeAttribute(String input, String name)
      Get the value associated with a content-type attribute. Syntax defined in RFC 2045, section 5.1.
      参数:
      input - the string containing the attributes
      name - the name of the content-type attribute
      返回:
      the value associated with a content-type attribute
    • getResourceString

      public String getResourceString(String resource)
      Fetch a local resource, first trying with a file (or a webapp resource for the view flavor) then with a classpath entry.
      参数:
      resource - the resource to read
      返回:
      the content of the resource
    • getResourceReader

      public Reader getResourceReader(String resource)
      Get a reader of a local resource, first trying with a file (or a webapp resource for the view flavor) then with a classpath entry.
      参数:
      resource - the resource to read
      返回:
      a reader of the resource
    • getFileResource

      protected URL getFileResource(String resource) throws Exception
      Overridable local file URL builder.
      参数:
      resource - the resource to read
      返回:
      the content of the resource
      抛出:
      Exception - if operation failed
    • getClasspathResource

      protected URL getClasspathResource(String resource) throws Exception
      Classpath entry URL builder
      参数:
      resource - the resource to read
      返回:
      the content of the resource
      抛出:
      Exception - if operation failed