You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by he...@dnbnor.no on 2006/02/20 14:40:04 UTC

Maven-proxy enhancement

Hi
 
I don't know if this is the right place to report this, but here goes:
 
Here is an enhancement for maven-provy-0.2 : When looking for the maven-proxy.properties, it only looks in the path meaning you need hardcoded paths in your web.xml file. Here is an enhancement, where it will look in the classpath if it can't find it in the path. This means you do not have wo worry about paths at all in web.xml.
 
  try {
   rcc = (new PropertyLoader()).load(new FileInputStream(file));
   event.getServletContext().setAttribute("config", rcc);
  } catch (FileNotFoundException ex) {
-   System.err.println("No such file: " + file.getAbsolutePath();
+   System.err.println("No such file: " + file.getAbsolutePath() + ". Trying to load from classpath");
+   InputStream in = this.getClass().getClassLoader()
+     .getResourceAsStream(filename);
+   try {
+    rcc = (new PropertyLoader()).load(in);
+    event.getServletContext().setAttribute("config", rcc);
+   } catch (Exception e) {
+    throw new RuntimeException(e);
+   }
  } catch (Exception ex) {
   throw new RuntimeException(ex);
  }

 
Hermod


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

This email with attachments is solely for the use of the individual or
entity to whom it is addressed. Please also be aware that DnB NOR cannot
accept any payment orders or other legally binding correspondence with
customers as a part of an email. 

This email message has been virus checked by the virus programs used
in the DnB NOR Group.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *