User: jules_gosnell
  Date: 02/04/09 13:54:09

  Modified:    src/main/org/jboss/net/protocol/njar Handler.java
  Log:
  move Jetty's code for converting an njar: to file: URL in here
  
  Revision  Changes    Path
  1.4       +23 -1     jboss-common/src/main/org/jboss/net/protocol/njar/Handler.java
  
  Index: Handler.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss-common/src/main/org/jboss/net/protocol/njar/Handler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Handler.java      28 Feb 2002 01:28:38 -0000      1.3
  +++ Handler.java      9 Apr 2002 20:54:09 -0000       1.4
  @@ -49,7 +49,7 @@
    *
    * @todo Add accessors so that the cache can be flushed.
    *
  - * @version <tt>$Revision: 1.3 $</tt>
  + * @version <tt>$Revision: 1.4 $</tt>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Hiram Chirino</a>
    */
   public class Handler
  @@ -143,5 +143,27 @@
            }
         }
      }
  +
  +  public static URL njarToFile(URL url)
  +    {
  +      if (url.getProtocol().equals(PROTOCOL))
  +      {
  +     try
  +     {
  +       // force the resource we are after to be unpacked - thanks
  +       // Jan & David...!
  +       URL dummy=new URL(PROTOCOL+":"+url.toString()+NJAR_SEPARATOR+"dummy.jar");
  +       String tmp=dummy.openConnection().getURL().toString();
  +       tmp=tmp.substring("jar:".length());
  +       tmp=tmp.substring(0, tmp.length()-(JAR_SEPARATOR+"dummy.jar").length());
  +       return new URL(tmp);
  +     }
  +     catch (Exception ignore)
  +     {
  +     }
  +      }
  +
  +      return url;
  +    }
   }
   
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to