You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by me...@apache.org on 2010/05/16 14:31:25 UTC
svn commit: r944816 - in /incubator/jspwiki/trunk: ChangeLog
src/java/org/apache/wiki/Release.java
src/java/org/apache/wiki/auth/AuthenticationManager.java
src/java/org/apache/wiki/auth/AuthorizationManager.java
Author: metskem
Date: Sun May 16 12:31:24 2010
New Revision: 944816
URL: http://svn.apache.org/viewvc?rev=944816&view=rev
Log:
3.0.0-svn-219 JSPWIKI-646 JSPWiki cannot run without unpacking the war file
Modified:
incubator/jspwiki/trunk/ChangeLog
incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthenticationManager.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthorizationManager.java
Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=944816&r1=944815&r2=944816&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Sun May 16 12:31:24 2010
@@ -1,3 +1,9 @@
+2010-05-16 Harry Metske <me...@apache.org>
+
+ * 3.0.0-svn-219
+
+ * JSPWIKI-646 JSPWiki cannot run without unpacking the war file
+
2010-05-08 Harry Metske <me...@apache.org>
* 3.0.0-svn-218
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java?rev=944816&r1=944815&r2=944816&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java Sun May 16 12:31:24 2010
@@ -77,7 +77,7 @@ public final class Release
* <p>
* If the build identifier is empty, it is not added.
*/
- public static final String BUILD = "218";
+ public static final String BUILD = "219";
/**
* This is the generic version string you should use
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthenticationManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthenticationManager.java?rev=944816&r1=944815&r2=944816&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthenticationManager.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthenticationManager.java Sun May 16 12:31:24 2010
@@ -52,7 +52,6 @@ import org.apache.wiki.util.TextUtil;
import org.apache.wiki.util.TimedCounterList;
import org.freshcookies.security.Keychain;
-
/**
* Manages authentication activities for a WikiEngine: user login, logout, and
* credential refreshes. This class uses JAAS to determine how users log in.
@@ -774,7 +773,7 @@ public final class AuthenticationManager
{
try
{
- return defaultFile.toURL();
+ return defaultFile.toURI().toURL();
}
catch ( MalformedURLException e)
{
@@ -785,29 +784,43 @@ public final class AuthenticationManager
}
// Ok, the absolute path didn't work; try other methods
- ClassLoader cl = AuthenticationManager.class.getClassLoader();
-
- URL path = cl.getResource("/WEB-INF/"+name);
- if( path == null )
- path = cl.getResource("/"+name);
-
- if( path == null )
- path = cl.getResource(name);
-
- if( path == null && engine.getServletContext() != null )
+ URL path = null;
+
+ if( engine.getServletContext() != null )
{
try
{
- path = engine.getServletContext().getResource("/WEB-INF/"+name);
+ // create a tmp file of the policy loaded as an InputStream and return the URL to it
+ //
+ InputStream is = engine.getServletContext().getResourceAsStream("/WEB-INF/" + name);
+ File tmpFile = File.createTempFile("temp." + name, "");
+ tmpFile.deleteOnExit();
+
+ OutputStream os = new FileOutputStream(tmpFile);
+
+ byte[] buff = new byte[1024];
+
+ while (is.read(buff) != -1)
+ {
+ os.write(buff);
+ }
+
+ os.close();
+
+ path = tmpFile.toURI().toURL();
+
}
catch( MalformedURLException e )
{
// This should never happen unless I screw up
log.error("Your code is b0rked. You are a bad person.");
}
+ catch (IOException e)
+ {
+ log.error("failed to load security policy from " + name + ",stacktrace follows", e);
+ }
}
-
return path;
}
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthorizationManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthorizationManager.java?rev=944816&r1=944815&r2=944816&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthorizationManager.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthorizationManager.java Sun May 16 12:31:24 2010
@@ -448,6 +448,7 @@ public final class AuthorizationManager
if (policyURL != null)
{
File policyFile = new File( policyURL.getPath() );
+ log.info("We found security policy URL: " + policyURL + " and transformed it to file " + policyFile.getAbsolutePath());
m_localPolicy = new LocalPolicy( policyFile, engine.getContentEncoding() );
m_localPolicy.refresh();
log.info( "Initialized default security policy: " + policyFile.getAbsolutePath() );