Package org.takes.tk

Class TkClasspath

  • All Implemented Interfaces:
    Take

    public final class TkClasspath
    extends TkWrap
    Take reading resources from classpath.

    This "take" is trying to find the requested resource in classpath and return it as an HTTP response with binary body, for example:

     new TkClasspath("/my");

    This object will take query part of the arrived HTTP Request and concatenate it with the "/my" prefix. For example, a request comes it and its query equals to "/css/style.css?eot". TkClasspath will try to find a resource "/my/css/style.css" in classpath.

    If such a resource is not found, HttpException will be thrown.

    The class is immutable and thread-safe.

    Since:
    0.1
    • Constructor Detail

      • TkClasspath

        public TkClasspath()
        Ctor.
      • TkClasspath

        public TkClasspath​(Class<?> base)
        Ctor.
        Parameters:
        base - Base class
      • TkClasspath

        public TkClasspath​(String prefix)
        Ctor.
        Parameters:
        prefix - Prefix