Class InMemoryStreamHandler

java.lang.Object
java.net.URLStreamHandler
org.osgi.service.url.AbstractURLStreamHandlerService
com.webmethods.caf.faces.url.InMemoryStreamHandler
All Implemented Interfaces:
org.osgi.service.url.URLStreamHandlerService

public class InMemoryStreamHandler extends org.osgi.service.url.AbstractURLStreamHandlerService
Implementation of URLStreamHandler, registered as a service in osgi. Handles URLs starting with the prefix "inmemory". The idea is to pre-pend "inmemory" to any URL e.g inmemory:jar://path, so that the jvm uses this handler. Then strip the url of "inmemory", construct the original URL , read its resource and cache it in memory instead of reading the resource from file system. Used during the webserver MWS phase when jsf reads tag libraries and faces.config files.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    Fields inherited from class org.osgi.service.url.AbstractURLStreamHandlerService

    realHandler
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Open connection to the inmemory resource.
    void
    parseURL(org.osgi.service.url.URLStreamHandlerSetter rh, URL u, String spec, int start, int limit)
    Parses the URL string - spec parameter - extracts the original protocol and path, e.g file://path and puts it originalUrls map to be used later when URLConnection is requested in openConnection()

    Methods inherited from class org.osgi.service.url.AbstractURLStreamHandlerService

    equals, getDefaultPort, getHostAddress, hashCode, hostsEqual, sameFile, setURL, setURL, toExternalForm

    Methods inherited from class java.net.URLStreamHandler

    openConnection, parseURL

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • InMemoryStreamHandler

      public InMemoryStreamHandler()
  • Method Details

    • openConnection

      public URLConnection openConnection(URL url) throws IOException
      Open connection to the inmemory resource. If the resource is not found in memory, it reads is read by opening URL() to it.
      Specified by:
      openConnection in interface org.osgi.service.url.URLStreamHandlerService
      Specified by:
      openConnection in class org.osgi.service.url.AbstractURLStreamHandlerService
      Throws:
      IOException
    • parseURL

      public void parseURL(org.osgi.service.url.URLStreamHandlerSetter rh, URL u, String spec, int start, int limit)
      Parses the URL string - spec parameter - extracts the original protocol and path, e.g file://path and puts it originalUrls map to be used later when URLConnection is requested in openConnection()
      Specified by:
      parseURL in interface org.osgi.service.url.URLStreamHandlerService
      Overrides:
      parseURL in class org.osgi.service.url.AbstractURLStreamHandlerService