[jboss-dev-forums] [Design of POJO Server] - Re: VFS Permissions - JBMICROCONT-149

adrian@jboss.org do-not-reply at jboss.com
Thu Nov 6 12:49:18 EST 2008


"david.lloyd at jboss.com" wrote : Just a note that vfs* handlers in the bootstrap lib don't have to be the real handlers, they can just be do-nothing stubs, since there is the opportunity to plug in a real URLStreamHandlerFactory at a later time.

I'm not sure that would work. From my experience the URL stuff does
some funny caching?

An alternative solution is to change the way the VFSClassLoaderPolicy determines
the code source. i.e. instead of returning the vfs url we could hack it to return
a normal url.

But this would restrict codesources to be the top level url, you couldn't for
example have different permissions for subdeployments in the same deployment.

The relevant code is in VFSClassLoaderPolicy

  |    @Override
  |    protected ProtectionDomain getProtectionDomain(String className, String path)
  |    {
  |       VirtualFile clazz = findChild(path);
  |       if (clazz == null)
  |       {
  |          log.trace("Unable to determine class file for " + className);
  |          return null;
  |       }
  |       try
  |       {
  |          VirtualFile root = findRoot(path);
  | 
  | // HERE!!!!!!!!
  | 
  |          URL codeSourceURL = root.toURL();
  | 

This could for example be replaced with something like:

  | URL codeSourceURL = VFSUtils.getRealURLHack(root);
  | 

An alternative solution would be to allow you to specify the codeSourceURL to use
for the classloader as a parameter when you create it.

The hack could then be in the jboss deployer that creates the classloader policy 
rather than forcing it on every user of VFSClassLoaderPolicy.
i.e. people that use it standalone would probably include jboss-vfs.jar
in the classpath so the urls would be parsable?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4187460#4187460

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4187460



More information about the jboss-dev-forums mailing list