[jboss-dev-forums] [Design of POJO Server] - Re: VFS Permissions - JBMICROCONT-149
anil.saldhana@jboss.com
do-not-reply at jboss.com
Tue Nov 11 10:00:05 EST 2008
| */
| public static final String FILE_PROTOCOL = "file";
|
| + /**
| + * Constant representing the JAR file protocol
| + */
| + public static final String JAR_FILE_PROTOCOL = "jar:file:";
| +
| + /**
| + * Constant representing the VFS ZIP protocol
| + */
| + public static final String VFSZIP_PROTOCOL = "vfszip";
| +
| + /**
| + * Constant representing the VFS file protocol
| + */
| + public static final String VFS_FILE_PROTOCOL = "vfsfile";
| +
| /** Standard separator for JAR URL */
| public static final String JAR_URL_SEPARATOR = "!/";
|
| @@ -157,6 +172,40 @@
|
| return buffer.toString();
| }
| +<<<<<<< .mine
| +
| + /**
| + * Get the Real URL
| + * @param vfsURL
| + * @return
| + * @throws Exception
| + */
| + public static URL getRealURL(URL vfsURL) throws Exception
| + {
| + if(vfsURL.getProtocol().startsWith(VFS_FILE_PROTOCOL)) //vfsfile:
| + return new URL(FILE_PROTOCOL, vfsURL.getHost(), vfsURL.getPort(), vfsURL.getFile());
| +
| + if(vfsURL.getProtocol().startsWith(VFSZIP_PROTOCOL)) //vfszip:
| + {
| + String urlStr = vfsURL.toExternalForm();
| +
| + //Look for the first matching archive (sar, war, ear, jar)
| + String tokens[] = urlStr.split(".[a-z&&[jsrew]]ar", 2);
| +
| + int lengthOfToken = tokens[0].length();
| + String typeArchive = urlStr.substring(lengthOfToken,lengthOfToken + 4);
| +
| + String firstPath = tokens[0].substring(VFSZIP_PROTOCOL.length() + 1);
| +
| + return new URL( new URL(JAR_FILE_PROTOCOL + firstPath + typeArchive + JAR_URL_SEPARATOR ),
| + tokens[1]);
| + }
| + if(log.isTraceEnabled())
| + log.trace("getRealURL did not have a match for:"+vfsURL.toExternalForm());
| + return vfsURL;
| + }
| +=======
| +>>>>>>> .r80795
|
|
That was the final version I was supposed to put last night but failed and now it has been rolled back.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4188475#4188475
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4188475
More information about the jboss-dev-forums
mailing list