Seam SVN: r8130 - in branches/Seam_2_0/examples: hibernate and 8 other directories.
by seam-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2008-05-07 10:56:13 -0400 (Wed, 07 May 2008)
New Revision: 8130
Modified:
branches/Seam_2_0/examples/hibernate/readme.txt
branches/Seam_2_0/examples/jpa/readme.txt
branches/Seam_2_0/examples/readme.txt
branches/Seam_2_0/examples/remoting/chatroom/readme.txt
branches/Seam_2_0/examples/remoting/gwt/readme.txt
branches/Seam_2_0/examples/remoting/helloworld/readme.txt
branches/Seam_2_0/examples/remoting/progressbar/readme.txt
branches/Seam_2_0/examples/seamdiscs/readme.txt
branches/Seam_2_0/examples/spring/readme.txt
branches/Seam_2_0/examples/ui/readme.txt
Log:
JBSEAM-2967
Modified: branches/Seam_2_0/examples/hibernate/readme.txt
===================================================================
--- branches/Seam_2_0/examples/hibernate/readme.txt 2008-05-07 14:53:25 UTC (rev 8129)
+++ branches/Seam_2_0/examples/hibernate/readme.txt 2008-05-07 14:56:13 UTC (rev 8130)
@@ -10,6 +10,7 @@
* ant jboss
* Start JBoss AS
* Access the app at http://localhost:8080/jboss-seam-hibernate/
+ * ant jboss.undeploy to undeploy example
JBoss AS 4.0.5.GA:
* Install JBoss AS with the default profile (with or without EJB3)
@@ -68,3 +69,5 @@
WEB/classes/GlassfishDerbyDialect.class is a special hack to get around
a Derby bug in Glassfish TM. You must use it as your Hibernate dialect
if you are using Derby with Glassfish.
+
+ Note: there is no testng suite for this example.
Modified: branches/Seam_2_0/examples/jpa/readme.txt
===================================================================
--- branches/Seam_2_0/examples/jpa/readme.txt 2008-05-07 14:53:25 UTC (rev 8129)
+++ branches/Seam_2_0/examples/jpa/readme.txt 2008-05-07 14:56:13 UTC (rev 8130)
@@ -10,6 +10,7 @@
* ant jboss
* Start JBoss AS
* Access the app at http://localhost:8080/jboss-seam-jpa/
+ * ant jboss.undeploy to undeploy example
JBoss AS 4.0.5 (with or without EJB3):
* Install JBoss AS 4.0.5 with the default J2EE profile
Modified: branches/Seam_2_0/examples/readme.txt
===================================================================
--- branches/Seam_2_0/examples/readme.txt 2008-05-07 14:53:25 UTC (rev 8129)
+++ branches/Seam_2_0/examples/readme.txt 2008-05-07 14:56:13 UTC (rev 8130)
@@ -90,8 +90,9 @@
Deploying and Testing an Example Application
============================================
-These are general instructions for deploying Seam examples. Take a look at the
-readme.txt in the example to see if there are any specific instructions.
+These are general instructions for deploying and working with the Seam examples.
+Take a look at the readme.txt in the example to see if there are any specific
+instructions.
How to Build and Deploy an Example on JBoss AS
----------------------------------------------
@@ -178,3 +179,8 @@
Make sure all these come before the referenced libraries
3. Locate and run the testng.xml file using the TestNG plugin
+
+Undeploying an Example
+----------------------
+
+In the "examples/${example.name}" directory, type "ant undeploy"
Modified: branches/Seam_2_0/examples/remoting/chatroom/readme.txt
===================================================================
--- branches/Seam_2_0/examples/remoting/chatroom/readme.txt 2008-05-07 14:53:25 UTC (rev 8129)
+++ branches/Seam_2_0/examples/remoting/chatroom/readme.txt 2008-05-07 14:56:13 UTC (rev 8130)
@@ -3,4 +3,6 @@
This example shows using Seam Remoting to subscribe and publish messages to JMS.
It runs on both JBoss AS and Tomcat
-example.name=chatroom
\ No newline at end of file
+example.name=chatroom
+
+Note: there is no testng suite for this example.
\ No newline at end of file
Modified: branches/Seam_2_0/examples/remoting/gwt/readme.txt
===================================================================
--- branches/Seam_2_0/examples/remoting/gwt/readme.txt 2008-05-07 14:53:25 UTC (rev 8129)
+++ branches/Seam_2_0/examples/remoting/gwt/readme.txt 2008-05-07 14:56:13 UTC (rev 8130)
@@ -10,4 +10,6 @@
GWT:
If you want to rebuild the GWT front end, you will need to download GWT, and configure build.properties to point to it.
- you can then run "ant gwt-compile" from this directory. It is pre-built by default.
-If you want to use the GWT hosted mode, well, read all about it from the GWT docs !
\ No newline at end of file
+If you want to use the GWT hosted mode, well, read all about it from the GWT docs !
+
+Note: there is no testng suite for this example.
\ No newline at end of file
Modified: branches/Seam_2_0/examples/remoting/helloworld/readme.txt
===================================================================
--- branches/Seam_2_0/examples/remoting/helloworld/readme.txt 2008-05-07 14:53:25 UTC (rev 8129)
+++ branches/Seam_2_0/examples/remoting/helloworld/readme.txt 2008-05-07 14:56:13 UTC (rev 8130)
@@ -3,4 +3,6 @@
This example is a trivial example of Seam Remoting.
It runs on both JBoss AS and Tomcat
-example.name=helloworld
\ No newline at end of file
+example.name=helloworld
+
+Note: there is no testng suite for this example.
\ No newline at end of file
Modified: branches/Seam_2_0/examples/remoting/progressbar/readme.txt
===================================================================
--- branches/Seam_2_0/examples/remoting/progressbar/readme.txt 2008-05-07 14:53:25 UTC (rev 8129)
+++ branches/Seam_2_0/examples/remoting/progressbar/readme.txt 2008-05-07 14:56:13 UTC (rev 8130)
@@ -3,4 +3,6 @@
This example shows how to create a progress bar using Seam Remoting.
It runs on both JBoss AS and Tomcat
-example.name=progressbar
\ No newline at end of file
+example.name=progressbar
+
+Note: there is no testng suite for this example.
\ No newline at end of file
Modified: branches/Seam_2_0/examples/seamdiscs/readme.txt
===================================================================
--- branches/Seam_2_0/examples/seamdiscs/readme.txt 2008-05-07 14:53:25 UTC (rev 8129)
+++ branches/Seam_2_0/examples/seamdiscs/readme.txt 2008-05-07 14:56:13 UTC (rev 8130)
@@ -6,7 +6,7 @@
http://localhost:8080/jboss-seam-discs (on Tomcat).
The seamdiscs example is a simple example built using the Seam Application
-Framework which allows you to record your favourite albums and artists. It
+Framework which allows you to record your favorite albums and artists. It
uses a mix of RichFaces and Trinidad components. It also uses the "inplace
editing" pattern; the same facelets are used for editing and display of data
(login to edit a disc or artist).
@@ -26,4 +26,6 @@
<tr:column>
...
</tr:column
-</tr:table>
\ No newline at end of file
+</tr:table>
+
+To undeploy the example from JBoss AS use ant unexplode
\ No newline at end of file
Modified: branches/Seam_2_0/examples/spring/readme.txt
===================================================================
--- branches/Seam_2_0/examples/spring/readme.txt 2008-05-07 14:53:25 UTC (rev 8129)
+++ branches/Seam_2_0/examples/spring/readme.txt 2008-05-07 14:56:13 UTC (rev 8130)
@@ -3,4 +3,8 @@
This example shows Seam/Spring integration.
Currently it runs on JBoss AS 4.2 only.
-Visit http://localhost:8080/jboss-seam-spring
\ No newline at end of file
+Visit http://localhost:8080/jboss-seam-spring
+
+To undeploy the example from JBoss AS use ant jbosswar.undeploy
+
+Note: there is no testng suite for this example.
\ No newline at end of file
Modified: branches/Seam_2_0/examples/ui/readme.txt
===================================================================
--- branches/Seam_2_0/examples/ui/readme.txt 2008-05-07 14:53:25 UTC (rev 8129)
+++ branches/Seam_2_0/examples/ui/readme.txt 2008-05-07 14:56:13 UTC (rev 8130)
@@ -2,4 +2,6 @@
===============
This is a simple example demonstrating Seam UI.
-example.name=ui
\ No newline at end of file
+example.name=ui
+
+Note: there is no testng suite for this example.
\ No newline at end of file
16 years, 8 months
Seam SVN: r8129 - branches/Seam_2_0/examples/groovybooking.
by seam-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2008-05-07 10:53:25 -0400 (Wed, 07 May 2008)
New Revision: 8129
Modified:
branches/Seam_2_0/examples/groovybooking/readme.txt
Log:
JBSEAM-2967
Modified: branches/Seam_2_0/examples/groovybooking/readme.txt
===================================================================
--- branches/Seam_2_0/examples/groovybooking/readme.txt 2008-05-07 14:23:00 UTC (rev 8128)
+++ branches/Seam_2_0/examples/groovybooking/readme.txt 2008-05-07 14:53:25 UTC (rev 8129)
@@ -7,4 +7,8 @@
When editing Groovy files from action, a simple ant jbosswar.explode is enough
When editing Groovy files from model, ant explode jbosswar.restart is necessary
-Access it at http://localhost:8080/jboss-seam-groovy
\ No newline at end of file
+Access it at http://localhost:8080/jboss-seam-groovy
+
+To undeploy the example from JBoss AS use ant jbosswar.unexplode
+
+Note: there is no testng suite for this example.
\ No newline at end of file
16 years, 8 months
Seam SVN: r8128 - branches/Seam_2_0/examples.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-07 10:23:00 -0400 (Wed, 07 May 2008)
New Revision: 8128
Modified:
branches/Seam_2_0/examples/build.xml
Log:
JBSEAM-2962
Modified: branches/Seam_2_0/examples/build.xml
===================================================================
--- branches/Seam_2_0/examples/build.xml 2008-05-07 12:43:50 UTC (rev 8127)
+++ branches/Seam_2_0/examples/build.xml 2008-05-07 14:23:00 UTC (rev 8128)
@@ -818,6 +818,7 @@
<fileset refid="groovy.jar" />
<fileset refid="trinidad-api.jar" />
<fileset refid="el-ri.jar" />
+ <fileset refid="jboss-common-core.jar" />
<mapper type="flatten" />
</copy>
<copy todir="${war.dir}">
16 years, 8 months
Seam SVN: r8127 - trunk/seam-gen/test and 1 other directory.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-07 08:43:50 -0400 (Wed, 07 May 2008)
New Revision: 8127
Modified:
branches/Seam_2_0/seam-gen/test/readme.txt
trunk/seam-gen/test/readme.txt
Log:
JBSEAM-2945
Modified: branches/Seam_2_0/seam-gen/test/readme.txt
===================================================================
--- branches/Seam_2_0/seam-gen/test/readme.txt 2008-05-07 12:41:42 UTC (rev 8126)
+++ branches/Seam_2_0/seam-gen/test/readme.txt 2008-05-07 12:43:50 UTC (rev 8127)
@@ -1,9 +1,9 @@
If you want to run tests using the Eclipse TestNG plugin, you'll need to add
these jars to the top of your TestNG classpath. Using the Run Dialog, select
xml suite to run, and add /lib/test/jboss-embedded-all.jar,
-/lib/test/hibernate-all.jar, /lib/test/thirdparty-all.jar, /lib/embedded-api.jar,
-/lib/jboss-deployers.jar and /bootstrap as the first entries in the User
-classpath.
+/lib/test/hibernate-all.jar, /lib/test/thirdparty-all.jar, /lib/jboss-embedded-api.jar,
+/lib/jboss-deployers-client-spi.jar, /lib/jboss-deployers-core-spi.jar, and
+/bootstrap as the first entries in the User classpath.
To add tests to your project create a TestNG xml descriptor called *Test.xml e.g.
FooTest.xml next to your test classes and run ant test.
\ No newline at end of file
Modified: trunk/seam-gen/test/readme.txt
===================================================================
--- trunk/seam-gen/test/readme.txt 2008-05-07 12:41:42 UTC (rev 8126)
+++ trunk/seam-gen/test/readme.txt 2008-05-07 12:43:50 UTC (rev 8127)
@@ -1,9 +1,9 @@
If you want to run tests using the Eclipse TestNG plugin, you'll need to add
these jars to the top of your TestNG classpath. Using the Run Dialog, select
xml suite to run, and add /lib/test/jboss-embedded-all.jar,
-/lib/test/hibernate-all.jar, /lib/test/thirdparty-all.jar, /lib/embedded-api.jar,
-/lib/jboss-deployers.jar and /bootstrap as the first entries in the User
-classpath.
+/lib/test/hibernate-all.jar, /lib/test/thirdparty-all.jar, /lib/jboss-embedded-api.jar,
+/lib/jboss-deployers-client-spi.jar, /lib/jboss-deployers-core-spi.jar, and
+/bootstrap as the first entries in the User classpath.
To add tests to your project create a TestNG xml descriptor called *Test.xml e.g.
FooTest.xml next to your test classes and run ant test.
\ No newline at end of file
16 years, 8 months
Seam SVN: r8126 - trunk/examples/jpa and 1 other directory.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-07 08:41:42 -0400 (Wed, 07 May 2008)
New Revision: 8126
Modified:
branches/Seam_2_0/examples/jpa/readme.txt
trunk/examples/jpa/readme.txt
Log:
JBSEAM0-2965
Modified: branches/Seam_2_0/examples/jpa/readme.txt
===================================================================
--- branches/Seam_2_0/examples/jpa/readme.txt 2008-05-07 12:40:39 UTC (rev 8125)
+++ branches/Seam_2_0/examples/jpa/readme.txt 2008-05-07 12:41:42 UTC (rev 8126)
@@ -62,8 +62,8 @@
* Start Tomcat
* Access the app at http://localhost:8080/jboss-seam-jpa/
-Glassfish (not currently working):
- * Install Glassfish v2 beta4
+Glassfish:
+ * Install Glassfish V2
* ant glassfish
* Start GlassFish
* Load the admin console http://localhost:4848/
Modified: trunk/examples/jpa/readme.txt
===================================================================
--- trunk/examples/jpa/readme.txt 2008-05-07 12:40:39 UTC (rev 8125)
+++ trunk/examples/jpa/readme.txt 2008-05-07 12:41:42 UTC (rev 8126)
@@ -62,8 +62,8 @@
* Start Tomcat
* Access the app at http://localhost:8080/jboss-seam-jpa/
-Glassfish (not currently working):
- * Install Glassfish v2 beta4
+Glassfish:
+ * Install Glassfish V2
* ant glassfish
* Start GlassFish
* Load the admin console http://localhost:4848/
16 years, 8 months
Seam SVN: r8125 - trunk/examples/hibernate and 1 other directory.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-07 08:40:39 -0400 (Wed, 07 May 2008)
New Revision: 8125
Modified:
branches/Seam_2_0/examples/hibernate/readme.txt
trunk/examples/hibernate/readme.txt
Log:
JBSEAM-2966
Modified: branches/Seam_2_0/examples/hibernate/readme.txt
===================================================================
--- branches/Seam_2_0/examples/hibernate/readme.txt 2008-05-07 12:36:55 UTC (rev 8124)
+++ branches/Seam_2_0/examples/hibernate/readme.txt 2008-05-07 12:40:39 UTC (rev 8125)
@@ -53,7 +53,7 @@
* Access the app at http://localhost:8080/jboss-seam-hibernate/
Glassfish
- * Install Glassfish v1 UR1
+ * Install Glassfish V1 or V2
* ant glassfish
* Start GlassFish
* Load the admin console http://localhost:4848/
Modified: trunk/examples/hibernate/readme.txt
===================================================================
--- trunk/examples/hibernate/readme.txt 2008-05-07 12:36:55 UTC (rev 8124)
+++ trunk/examples/hibernate/readme.txt 2008-05-07 12:40:39 UTC (rev 8125)
@@ -53,7 +53,7 @@
* Access the app at http://localhost:8080/jboss-seam-hibernate/
Glassfish
- * Install Glassfish v1 UR1
+ * Install Glassfish V1 or V2
* ant glassfish
* Start GlassFish
* Load the admin console http://localhost:4848/
16 years, 8 months
Seam SVN: r8124 - trunk/examples and 1 other directory.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-07 08:36:55 -0400 (Wed, 07 May 2008)
New Revision: 8124
Modified:
branches/Seam_2_0/examples/build.xml
trunk/examples/build.xml
Log:
Make jbosswar.undeploy delete the -ds.xml file
Modified: branches/Seam_2_0/examples/build.xml
===================================================================
--- branches/Seam_2_0/examples/build.xml 2008-05-07 12:21:20 UTC (rev 8123)
+++ branches/Seam_2_0/examples/build.xml 2008-05-07 12:36:55 UTC (rev 8124)
@@ -885,6 +885,7 @@
<target name="jbosswar.unexplode" description="Undeploy the example from JBoss">
<delete dir="${deploy.dir}/${example.name}.war" />
+ <delete file="${deploy.dir}/${example.name}-ds.xml" failonerror="no" />
</target>
<!-- #################### TEST TARGETS (JBOSS AS) ##################### -->
Modified: trunk/examples/build.xml
===================================================================
--- trunk/examples/build.xml 2008-05-07 12:21:20 UTC (rev 8123)
+++ trunk/examples/build.xml 2008-05-07 12:36:55 UTC (rev 8124)
@@ -906,6 +906,7 @@
<target name="jbosswar.unexplode" description="Undeploy the example from JBoss">
<delete dir="${deploy.dir}/${example.name}.war" />
+ <delete file="${deploy.dir}/${example.name}-ds.xml" failonerror="no" />
</target>
<!-- #################### TEST TARGETS (JBOSS AS) ##################### -->
16 years, 8 months
Seam SVN: r8123 - trunk and 1 other directory.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-07 08:21:20 -0400 (Wed, 07 May 2008)
New Revision: 8123
Modified:
branches/Seam_2_0/readme.txt
trunk/readme.txt
Log:
JBSEAM-2948
Modified: branches/Seam_2_0/readme.txt
===================================================================
--- branches/Seam_2_0/readme.txt 2008-05-07 11:21:57 UTC (rev 8122)
+++ branches/Seam_2_0/readme.txt 2008-05-07 12:21:20 UTC (rev 8123)
@@ -27,8 +27,10 @@
Running The TestNG Tests
------------------------
-In the jboss-seam-x.x.x.x directory, type "ant testcore" or "ant testall"
+In the jboss-seam-x.x.x.x directory, type "ant testcore testreport" or "ant testall testreport".
+Then checkout the report in the /test-report directory.
+
Running the TestNG Tests in Eclipse
-----------------------------------
Modified: trunk/readme.txt
===================================================================
--- trunk/readme.txt 2008-05-07 11:21:57 UTC (rev 8122)
+++ trunk/readme.txt 2008-05-07 12:21:20 UTC (rev 8123)
@@ -27,8 +27,10 @@
Running The TestNG Tests
------------------------
-In the jboss-seam-x.x.x.x directory, type "ant testcore" or "ant testall"
+In the jboss-seam-x.x.x.x directory, type "ant testcore testreport" or "ant testall testreport".
+Then checkout the report in the /test-report directory.
+
Running the TestNG Tests in Eclipse
-----------------------------------
16 years, 8 months
Seam SVN: r8122 - branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/resource and 2 other directories.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-05-07 07:21:57 -0400 (Wed, 07 May 2008)
New Revision: 8122
Added:
branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/resource/SafeStyleResources.java
trunk/ui/src/main/java/org/jboss/seam/ui/resource/SafeStyleResources.java
Modified:
branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/component/UILoadStyle.java
branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/resource/StyleResource.java
trunk/ui/src/main/java/org/jboss/seam/ui/component/UILoadStyle.java
trunk/ui/src/main/java/org/jboss/seam/ui/resource/StyleResource.java
Log:
JBSEAM-2942
Modified: branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/component/UILoadStyle.java
===================================================================
--- branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/component/UILoadStyle.java 2008-05-07 05:27:11 UTC (rev 8121)
+++ branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/component/UILoadStyle.java 2008-05-07 11:21:57 UTC (rev 8122)
@@ -9,6 +9,7 @@
import org.ajax4jsf.component.html.HtmlLoadStyle;
import org.jboss.seam.navigation.Pages;
+import org.jboss.seam.ui.resource.SafeStyleResources;
import org.jboss.seam.ui.resource.StyleResource;
import org.jboss.seam.ui.util.UrlBuilder;
import org.jboss.seam.util.Reflections;
@@ -22,9 +23,11 @@
UIConversationId uiConversationId = UIConversationId.newInstance();
uiConversationId.setViewId(Pages.getViewId(getFacesContext()));
+ String src = super.getSrc() != null ? super.getSrc().toString() : null;
+ SafeStyleResources.instance().addSafeStyleResource(src);
try
{
- UrlBuilder urlBuilder = new UrlBuilder(StyleResource.WEB_RESOURCE_PATH + super.getSrc(), null, FacesContext.getCurrentInstance().getResponseWriter().getCharacterEncoding());
+ UrlBuilder urlBuilder = new UrlBuilder(StyleResource.WEB_RESOURCE_PATH + src, null, FacesContext.getCurrentInstance().getResponseWriter().getCharacterEncoding());
urlBuilder.addParameter(uiConversationId);
if (isIsolated())
{
Added: branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/resource/SafeStyleResources.java
===================================================================
--- branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/resource/SafeStyleResources.java (rev 0)
+++ branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/resource/SafeStyleResources.java 2008-05-07 11:21:57 UTC (rev 8122)
@@ -0,0 +1,51 @@
+package org.jboss.seam.ui.resource;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
+
+@Scope(APPLICATION)
+@Name("org.jboss.seam.ui.resource.safeStyleResources")
+@BypassInterceptors
+@Install(precedence = BUILT_IN)
+public class SafeStyleResources
+{
+
+ private Set<String> safeStyleResources = new HashSet<String>();
+
+ public void addSafeStyleResource(String path)
+ {
+ this.safeStyleResources.add(path);
+ }
+
+ public boolean isStyleResourceSafe(String path)
+ {
+ if (safeStyleResources.contains(path))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public static SafeStyleResources instance()
+ {
+ if ( !Contexts.isApplicationContextActive() )
+ {
+ throw new IllegalStateException("No active application context");
+ }
+ return (SafeStyleResources) (Component.getInstance(SafeStyleResources.class));
+ }
+
+}
Property changes on: branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/resource/SafeStyleResources.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/resource/StyleResource.java
===================================================================
--- branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/resource/StyleResource.java 2008-05-07 05:27:11 UTC (rev 8121)
+++ branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/resource/StyleResource.java 2008-05-07 11:21:57 UTC (rev 8122)
@@ -19,6 +19,9 @@
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.core.Expressions;
+import org.jboss.seam.log.Log;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
import org.jboss.seam.servlet.ContextualHttpServletRequest;
import org.jboss.seam.util.Resources;
import org.jboss.seam.web.AbstractResource;
@@ -35,6 +38,8 @@
@BypassInterceptors
public class StyleResource extends AbstractResource
{
+
+ private LogProvider log = Logging.getLogProvider(StyleResource.class);
private static final Pattern EL_PATTERN = Pattern.compile("#" + Pattern.quote("{") + "(.*)"
+ Pattern.quote("}"));
@@ -65,6 +70,12 @@
throws IOException
{
String pathInfo = request.getPathInfo().substring(getResourcePath().length());
+ if (!SafeStyleResources.instance().isStyleResourceSafe(pathInfo))
+ {
+ log.warn(pathInfo + " isn't recognized as a valid stylesheet");
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
InputStream in = Resources.getResourceAsStream( pathInfo, getServletContext() );
if (in != null)
Modified: trunk/ui/src/main/java/org/jboss/seam/ui/component/UILoadStyle.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/component/UILoadStyle.java 2008-05-07 05:27:11 UTC (rev 8121)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/component/UILoadStyle.java 2008-05-07 11:21:57 UTC (rev 8122)
@@ -9,6 +9,7 @@
import org.ajax4jsf.component.html.HtmlLoadStyle;
import org.jboss.seam.navigation.Pages;
+import org.jboss.seam.ui.resource.SafeStyleResources;
import org.jboss.seam.ui.resource.StyleResource;
import org.jboss.seam.ui.util.UrlBuilder;
import org.jboss.seam.util.Reflections;
@@ -22,9 +23,11 @@
UIConversationId uiConversationId = UIConversationId.newInstance();
uiConversationId.setViewId(Pages.getViewId(getFacesContext()));
+ String src = super.getSrc() != null ? super.getSrc().toString() : null;
+ SafeStyleResources.instance().addSafeStyleResource(src);
try
{
- UrlBuilder urlBuilder = new UrlBuilder(StyleResource.WEB_RESOURCE_PATH + super.getSrc(), null, FacesContext.getCurrentInstance().getResponseWriter().getCharacterEncoding());
+ UrlBuilder urlBuilder = new UrlBuilder(StyleResource.WEB_RESOURCE_PATH + src, null, FacesContext.getCurrentInstance().getResponseWriter().getCharacterEncoding());
urlBuilder.addParameter(uiConversationId);
if (isIsolated())
{
Added: trunk/ui/src/main/java/org/jboss/seam/ui/resource/SafeStyleResources.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/resource/SafeStyleResources.java (rev 0)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/resource/SafeStyleResources.java 2008-05-07 11:21:57 UTC (rev 8122)
@@ -0,0 +1,51 @@
+package org.jboss.seam.ui.resource;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
+
+@Scope(APPLICATION)
+@Name("org.jboss.seam.ui.resource.safeStyleResources")
+@BypassInterceptors
+@Install(precedence = BUILT_IN)
+public class SafeStyleResources
+{
+
+ private Set<String> safeStyleResources = new HashSet<String>();
+
+ public void addSafeStyleResource(String path)
+ {
+ this.safeStyleResources.add(path);
+ }
+
+ public boolean isStyleResourceSafe(String path)
+ {
+ if (safeStyleResources.contains(path))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public static SafeStyleResources instance()
+ {
+ if ( !Contexts.isApplicationContextActive() )
+ {
+ throw new IllegalStateException("No active application context");
+ }
+ return (SafeStyleResources) (Component.getInstance(SafeStyleResources.class));
+ }
+
+}
Property changes on: trunk/ui/src/main/java/org/jboss/seam/ui/resource/SafeStyleResources.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/ui/src/main/java/org/jboss/seam/ui/resource/StyleResource.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/resource/StyleResource.java 2008-05-07 05:27:11 UTC (rev 8121)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/resource/StyleResource.java 2008-05-07 11:21:57 UTC (rev 8122)
@@ -19,6 +19,9 @@
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.core.Expressions;
+import org.jboss.seam.log.Log;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
import org.jboss.seam.servlet.ContextualHttpServletRequest;
import org.jboss.seam.util.Resources;
import org.jboss.seam.web.AbstractResource;
@@ -35,6 +38,8 @@
@BypassInterceptors
public class StyleResource extends AbstractResource
{
+
+ private LogProvider log = Logging.getLogProvider(StyleResource.class);
private static final Pattern EL_PATTERN = Pattern.compile("#" + Pattern.quote("{") + "(.*)"
+ Pattern.quote("}"));
@@ -65,6 +70,12 @@
throws IOException
{
String pathInfo = request.getPathInfo().substring(getResourcePath().length());
+ if (!SafeStyleResources.instance().isStyleResourceSafe(pathInfo))
+ {
+ log.warn(pathInfo + " isn't recognized as a valid stylesheet");
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
InputStream in = Resources.getResourceAsStream( pathInfo, getServletContext() );
if (in != null)
16 years, 8 months
Seam SVN: r8121 - trunk/src/main/org/jboss/seam/security/permission.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-05-07 01:27:11 -0400 (Wed, 07 May 2008)
New Revision: 8121
Added:
trunk/src/main/org/jboss/seam/security/permission/PermissionMetadata.java
Modified:
trunk/src/main/org/jboss/seam/security/permission/JpaPermissionStore.java
Log:
helper class for manipulating permission action sets
Modified: trunk/src/main/org/jboss/seam/security/permission/JpaPermissionStore.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/JpaPermissionStore.java 2008-05-07 03:10:20 UTC (rev 8120)
+++ trunk/src/main/org/jboss/seam/security/permission/JpaPermissionStore.java 2008-05-07 05:27:11 UTC (rev 8121)
@@ -25,6 +25,7 @@
import org.jboss.seam.annotations.security.permission.PermissionRole;
import org.jboss.seam.annotations.security.permission.PermissionTarget;
import org.jboss.seam.annotations.security.permission.PermissionUser;
+import org.jboss.seam.annotations.security.permission.Permissions;
import org.jboss.seam.core.Expressions;
import org.jboss.seam.core.Expressions.ValueExpression;
import org.jboss.seam.log.LogProvider;
@@ -67,10 +68,14 @@
private Map<Integer,String> queryCache = new HashMap<Integer,String>();
private IdentifierPolicy identifierPolicy;
+
+ private PermissionMetadata metadata;
@Create
public void init()
{
+ metadata = new PermissionMetadata();
+
// TODO see if we can scan for this automatically
if (userPermissionClass == null)
{
@@ -433,8 +438,7 @@
public List<String> listAvailableActions(Object target)
{
- // TODO implement
- return null;
+ return metadata.listAllowableActions(target.getClass());
}
private EntityManager lookupEntityManager()
Added: trunk/src/main/org/jboss/seam/security/permission/PermissionMetadata.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/PermissionMetadata.java (rev 0)
+++ trunk/src/main/org/jboss/seam/security/permission/PermissionMetadata.java 2008-05-07 05:27:11 UTC (rev 8121)
@@ -0,0 +1,180 @@
+package org.jboss.seam.security.permission;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.seam.annotations.security.permission.Permissions;
+
+/**
+ * Permission actions can either be persisted as a comma-separated list of values, or as a
+ * bit-masked numerical value where certain bits represent specific actions for that class. This
+ * is a helper class that handles the conversion automatically and presents a unified API for
+ * dealing with these persistent actions.
+ *
+ * @author Shane Bryzak
+ */
+public class PermissionMetadata
+{
+ private Map<Class,Boolean> usesActionMask = new HashMap<Class,Boolean>();
+ private Map<Class,Map<String,Long>> classActions = new HashMap<Class,Map<String,Long>>();
+
+ private synchronized void initClassActions(Class cls)
+ {
+ if (!classActions.containsKey(cls))
+ {
+ Map<String,Long> actions = new HashMap<String,Long>();
+
+ boolean useMask = false;
+
+ Permissions p = (Permissions) cls.getAnnotation(Permissions.class);
+ if (p != null)
+ {
+ org.jboss.seam.annotations.security.permission.Permission[] permissions = p.value();
+ if (permissions != null)
+ {
+ for (org.jboss.seam.annotations.security.permission.Permission permission : permissions)
+ {
+ actions.put(permission.action(), permission.mask());
+
+ if (permission.mask() != 0)
+ {
+ useMask = true;
+ }
+ }
+ }
+ }
+
+ // Validate that all actions have a proper mask
+ if (useMask)
+ {
+ Set<Long> masks = new HashSet<Long>();
+
+ for (String action : actions.keySet())
+ {
+ Long mask = actions.get(action);
+ if (masks.contains(mask))
+ {
+ throw new IllegalArgumentException("Class " + cls.getName() +
+ " defines a duplicate mask for permission action [" + action + "]");
+ }
+
+ if (mask == 0)
+ {
+ throw new IllegalArgumentException("Class " + cls.getName() +
+ " must define a valid mask value for action [" + action + "]");
+ }
+
+ if ((mask & (mask - 1)) != 0)
+ {
+ throw new IllegalArgumentException("Class " + cls.getName() +
+ " must define a mask value that is a power of 2 for action [" + action + "]");
+ }
+
+ masks.add(mask);
+ }
+ }
+
+ usesActionMask.put(cls, useMask);
+ classActions.put(cls, actions);
+ }
+ }
+
+ private class ActionSet
+ {
+ private Set<String> members = new HashSet<String>();
+ private Class targetClass;
+
+ public ActionSet(Class targetClass, String members)
+ {
+ this.targetClass = targetClass;
+
+ if (usesActionMask.get(targetClass))
+ {
+ // bit mask-based actions
+ long vals = Long.valueOf(members);
+
+ Map<String,Long> actions = classActions.get(targetClass);
+ for (String action : actions.keySet())
+ {
+ long mask = actions.get(action).longValue();
+ if ((vals & mask) != 0)
+ {
+ this.members.add(action);
+ }
+ }
+ }
+ else
+ {
+ // comma-separated string based actions
+ String[] actions = members.split(",");
+ for (String action : actions)
+ {
+ this.members.add(action);
+ }
+ }
+ }
+
+ public ActionSet add(String action)
+ {
+ members.add(action);
+ return this;
+ }
+
+ public ActionSet remove(String action)
+ {
+ members.remove(action);
+ return this;
+ }
+
+ @Override
+ public String toString()
+ {
+ if (usesActionMask.get(targetClass))
+ {
+ Map<String,Long> actions = classActions.get(targetClass);
+ long mask = 0;
+
+ for (String member : members)
+ {
+ mask |= actions.get(member).longValue();
+ }
+
+ return "" + mask;
+ }
+ else
+ {
+ StringBuilder sb = new StringBuilder();
+ for (String member : members)
+ {
+ if (sb.length() > 0) sb.append(',');
+ sb.append(member);
+ }
+ return sb.toString();
+ }
+ }
+ }
+
+ public ActionSet createActionSet(Class targetClass, String members)
+ {
+ if (!classActions.containsKey(targetClass)) initClassActions(targetClass);
+
+ return new ActionSet(targetClass, members);
+ }
+
+ public List<String> listAllowableActions(Class targetClass)
+ {
+ if (!classActions.containsKey(targetClass)) initClassActions(targetClass);
+
+ List<String> actions = new ArrayList<String>();
+ for (String action : classActions.get(targetClass).keySet())
+ {
+ actions.add(action);
+ }
+
+ return actions;
+ }
+}
16 years, 8 months