Class Handler


  • public class Handler
    extends MappedURLHandler
    A URL protocol handler for the res: protocol, which accesses application resources.

    URLs consist of these segments (where [...] indicates an optional segment):
    res: [//] [/] [path/]* file
    Where:

    [//]
    is optional, but makes it easier to distinguish URLs from files in user-supplied strings.
    [/]
    indicates that the path is not relative to /resources/, but to the default package (/)
    [path/]*
    is zero or more path entries (subfolders)
    [file]
    is the name of the resource file

    Note: the unusual class name is required for this class to be used by the default protocol handler factory.

    Since:
    3.0
    Author:
    Chris Jennings
    • Constructor Summary

      Constructors 
      Constructor Description
      Handler()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.net.URL mapURL​(java.net.URL sourceURL)
      Maps a URL in the handled protocol to one of the underlying URLs.
      • Methods inherited from class java.net.URLStreamHandler

        equals, getDefaultPort, getHostAddress, hashCode, hostsEqual, openConnection, parseURL, sameFile, setURL, setURL, toExternalForm
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Handler

        public Handler()
    • Method Detail

      • mapURL

        protected java.net.URL mapURL​(java.net.URL sourceURL)
                               throws java.io.IOException
        Description copied from class: MappedURLHandler
        Maps a URL in the handled protocol to one of the underlying URLs. The base class returns the original URL.
        Overrides:
        mapURL in class MappedURLHandler
        Parameters:
        sourceURL - a URL in the protocol handled by this handler
        Returns:
        a URL using another protocol that maps to the same resource as this handler, or null
        Throws:
        java.io.IOException - if an I/O error occurs while composing the new URL