[richfaces-svn-commits] JBoss Rich Faces SVN: r15246 - branches/community/3.3.X/test-applications/facelets/src/main/java/util/parser.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Aug 21 07:38:06 EDT 2009


Author: mvitenkov
Date: 2009-08-21 07:38:06 -0400 (Fri, 21 Aug 2009)
New Revision: 15246

Modified:
   branches/community/3.3.X/test-applications/facelets/src/main/java/util/parser/TLDParser.java
Log:


Modified: branches/community/3.3.X/test-applications/facelets/src/main/java/util/parser/TLDParser.java
===================================================================
--- branches/community/3.3.X/test-applications/facelets/src/main/java/util/parser/TLDParser.java	2009-08-21 11:22:33 UTC (rev 15245)
+++ branches/community/3.3.X/test-applications/facelets/src/main/java/util/parser/TLDParser.java	2009-08-21 11:38:06 UTC (rev 15246)
@@ -4,6 +4,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.Reader;
 import java.util.ArrayList;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
@@ -22,12 +23,13 @@
 
 	public AttributesList getAllAttributes() {
 
-		tld = getRichfacesUI().getJarEntry("META-INF/richfaces.tld");
-		InputStream input = null;
+//		tld = getRichfacesUI().getJarEntry("META-INF/richfaces.tld");
+//		InputStream input = null;
 		try {
-			input = richfacesUI.getInputStream(tld);
+//			input = richfacesUI.getInputStream(tld);
 
-			InputStreamReader isr = new InputStreamReader(input);
+			//InputStreamReader isr = new InputStreamReader(input);
+			Reader isr = new InputStreamReader(Thread.currentThread().getContextClassLoader().getResource("META-INF/richfaces.tld").openStream());
 			BufferedReader reader = new BufferedReader(isr);
 			String line, attr;
 			Attribute attribute = new Attribute();
@@ -97,8 +99,18 @@
 
 	public String getExtPath() {
 		ClassLoader loader = Thread.currentThread().getContextClassLoader();
-		String resource = "META-INF/richfaces.tld";
-		return loader.getResource(resource).toString();
+		String resource = "META-INF/richfaces.tld";		
+		String temp = loader.getResource(resource).toString();		
+		//in case you put project war on server
+		if(temp.startsWith("vfszip")){
+			temp = temp.substring("vfszip:/".length(),temp.length()-"/META-INF/richfaces.tld".length());
+			System.out.println("TEMP:"+temp);
+		}else {
+		//in case you run project from eclipse IDE
+			temp = temp.substring("jar:file:/".length(),temp.length()-"!/META-INF/richfaces.tld".length());
+			System.out.println("TEMP:"+temp);
+		}
+		return temp;
 	}
 
 	public String getComponent() {
@@ -109,19 +121,18 @@
 		this.component = component;
 	}
 
-	public JarFile getRichfacesUI() {
-		String temp = null;
-		int position;
+	public JarFile getRichfacesUI() {		
 		try {
-			if ((position = getExtPath().indexOf('!')) != -1) {
-				if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
+			/*if ((position = getExtPath().indexOf('!')) != -1) {
+				if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {				
 					temp = getExtPath().substring("jar:file:\\".length(), position);
+				System.out.println("windows path 2:" + temp);
 				} else {
 					temp = "/"	+ getExtPath().substring("jar:file:/".length(),	position);
+					System.out.println("linux path:" + temp);
 				}
-
-			}
-			richfacesUI = new JarFile(temp);
+			}*/
+			richfacesUI = new JarFile("/WEB-INF/lib/richfaces-ui-3.3.2-20090820.123703-70.jar");
 		} catch (IOException e) {
 			e.printStackTrace();
 		}



More information about the richfaces-svn-commits mailing list