[jboss-dev-forums] [Design of POJO Server] - Re: Facelets scanning for .taglib.xml is broken in trunk
alesj
do-not-reply at jboss.com
Wed May 28 07:31:34 EDT 2008
"alesj" wrote :
| Any ideas on how to handle this still in no-VFS-aware way?
|
I should give up on the forum more often. :-)
An instance after I posted this I had 2 hack ideas.
OK, I hacked this one, and it works. :-)
| private static void searchFromURL(Set result, String prefix, String suffix, URL url) throws IOException
| {
| boolean done = false;
| InputStream is = getInputStream(url);
| if (is != null)
| {
| try
| {
| ZipInputStream zis;
| if (is instanceof ZipInputStream)
| zis = (ZipInputStream)is;
| else
| zis = new ZipInputStream(is);
| ZipEntry entry = zis.getNextEntry();
| String urlString = url.toExternalForm();
| while (entry != null)
| {
| String entryName = entry.getName();
| if (entryName.endsWith(suffix))
| {
| result.add(new URL(urlString + entryName));
| }
| entry = zis.getNextEntry();
| }
| done = true;
| }
| catch (Exception ignore)
| {
| }
| }
| if (done == false && prefix.length() > 0)
| {
| String urlString = url.toExternalForm();
| String[] split = prefix.split("/");
| prefix = join(split, false);
| String end = join(split, true);
| int p = urlString.lastIndexOf(end);
| url = new URL(urlString.substring(0, p));
| searchFromURL(result, prefix, suffix, url);
| }
| }
|
| private static String join(String[] split, boolean full)
| {
| String join = "";
| for (int j =0; j < split.length - (full ? 0 : 1); j++)
| join += split[j];
| return join;
| }
|
| private static InputStream getInputStream(URL url)
| {
| try
| {
| return url.openStream();
| }
| catch (Throwable t)
| {
| return null;
| }
| }
|
Good enough?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4153915#4153915
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4153915
More information about the jboss-dev-forums
mailing list