[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Small fix for Jetty 4.2.14
From: |
Dalibor Topic |
Subject: |
[PATCH] Small fix for Jetty 4.2.14 |
Date: |
Thu, 13 Nov 2003 01:29:05 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312 |
Hi,
attached is a small fix for Jetty 4.2.14 that is needed to get Jetty to
work with Classpath's file URL Connection. Jetty otherwise breaks on
startup and complains that webapps/templates can not be found, despite
that it exists. Jetty wants to access the path of the file permission on
a file URL connection to determine the existence of a file, apparently.
The fix overwrites getPermission the file URL connection to return a
FilePermission with the file path and a read permission.
cheers,
dalibor topic
2003-11-13 Dalibor Topic <address@hidden>
* libraries/javalib/gnu/java/net/protocol/file/Connection.java:
Added imports for java.io.FilePermission and
java.security.Permission.
(permission) New field.
(DEFAULT_PERMISSION) New constant.
(Connection) Create a FilePermission with permission to read
from file.
(getPermission) Overwrite getPermission to return a
FilePermission.
Index: libraries/javalib/gnu/java/net/protocol/file/Connection.java
===================================================================
RCS file:
/cvs/kaffe/kaffe/libraries/javalib/gnu/java/net/protocol/file/Connection.java,v
retrieving revision 1.1
diff -u -r1.1 Connection.java
--- libraries/javalib/gnu/java/net/protocol/file/Connection.java 29 Oct
2003 18:30:49 -0000 1.1
+++ libraries/javalib/gnu/java/net/protocol/file/Connection.java 13 Nov
2003 00:20:38 -0000
@@ -44,12 +44,14 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.io.FilePermission;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.ProtocolException;
import java.net.URL;
import java.net.URLConnection;
+import java.security.Permission;
import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Set;
@@ -79,7 +81,17 @@
* OutputStream if we are writing to the file
*/
private BufferedOutputStream outputStream;
-
+
+ /**
+ * FilePermission to read the file
+ */
+ private FilePermission permission;
+
+ /**
+ * Default permission for a file
+ */
+ private static final String DEFAULT_PERMISSION = "read";
+
/**
* Calls superclass constructor to initialize.
*/
@@ -89,6 +101,8 @@
/* Set up some variables */
doOutput = false;
+
+ permission = new FilePermission(getURL().getFile(), DEFAULT_PERMISSION);
}
/**
@@ -193,6 +207,19 @@
}
}
+
+ /**
+ * This method returns a <code>Permission</code> object representing the
+ * permissions required to access this URL. This method returns a
+ * <code>java.io.FilePermission</code> for the file's path with a read
+ * permission.
+ *
+ * @return A Permission object
+ */
+ public Permission getPermission() throws IOException
+ {
+ return permission;
+ }
/**
* Does the resource pointed to actually exist?
- [PATCH] Small fix for Jetty 4.2.14,
Dalibor Topic <=