Seam SVN: r8329 - in trunk: build and 11 other directories.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-06-04 18:53:43 -0400 (Wed, 04 Jun 2008)
New Revision: 8329
Added:
trunk/examples/mail/src/org/jboss/seam/example/mail/test/sanitization.xhtml
trunk/src/mail/org/jboss/seam/mail/ui/Header.java
trunk/src/test/mail/
trunk/src/test/mail/unit/
trunk/src/test/mail/unit/org/
trunk/src/test/mail/unit/org/jboss/
trunk/src/test/mail/unit/org/jboss/seam/
trunk/src/test/mail/unit/org/jboss/seam/test/
trunk/src/test/mail/unit/org/jboss/seam/test/mail/
trunk/src/test/mail/unit/org/jboss/seam/test/mail/unit/
trunk/src/test/mail/unit/org/jboss/seam/test/mail/unit/HeaderTest.java
trunk/src/test/mail/unit/org/jboss/seam/test/mail/unit/testng.xml
Modified:
trunk/build.xml
trunk/build/mail.pom.xml
trunk/examples/mail/src/org/jboss/seam/example/mail/test/MailTest.java
trunk/src/mail/org/jboss/seam/mail/ui/AddressComponent.java
trunk/src/mail/org/jboss/seam/mail/ui/UIAttachment.java
trunk/src/mail/org/jboss/seam/mail/ui/UIBody.java
trunk/src/mail/org/jboss/seam/mail/ui/UIHeader.java
trunk/src/mail/org/jboss/seam/mail/ui/UIMessage.java
trunk/src/mail/org/jboss/seam/mail/ui/UISubject.java
Log:
JBSEAM-3071
Modified: trunk/build/mail.pom.xml
===================================================================
--- trunk/build/mail.pom.xml 2008-06-04 15:55:09 UTC (rev 8328)
+++ trunk/build/mail.pom.xml 2008-06-04 22:53:43 UTC (rev 8329)
@@ -60,6 +60,19 @@
<artifactId>el-api</artifactId>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.6</version>
+ <optional>true</optional>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2008-06-04 15:55:09 UTC (rev 8328)
+++ trunk/build.xml 2008-06-04 22:53:43 UTC (rev 8329)
@@ -24,6 +24,7 @@
<property name="classes.remoting.dir" value="${classes.dir}/remotingclasses" />
<property name="classes.gen.dir" value="${classes.dir}/genclasses" />
<property name="classes.test.dir" value="${classes.dir}/testclasses" />
+ <property name="classes.mail.test.dir" value="${classes.dir}/mailtestclasses" />
<property name="ui.dir" value="${basedir}/ui" />
<property name="seamgen.dir" value="${basedir}/seam-gen" />
@@ -42,6 +43,7 @@
<property name="src.remoting.dir" value="src/remoting" />
<property name="src.test.dir" value="src/test" />
<property name="src.unit.test.dir" value="${src.test.dir}/unit" />
+ <property name="src.mail.unit.test.dir" value="${src.test.dir}/mail/unit" />
<!-- Library directories -->
<property name="eejb.conf.dir" value="${basedir}/bootstrap" />
@@ -643,27 +645,32 @@
<!-- ########################### TEST TARGETS ###########################-->
- <target name="compiletest" depends="inittestcore,select-compiler,antlr">
- <compile classesdir="${classes.test.dir}" srcdir="${src.unit.test.dir}" classpath="test.compile.path" />
- </target>
+
- <target name="inittestcore" depends="build">
- <init classesdir="${classes.test.dir}" srcdir="${src.unit.test.dir}" modulename="core" pom="${core.pom}" scope="test" message="" />
- <copy todir="${classes.test.core.dir}">
- <fileset dir="${classes.core.dir}" includes="**/*.*" />
- </copy>
- <inlineDependencies scope="compile" id="remoting">
- <dependency groupId="org.jboss.seam" artifactId="jboss-seam-remoting" version="${complete.version}" />
- </inlineDependencies>
- <path id="test.compile.path">
- <path refid="test.core.path" />
- <path path="${classes.test.core.dir}" />
- <path refid="compile.remoting.path" />
- </path>
- </target>
- <target name="unittest" depends="inittestcore,compiletest,getemma" description="Run the Unit tests">
+ <target name="unittest" depends="unittestcore, unittestmail" description="Run the Unit tests" />
+
+ <target name="compiletest" depends="inittestcore,select-compiler,antlr">
+ <compile classesdir="${classes.test.dir}" srcdir="${src.unit.test.dir}" classpath="test.compile.path" />
+ </target>
+
+ <target name="inittestcore" depends="build">
+ <init classesdir="${classes.test.dir}" srcdir="${src.unit.test.dir}" modulename="core" pom="${core.pom}" scope="test" message="" />
+ <copy todir="${classes.test.core.dir}">
+ <fileset dir="${classes.core.dir}" includes="**/*.*" />
+ </copy>
+ <inlineDependencies scope="compile" id="remoting">
+ <dependency groupId="org.jboss.seam" artifactId="jboss-seam-remoting" version="${complete.version}" />
+ </inlineDependencies>
+ <path id="test.compile.path">
+ <path refid="test.core.path" />
+ <path path="${classes.test.core.dir}" />
+ <path refid="compile.remoting.path" />
+ </path>
+ </target>
+
+ <target name="unittestcore" depends="inittestcore,compiletest,getemma">
<taskdef resource="testngtasks" classpathref="test.core.path" />
<testng outputdir="${test.dir}">
<jvmarg value="-Demma.coverage.out.file=${coverage.ec}" />
@@ -680,6 +687,35 @@
<echo>You can increase the logging by editing bootstrap/log4j.xml</echo>
</target>
+ <target name="inittestmail" depends="build">
+ <init classesdir="${classes.mail.test.dir}" srcdir="${src.mail.unit.test.dir}" modulename="mail" pom="${mail.pom}" scope="test" message="" />
+ <path id="test.mail.compile.path">
+ <path refid="test.mail.path" />
+ <path path="${classes.mail.test.dir}" />
+ <path location="${classes.mail.dir}" />
+ </path>
+ </target>
+
+ <target name="compiletestmail" depends="inittestmail,select-compiler,antlr">
+ <compile classesdir="${classes.mail.test.dir}" srcdir="${src.mail.unit.test.dir}" classpath="test.mail.compile.path" />
+ </target>
+
+ <target name="unittestmail" depends="inittestmail,compiletestmail,getemma">
+ <taskdef resource="testngtasks" classpathref="test.mail.path" />
+ <testng outputdir="${test.dir}">
+ <jvmarg value="-Demma.coverage.out.file=${coverage.ec}" />
+ <jvmarg line="-Djava.awt.headless=true" />
+ <classpath>
+ <path path="${classes.mail.test.dir}" />
+ <path location="${classes.mail.dir}" />
+ <path refid="runtime.emma.path" />
+ <path refid="test.mail.path" />
+ </classpath>
+ <xmlfileset dir="${classes.mail.test.dir}" includes="**/testng.xml" />
+ </testng>
+ <echo>You can increase the logging by editing bootstrap/log4j.xml</echo>
+ </target>
+
<target name="test" depends="unittest, integrationtest" description="Run Seam Unit Tests and the Seam (core) Integration Tests"/>
<target name="integrationtest" description="Run the Seam (core) Inteegration Tests">
Modified: trunk/examples/mail/src/org/jboss/seam/example/mail/test/MailTest.java
===================================================================
--- trunk/examples/mail/src/org/jboss/seam/example/mail/test/MailTest.java 2008-06-04 15:55:09 UTC (rev 8328)
+++ trunk/examples/mail/src/org/jboss/seam/example/mail/test/MailTest.java 2008-06-04 22:53:43 UTC (rev 8329)
@@ -4,6 +4,7 @@
import static javax.mail.Message.RecipientType.CC;
import java.io.InputStream;
+import java.util.Enumeration;
import javax.faces.FacesException;
import javax.faces.context.FacesContext;
@@ -91,6 +92,8 @@
}
+
+
@Test
public void testAttachment() throws Exception
{
@@ -534,6 +537,40 @@
}
@Test
+ public void testSanitization() throws Exception
+ {
+
+ new FacesRequest()
+ {
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ Contexts.getEventContext().set("name", "Pete\nMuir");
+ MimeMessage renderedMessage = getRenderedMailMessage("/org/jboss/seam/example/mail/test/sanitization.xhtml");
+ assert "Try out".equals(renderedMessage.getSubject());
+ InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
+ assert to.getAddress().equals("peter(a)email.tld");
+ assert to.getPersonal().equals("Pete");
+ assert renderedMessage.getFrom().length == 1;
+ assert renderedMessage.getFrom()[0] instanceof InternetAddress;
+ InternetAddress from = (InternetAddress) renderedMessage.getFrom()[0];
+ assert from.getAddress().equals("peter(a)example.com");
+ assert from.getPersonal().equals("Pete");
+ assert renderedMessage.getHeader("Pete") != null;
+ assert renderedMessage.getHeader("Pete").length == 1;
+ assert "roll".equals(renderedMessage.getHeader("Pete")[0]);
+ }
+ }.run();
+ }
+
+ @Test
public void testTemplating() throws Exception
{
Added: trunk/examples/mail/src/org/jboss/seam/example/mail/test/sanitization.xhtml
===================================================================
--- trunk/examples/mail/src/org/jboss/seam/example/mail/test/sanitization.xhtml (rev 0)
+++ trunk/examples/mail/src/org/jboss/seam/example/mail/test/sanitization.xhtml 2008-06-04 22:53:43 UTC (rev 8329)
@@ -0,0 +1,14 @@
+<m:message xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:m="http://jboss.com/products/seam/mail"
+ xmlns:h="http://java.sun.com/jsf/html">
+
+ <m:from name="#{name}">peter(a)example.com
+ foo</m:from>
+ <m:to name="#{name}">peter(a)email.tld
+ bar</m:to>
+ <m:subject>Try out
+ Seam!</m:subject>
+ <m:header name="#{name}">roll
+ over</m:header>
+ <m:body>A mail message to test sanitization</m:body>
+</m:message>
\ No newline at end of file
Property changes on: trunk/examples/mail/src/org/jboss/seam/example/mail/test/sanitization.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/mail/org/jboss/seam/mail/ui/AddressComponent.java
===================================================================
--- trunk/src/mail/org/jboss/seam/mail/ui/AddressComponent.java 2008-06-04 15:55:09 UTC (rev 8328)
+++ trunk/src/mail/org/jboss/seam/mail/ui/AddressComponent.java 2008-06-04 22:53:43 UTC (rev 8329)
@@ -25,15 +25,16 @@
protected InternetAddress getInternetAddress(FacesContext facesContext) throws IOException, AddressException
{
InternetAddress address = new InternetAddress();
- address.setAddress(getAddress() != null ? getAddress() : encode(facesContext));
+ address.setAddress(new Header(getAddress() != null ? getAddress() : encode(facesContext)).getSanitizedValue());
String charset = findMessage().getCharset();
+ String personal = new Header(getName()).getSanitizedValue();
if (charset == null)
{
- address.setPersonal(getName());
+ address.setPersonal(personal);
}
else
{
- address.setPersonal(getName(), charset);
+ address.setPersonal(personal, charset);
}
address.validate();
return address;
@@ -70,7 +71,7 @@
*/
public String getName()
{
- if (address == null)
+ if (name == null)
{
return getString("name");
}
Added: trunk/src/mail/org/jboss/seam/mail/ui/Header.java
===================================================================
--- trunk/src/mail/org/jboss/seam/mail/ui/Header.java (rev 0)
+++ trunk/src/mail/org/jboss/seam/mail/ui/Header.java 2008-06-04 22:53:43 UTC (rev 8329)
@@ -0,0 +1,70 @@
+package org.jboss.seam.mail.ui;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+
+public class Header
+{
+
+ private final String name;
+ private final String value;
+
+ private String sanitizedName;
+ private String sanitizedValue;
+
+ public Header(String name, String value)
+ {
+ this.name = name;
+ this.value = value;
+ }
+
+ public Header(String value)
+ {
+ this.value = value;
+ this.name = null;
+ }
+
+ public String getSanitizedName()
+ {
+ if (sanitizedName == null && name != null)
+ {
+ try
+ {
+ sanitizedName = sanitize(name);
+ }
+ catch (IOException e)
+ {
+ throw new IllegalStateException("Error santizing Header name " + name, e);
+ }
+ }
+ return sanitizedName;
+ }
+
+ public String getSanitizedValue()
+ {
+ if (sanitizedValue == null && value != null)
+ {
+ try
+ {
+ sanitizedValue = sanitize(value);
+ }
+ catch (IOException e)
+ {
+ throw new IllegalStateException("Error santizing Header " + name + " value " + value, e);
+ }
+ }
+ return sanitizedValue;
+ }
+
+ /**
+ * Remove any line feed/new line characters
+ * @throws IOException
+ */
+ public static String sanitize(String value) throws IOException
+ {
+ BufferedReader reader = new BufferedReader(new StringReader(value));
+ return reader.readLine();
+ }
+
+}
Property changes on: trunk/src/mail/org/jboss/seam/mail/ui/Header.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/mail/org/jboss/seam/mail/ui/UIAttachment.java
===================================================================
--- trunk/src/mail/org/jboss/seam/mail/ui/UIAttachment.java 2008-06-04 15:55:09 UTC (rev 8328)
+++ trunk/src/mail/org/jboss/seam/mail/ui/UIAttachment.java 2008-06-04 22:53:43 UTC (rev 8329)
@@ -163,10 +163,10 @@
MimeBodyPart attachment = new MimeBodyPart();
// Need to manually set the contentid
String contentId = RandomStringUtils.randomAlphabetic(20).toLowerCase();
- attachment.setContentID("<" + contentId + ">");
+ attachment.setContentID(new Header("<" + contentId + ">").getSanitizedValue());
attachment.setDataHandler(new DataHandler(ds));
- attachment.setFileName(getName(ds.getName()));
- attachment.setDisposition(getDisposition());
+ attachment.setFileName(new Header(getName(ds.getName())).getSanitizedValue());
+ attachment.setDisposition(new Header(getDisposition()).getSanitizedValue());
findMessage().getAttachments().add(attachment);
if (getStatus() != null)
{
Modified: trunk/src/mail/org/jboss/seam/mail/ui/UIBody.java
===================================================================
--- trunk/src/mail/org/jboss/seam/mail/ui/UIBody.java 2008-06-04 15:55:09 UTC (rev 8328)
+++ trunk/src/mail/org/jboss/seam/mail/ui/UIBody.java 2008-06-04 22:53:43 UTC (rev 8329)
@@ -100,13 +100,13 @@
throws MessagingException
{
MimeBodyPart bodyPart = new MimeBodyPart();
- bodyPart.setDisposition("inline");
+ bodyPart.setDisposition(new Header("inline").getSanitizedValue());
String charset = findMessage().getCharset();
if ( charset != null)
{
//bodyPart.setContent(body, "text/plain; charset="
// + charset + "; format=flowed");
- bodyPart.setText(body, charset);
+ bodyPart.setText(body, new Header(charset).getSanitizedValue());
}
else
{
@@ -119,16 +119,16 @@
throws MessagingException
{
MimeBodyPart bodyPart = new MimeBodyPart();
- bodyPart.setDisposition("inline");
+ bodyPart.setDisposition(new Header("inline").getSanitizedValue());
String charset = findMessage().getCharset();
if ( charset != null)
{
- bodyPart.setContent(body, "text/html; charset="
- + charset);
+ bodyPart.setContent(body, new Header("text/html; charset="
+ + charset).getSanitizedValue());
}
else
{
- bodyPart.setContent(body, "text/html");
+ bodyPart.setContent(body, new Header("text/html").getSanitizedValue());
}
return bodyPart;
Modified: trunk/src/mail/org/jboss/seam/mail/ui/UIHeader.java
===================================================================
--- trunk/src/mail/org/jboss/seam/mail/ui/UIHeader.java 2008-06-04 15:55:09 UTC (rev 8328)
+++ trunk/src/mail/org/jboss/seam/mail/ui/UIHeader.java 2008-06-04 22:53:43 UTC (rev 8329)
@@ -19,11 +19,13 @@
{
if (getValue() != null)
{
- findMimeMessage().addHeader(getName(), getValue());
+ Header header = new Header(getName(), getValue());
+ findMimeMessage().addHeader(header.getSanitizedName(), header.getSanitizedValue());
}
else
{
- findMimeMessage().addHeader(getName(), encode(facesContext));
+ Header header = new Header(getName(), encode(facesContext));
+ findMimeMessage().addHeader(header.getSanitizedName(), header.getSanitizedValue());
}
}
catch (MessagingException e)
Modified: trunk/src/mail/org/jboss/seam/mail/ui/UIMessage.java
===================================================================
--- trunk/src/mail/org/jboss/seam/mail/ui/UIMessage.java 2008-06-04 15:55:09 UTC (rev 8328)
+++ trunk/src/mail/org/jboss/seam/mail/ui/UIMessage.java 2008-06-04 22:53:43 UTC (rev 8329)
@@ -133,7 +133,8 @@
}
if (getPrecedence() != null)
{
- getMimeMessage().addHeader("Precedence", getPrecedence());
+ Header header = new Header("Precedence", getPrecedence());
+ getMimeMessage().addHeader(header.getSanitizedName(), header.getSanitizedValue());
}
}
catch (MessagingException e)
@@ -156,8 +157,9 @@
if (isRequestReadReceipt() && getMimeMessage().getFrom() != null
&& getMimeMessage().getFrom().length == 1)
{
- getMimeMessage().addHeader("Disposition-Notification-To",
- getMimeMessage().getFrom()[0].toString());
+ Header header = new Header("Disposition-Notification-To",
+ getMimeMessage().getFrom()[0].toString());
+ getMimeMessage().addHeader(header.getSanitizedName(), header.getSanitizedValue());
}
// Do the send manually, Transport.send gets the wrong transport
getMimeMessage().saveChanges();
Modified: trunk/src/mail/org/jboss/seam/mail/ui/UISubject.java
===================================================================
--- trunk/src/mail/org/jboss/seam/mail/ui/UISubject.java 2008-06-04 15:55:09 UTC (rev 8328)
+++ trunk/src/mail/org/jboss/seam/mail/ui/UISubject.java 2008-06-04 22:53:43 UTC (rev 8329)
@@ -22,11 +22,11 @@
String charset = findMessage().getCharset();
if (charset == null)
{
- findMimeMessage().setSubject(subject);
+ findMimeMessage().setSubject(new Header(subject).getSanitizedValue());
}
else
{
- findMimeMessage().setSubject(subject, charset);
+ findMimeMessage().setSubject(new Header(subject).getSanitizedValue(), charset);
}
}
catch (MessagingException e)
Added: trunk/src/test/mail/unit/org/jboss/seam/test/mail/unit/HeaderTest.java
===================================================================
--- trunk/src/test/mail/unit/org/jboss/seam/test/mail/unit/HeaderTest.java (rev 0)
+++ trunk/src/test/mail/unit/org/jboss/seam/test/mail/unit/HeaderTest.java 2008-06-04 22:53:43 UTC (rev 8329)
@@ -0,0 +1,64 @@
+package org.jboss.seam.test.mail.unit;
+
+import org.jboss.seam.mail.ui.Header;
+import org.testng.annotations.Test;
+
+public class HeaderTest
+{
+ @Test
+ public void testHeader()
+ {
+ String name = "foo";
+ String value = "bar";
+
+ Header header = new Header(name, value);
+
+ assert header.getSanitizedName().equals(name);
+ assert header.getSanitizedValue().equals(value);
+ }
+
+ @Test
+ public void testHeaderWithLineFeed()
+ {
+ String name = "foo\nnewline";
+ String value = "bar\nnewline";
+
+ Header header = new Header(name, value);
+
+ assert !header.getSanitizedName().equals(name);
+ assert !header.getSanitizedValue().equals(value);
+
+ assert "foo".equals(header.getSanitizedName());
+ assert "bar".equals(header.getSanitizedValue());
+ }
+
+ @Test
+ public void testHeaderWithCarrigeReturnLineBreak()
+ {
+ String name = "foo\r\nnewline";
+ String value = "bar\r\nnewline";
+
+ Header header = new Header(name, value);
+
+ assert !header.getSanitizedName().equals(name);
+ assert !header.getSanitizedValue().equals(value);
+
+ assert "foo".equals(header.getSanitizedName());
+ assert "bar".equals(header.getSanitizedValue());
+ }
+
+ @Test
+ public void testHeaderWithCarriageReturn()
+ {
+ String name = "foo\rnewline";
+ String value = "bar\rnewline";
+
+ Header header = new Header(name, value);
+
+ assert !header.getSanitizedName().equals(name);
+ assert !header.getSanitizedValue().equals(value);
+
+ assert "foo".equals(header.getSanitizedName());
+ assert "bar".equals(header.getSanitizedValue());
+ }
+}
Property changes on: trunk/src/test/mail/unit/org/jboss/seam/test/mail/unit/HeaderTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/mail/unit/org/jboss/seam/test/mail/unit/testng.xml
===================================================================
--- trunk/src/test/mail/unit/org/jboss/seam/test/mail/unit/testng.xml (rev 0)
+++ trunk/src/test/mail/unit/org/jboss/seam/test/mail/unit/testng.xml 2008-06-04 22:53:43 UTC (rev 8329)
@@ -0,0 +1,9 @@
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+
+<suite name="Seam Mail Unit Testsuite" verbose="2" parallel="false">
+ <test name="Seam Unit Tests: Mail">
+ <classes>
+ <class name="org.jboss.seam.test.mail.unit.HeaderTest"/>
+ </classes>
+ </test>
+</suite>
Property changes on: trunk/src/test/mail/unit/org/jboss/seam/test/mail/unit/testng.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 6 months
Seam SVN: r8328 - branches/Seam_2_0/examples/jpa/view.
by seam-commits@lists.jboss.org
Author: stan.silvert(a)jboss.com
Date: 2008-06-04 11:55:09 -0400 (Wed, 04 Jun 2008)
New Revision: 8328
Modified:
branches/Seam_2_0/examples/jpa/view/book.xhtml
branches/Seam_2_0/examples/jpa/view/confirm.xhtml
branches/Seam_2_0/examples/jpa/view/conversations.xhtml
branches/Seam_2_0/examples/jpa/view/home.xhtml
branches/Seam_2_0/examples/jpa/view/hotel.xhtml
branches/Seam_2_0/examples/jpa/view/main.xhtml
branches/Seam_2_0/examples/jpa/view/password.xhtml
branches/Seam_2_0/examples/jpa/view/register.xhtml
Log:
JBSEAM-3048
Modified: branches/Seam_2_0/examples/jpa/view/book.xhtml
===================================================================
--- branches/Seam_2_0/examples/jpa/view/book.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
+++ branches/Seam_2_0/examples/jpa/view/book.xhtml 2008-06-04 15:55:09 UTC (rev 8328)
@@ -46,19 +46,19 @@
</div>
</div>
- <s:validateAll>
+ <s:validateAll id="validateAll">
- <f:facet name="aroundInvalidField">
- <s:span styleClass="errors"/>
+ <f:facet id="AroundInvalidFieldFacet" name="aroundInvalidField">
+ <s:span id="ErrorsSpan" styleClass="errors"/>
</f:facet>
- <f:facet name="afterInvalidField">
- <s:div styleClass="errors">
- <s:message/>
+ <f:facet id="AfterInvalidFieldFacet" name="afterInvalidField">
+ <s:div id="ErrosDiv" styleClass="errors">
+ <s:message id="message"/>
</s:div>
</f:facet>
<div class="entry">
- <div class="label"><h:outputLabel for="checkinDate">Check In Date:</h:outputLabel></div>
+ <div class="label"><h:outputLabel id="CheckinDateLabel" for="checkinDate">Check In Date:</h:outputLabel></div>
<div class="input">
<s:decorate id="checkinDateDecorate">
<rich:calendar id="checkinDate" value="#{booking.checkinDate}" required="true" datePattern="MM/dd/yyyy" event="onblur" reRender="checkinDateDecorate" style="width: auto;"/>
@@ -67,7 +67,7 @@
</div>
<div class="entry">
- <div class="label"><h:outputLabel for="checkoutDate">Check Out Date:</h:outputLabel></div>
+ <div class="label"><h:outputLabel id="CheckoutDateLabel" for="checkoutDate">Check Out Date:</h:outputLabel></div>
<div class="input">
<s:decorate id="checkoutDateDecorate">
<rich:calendar id="checkoutDate" value="#{booking.checkoutDate}" required="true" datePattern="MM/dd/yyyy" event="onblur" reRender="checkoutDateDecorate" style="width: auto;"/>
@@ -75,47 +75,47 @@
</div>
</div>
<div class="entry">
- <div class="label"><h:outputLabel for="beds">Room Preference:</h:outputLabel></div>
+ <div class="label"><h:outputLabel id="RoomPrefLabel" for="beds">Room Preference:</h:outputLabel></div>
<div class="input">
- <s:decorate>
+ <s:decorate id="BookingBedsDecorate">
<h:selectOneMenu id="beds" value="#{booking.beds}">
- <f:selectItem itemLabel="One king-size bed" itemValue="1"/>
- <f:selectItem itemLabel="Two double beds" itemValue="2"/>
- <f:selectItem itemLabel="Three beds" itemValue="3"/>
+ <f:selectItem id="OneKingBed" itemLabel="One king-size bed" itemValue="1"/>
+ <f:selectItem id="TwoDoubleBeds" itemLabel="Two double beds" itemValue="2"/>
+ <f:selectItem id="ThreeBeds" itemLabel="Three beds" itemValue="3"/>
</h:selectOneMenu>
</s:decorate>
</div>
</div>
<div class="entry">
- <div class="label"><h:outputLabel for="smoking">Smoking Preference:</h:outputLabel></div>
+ <div class="label"><h:outputLabel id="SmokingPrefLabel" for="smoking">Smoking Preference:</h:outputLabel></div>
<div id="radio" class="input">
- <s:decorate>
+ <s:decorate id="SmokingDecorate">
<h:selectOneRadio id="smoking" value="#{booking.smoking}" layout="pageDirection">
- <f:selectItem itemLabel="Smoking" itemValue="true"/>
- <f:selectItem itemLabel="Non Smoking" itemValue="false"/>
+ <f:selectItem id="Smoking" itemLabel="Smoking" itemValue="true"/>
+ <f:selectItem id="NonSmoking" itemLabel="Non Smoking" itemValue="false"/>
</h:selectOneRadio>
</s:decorate>
</div>
</div>
<div class="entry">
- <div class="label"><h:outputLabel for="creditCard">Credit Card #:</h:outputLabel></div>
+ <div class="label"><h:outputLabel id="CreditCardLabel" for="creditCard">Credit Card #:</h:outputLabel></div>
<div class="input">
<s:decorate id="creditCardDecorate">
<h:inputText id="creditCard" value="#{booking.creditCard}" required="true">
- <a:support event="onblur" reRender="creditCardDecorate"/>
+ <a:support id="onblur" event="onblur" reRender="creditCardDecorate"/>
</h:inputText>
</s:decorate>
</div>
</div>
<div class="entry">
- <div class="label"><h:outputLabel for="creditCardName">Credit Card Name:</h:outputLabel></div>
+ <div class="label"><h:outputLabel id="CreditCardNameLabel" for="creditCardName">Credit Card Name:</h:outputLabel></div>
<div class="input">
<s:decorate id="creditCardNameDecorate">
<h:inputText id="creditCardName" value="#{booking.creditCardName}" required="true">
- <a:support event="onblur" reRender="creditCardNameDecorate"/>
+ <a:support id="onblur" event="onblur" reRender="creditCardNameDecorate"/>
</h:inputText>
</s:decorate>
</div>
@@ -124,27 +124,27 @@
<div class="entry">
<div class="label"><h:outputLabel for="creditCardExpiryMonth">Credit Card Expiry:</h:outputLabel></div>
<div class="input">
- <s:decorate>
+ <s:decorate id="CreditCardExpiryDecorate">
<h:selectOneMenu id="creditCardExpiryMonth" value="#{booking.creditCardExpiryMonth}">
- <f:selectItem itemLabel="Jan" itemValue="1"/>
- <f:selectItem itemLabel="Feb" itemValue="2"/>
- <f:selectItem itemLabel="Mar" itemValue="3"/>
- <f:selectItem itemLabel="Apr" itemValue="4"/>
- <f:selectItem itemLabel="May" itemValue="5"/>
- <f:selectItem itemLabel="Jun" itemValue="6"/>
- <f:selectItem itemLabel="Jul" itemValue="7"/>
- <f:selectItem itemLabel="Aug" itemValue="8"/>
- <f:selectItem itemLabel="Sep" itemValue="9"/>
- <f:selectItem itemLabel="Oct" itemValue="10"/>
- <f:selectItem itemLabel="Nov" itemValue="11"/>
- <f:selectItem itemLabel="Dec" itemValue="12"/>
+ <f:selectItem id="Jan" itemLabel="Jan" itemValue="1"/>
+ <f:selectItem id="Feb" itemLabel="Feb" itemValue="2"/>
+ <f:selectItem id="Mar" itemLabel="Mar" itemValue="3"/>
+ <f:selectItem id="Apr" itemLabel="Apr" itemValue="4"/>
+ <f:selectItem id="May" itemLabel="May" itemValue="5"/>
+ <f:selectItem id="Jun" itemLabel="Jun" itemValue="6"/>
+ <f:selectItem id="Jul" itemLabel="Jul" itemValue="7"/>
+ <f:selectItem id="Aug" itemLabel="Aug" itemValue="8"/>
+ <f:selectItem id="Sep" itemLabel="Sep" itemValue="9"/>
+ <f:selectItem id="Oct" itemLabel="Oct" itemValue="10"/>
+ <f:selectItem id="Nov" itemLabel="Nov" itemValue="11"/>
+ <f:selectItem id="Dec" itemLabel="Dec" itemValue="12"/>
</h:selectOneMenu>
<h:selectOneMenu id="creditCardExpiryYear" value="#{booking.creditCardExpiryYear}">
- <f:selectItem itemLabel="2005" itemValue="2005"/>
- <f:selectItem itemLabel="2006" itemValue="2006"/>
- <f:selectItem itemLabel="2007" itemValue="2007"/>
- <f:selectItem itemLabel="2008" itemValue="2008"/>
- <f:selectItem itemLabel="2009" itemValue="2009"/>
+ <f:selectItem id="Year2005" itemLabel="2005" itemValue="2005"/>
+ <f:selectItem id="Year2006" itemLabel="2006" itemValue="2006"/>
+ <f:selectItem id="Year2007" itemLabel="2007" itemValue="2007"/>
+ <f:selectItem id="Year2008" itemLabel="2008" itemValue="2008"/>
+ <f:selectItem id="Year2009" itemLabel="2009" itemValue="2009"/>
</h:selectOneMenu>
</s:decorate>
</div>
@@ -153,7 +153,7 @@
</s:validateAll>
<div class="entry errors">
- <h:messages globalOnly="true"/>
+ <h:messages id="messages" globalOnly="true"/>
</div>
<div class="entry">
Modified: branches/Seam_2_0/examples/jpa/view/confirm.xhtml
===================================================================
--- branches/Seam_2_0/examples/jpa/view/confirm.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
+++ branches/Seam_2_0/examples/jpa/view/confirm.xhtml 2008-06-04 15:55:09 UTC (rev 8328)
@@ -37,7 +37,7 @@
<div class="entry">
<div class="label">Total payment:</div>
<div class="output">
- <h:outputText value="#{booking.total}">
+ <h:outputText id="BookingTotal" value="#{booking.total}">
<f:convertNumber type="currency"
currencySymbol="$"/>
</h:outputText>
@@ -45,11 +45,11 @@
</div>
<div class="entry">
<div class="label">Check In Date:</div>
- <div class="output"><h:outputText value="#{booking.checkinDate}"/></div>
+ <div class="output"><h:outputText id="BookingCheckinDate" value="#{booking.checkinDate}"/></div>
</div>
<div class="entry">
<div class="label">Check Out Date:</div>
- <div class="output"><h:outputText value="#{booking.checkoutDate}"/></div>
+ <div class="output"><h:outputText id="BookingCheckoutDate" value="#{booking.checkoutDate}"/></div>
</div>
<div class="entry">
<div class="label">Credit Card #:</div>
Modified: branches/Seam_2_0/examples/jpa/view/conversations.xhtml
===================================================================
--- branches/Seam_2_0/examples/jpa/view/conversations.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
+++ branches/Seam_2_0/examples/jpa/view/conversations.xhtml 2008-06-04 15:55:09 UTC (rev 8328)
@@ -8,23 +8,23 @@
<div>
<div class="section">
- <h1><h:outputText rendered="#{not empty conversationList}" value="Workspaces"/></h1>
+ <h1><h:outputText id="Workspaces" rendered="#{not empty conversationList}" value="Workspaces"/></h1>
</div>
<div class="section">
- <h:form>
- <h:dataTable value="#{conversationList}" var="entry">
- <h:column>
- <h:commandLink action="#{entry.select}" value="#{entry.description}"/>
+ <h:form id="Conversations">
+ <h:dataTable id="ConversationList" value="#{conversationList}" var="entry">
+ <h:column id="column1">
+ <h:commandLink id="EntryDescriptionLink" action="#{entry.select}" value="#{entry.description}"/>
 
- <h:outputText value="[current]" rendered="#{entry.current}"/>
+ <h:outputText id="EntryCurrent" value="[current]" rendered="#{entry.current}"/>
</h:column>
- <h:column>
- <h:outputText value="#{entry.startDatetime}">
+ <h:column id="column2">
+ <h:outputText id="EntryStartDateTime" value="#{entry.startDatetime}">
<s:convertDateTime type="time" pattern="hh:mm"/>
</h:outputText>
-
- <h:outputText value="#{entry.lastDatetime}">
+ <h:outputText id="EntryLastDateTime" value="#{entry.lastDatetime}">
<s:convertDateTime type="time" pattern="hh:mm"/>
</h:outputText>
</h:column>
Modified: branches/Seam_2_0/examples/jpa/view/home.xhtml
===================================================================
--- branches/Seam_2_0/examples/jpa/view/home.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
+++ branches/Seam_2_0/examples/jpa/view/home.xhtml 2008-06-04 15:55:09 UTC (rev 8328)
@@ -20,15 +20,15 @@
<h:form id="login">
<fieldset>
<div>
- <h:outputLabel for="username">Login Name</h:outputLabel>
+ <h:outputLabel id="UsernameLabel" for="username">Login Name</h:outputLabel>
<h:inputText id="username" value="#{identity.username}" style="width: 175px;"/>
- <div class="errors"><h:message for="username"/></div>
+ <div class="errors"><h:message id="message" for="username"/></div>
</div>
<div>
- <h:outputLabel for="password">Password</h:outputLabel>
+ <h:outputLabel id="PasswordLabel" for="password">Password</h:outputLabel>
<h:inputSecret id="password" value="#{identity.password}" style="width: 175px;"/>
</div>
- <div class="errors"><h:messages globalOnly="true"/></div>
+ <div class="errors"><h:messages id="messages" globalOnly="true"/></div>
<div class="buttonBox"><h:commandButton id="login" action="#{identity.login}" value="Account Login"/></div>
<div class="notes"><s:link id="register" view="/register.xhtml" value="Register New User"/></div>
</fieldset>
Modified: branches/Seam_2_0/examples/jpa/view/hotel.xhtml
===================================================================
--- branches/Seam_2_0/examples/jpa/view/hotel.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
+++ branches/Seam_2_0/examples/jpa/view/hotel.xhtml 2008-06-04 15:55:09 UTC (rev 8328)
@@ -39,7 +39,7 @@
<div class="entry">
<div class="label">Nightly rate:</div>
<div class="output">
- <h:outputText value="#{hotel.price}">
+ <h:outputText id="HotelPrice" value="#{hotel.price}">
<f:convertNumber type="currency"
currencySymbol="$"/>
</h:outputText>
Modified: branches/Seam_2_0/examples/jpa/view/main.xhtml
===================================================================
--- branches/Seam_2_0/examples/jpa/view/main.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
+++ branches/Seam_2_0/examples/jpa/view/main.xhtml 2008-06-04 15:55:09 UTC (rev 8328)
@@ -14,28 +14,28 @@
<h:form id="main">
<span class="errors">
- <h:messages globalOnly="true"/>
+ <h:messages id="messages" globalOnly="true"/>
</span>
<h1>Search Hotels</h1>
<fieldset>
<h:inputText id="searchString" value="#{hotelSearch.searchString}" style="width: 165px;">
- <a:support event="onkeyup" actionListener="#{hotelSearch.find}" reRender="searchResults" />
+ <a:support id="onkeyup" event="onkeyup" actionListener="#{hotelSearch.find}" reRender="searchResults" />
</h:inputText>
 
<a:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}" reRender="searchResults"/>
 
- <a:status>
- <f:facet name="start">
- <h:graphicImage value="/img/spinner.gif"/>
+ <a:status id="status">
+ <f:facet id="StartFacet" name="start">
+ <h:graphicImage id="SpinnerGif" value="/img/spinner.gif"/>
</f:facet>
</a:status>
<br/>
- <h:outputLabel for="pageSize">Maximum results:</h:outputLabel> 
- <h:selectOneMenu value="#{hotelSearch.pageSize}" id="pageSize">
- <f:selectItem itemLabel="5" itemValue="5"/>
- <f:selectItem itemLabel="10" itemValue="10"/>
- <f:selectItem itemLabel="20" itemValue="20"/>
+ <h:outputLabel id="MaximumResultsLabel" for="pageSize">Maximum results:</h:outputLabel> 
+ <h:selectOneMenu id="pageSize" value="#{hotelSearch.pageSize}">
+ <f:selectItem id="PageSize5" itemLabel="5" itemValue="5"/>
+ <f:selectItem id="PageSize10" itemLabel="10" itemValue="10"/>
+ <f:selectItem id="PageSize20" itemLabel="20" itemValue="20"/>
</h:selectOneMenu>
</fieldset>
@@ -44,30 +44,30 @@
<a:outputPanel id="searchResults">
<div class="section">
- <h:outputText value="No Hotels Found" rendered="#{hotels != null and hotels.rowCount==0}"/>
+ <h:outputText id="NoHotelsFoundMessage" value="No Hotels Found" rendered="#{hotels != null and hotels.rowCount==0}"/>
<h:dataTable id="hotels" value="#{hotels}" var="hot" rendered="#{hotels.rowCount>0}">
- <h:column>
- <f:facet name="header">Name</f:facet>
+ <h:column id="column1">
+ <f:facet id="NameFacet" name="header">Name</f:facet>
#{hot.name}
</h:column>
- <h:column>
- <f:facet name="header">Address</f:facet>
+ <h:column id="column2">
+ <f:facet id="AddressFacet" name="header">Address</f:facet>
#{hot.address}
</h:column>
- <h:column>
- <f:facet name="header">City, State</f:facet>
+ <h:column id="column3">
+ <f:facet id="CityStateFacet" name="header">City, State</f:facet>
#{hot.city}, #{hot.state}, #{hot.country}
</h:column>
- <h:column>
- <f:facet name="header">Zip</f:facet>
+ <h:column id="column4">
+ <f:facet id="ZipFacet" name="header">Zip</f:facet>
#{hot.zip}
</h:column>
- <h:column>
- <f:facet name="header">Action</f:facet>
+ <h:column id="column5">
+ <f:facet id="ActionFacet" name="header">Action</f:facet>
<s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>
</h:column>
</h:dataTable>
- <s:link value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}"/>
+ <s:link id="MoreResultsLink" value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}"/>
</div>
</a:outputPanel>
@@ -76,34 +76,34 @@
</div>
<div class="section">
<h:form id="bookings">
- <h:outputText value="No Bookings Found" rendered="#{bookings.rowCount==0}"/>
+ <h:outputText id="NoBookingsFoundMessage" value="No Bookings Found" rendered="#{bookings.rowCount==0}"/>
<h:dataTable id="bookings" value="#{bookings}" var="book" rendered="#{bookings.rowCount>0}">
- <h:column>
- <f:facet name="header">Name</f:facet>
+ <h:column id="column1">
+ <f:facet id="NameFacet" name="header">Name</f:facet>
#{book.hotel.name}
</h:column>
- <h:column>
- <f:facet name="header">Address</f:facet>
+ <h:column id="column2">
+ <f:facet id="AddressFacet" name="header">Address</f:facet>
#{book.hotel.address}
</h:column>
- <h:column>
- <f:facet name="header">City, State</f:facet>
+ <h:column id="column3">
+ <f:facet id="CityStateFacet" name="header">City, State</f:facet>
#{book.hotel.city}, #{book.hotel.state}
</h:column>
- <h:column>
- <f:facet name="header">Check in date</f:facet>
- <h:outputText value="#{book.checkinDate}"/>
+ <h:column id="column4">
+ <f:facet id="CheckinDateFacet" name="header">Check in date</f:facet>
+ <h:outputText id="BookingCheckinDate" value="#{book.checkinDate}"/>
</h:column>
- <h:column>
- <f:facet name="header">Check out date</f:facet>
- <h:outputText value="#{book.checkoutDate}"/>
+ <h:column id="column5">
+ <f:facet id="CheckoutDateFacet" name="header">Check out date</f:facet>
+ <h:outputText id="BookingCheckoutDate" value="#{book.checkoutDate}"/>
</h:column>
- <h:column>
- <f:facet name="header">Confirmation number</f:facet>
+ <h:column id="column6">
+ <f:facet id="ConfNumberFacet" name="header">Confirmation number</f:facet>
#{book.id}
</h:column>
- <h:column>
- <f:facet name="header">Action</f:facet>
+ <h:column id="column7">
+ <f:facet id="ActionFacet" name="header">Action</f:facet>
<h:commandLink id="cancel" value="Cancel" action="#{bookingList.cancel}"/>
</h:column>
</h:dataTable>
Modified: branches/Seam_2_0/examples/jpa/view/password.xhtml
===================================================================
--- branches/Seam_2_0/examples/jpa/view/password.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
+++ branches/Seam_2_0/examples/jpa/view/password.xhtml 2008-06-04 15:55:09 UTC (rev 8328)
@@ -14,21 +14,21 @@
<div class="section">
<h:form id="setpassword">
- <f:facet name="aroundInvalidField">
- <s:span styleClass="errors"/>
+ <f:facet id="AroundInvalidFieldFacet" name="aroundInvalidField">
+ <s:span id="ErrorsSpan" styleClass="errors"/>
</f:facet>
- <f:facet name="afterInvalidField">
+ <f:facet id="AfterInvalidFieldFacet" name="afterInvalidField">
<s:div styleClass="errors">
- <s:message/>
+ <s:message id="message"/>
</s:div>
</f:facet>
<fieldset>
<div class="entry">
- <div class="label"><h:outputLabel for="password">Password:</h:outputLabel></div>
+ <div class="label"><h:outputLabel id="PasswordLabel" for="password">Password:</h:outputLabel></div>
<div class="input">
- <s:decorate>
+ <s:decorate id="DecoratePassword">
<h:inputSecret id="password" value="#{user.password}" required="true">
<s:validate/>
</h:inputSecret>
@@ -37,16 +37,16 @@
</div>
<div class="entry">
- <div class="label"><h:outputLabel for="verify">Verify:</h:outputLabel></div>
+ <div class="label"><h:outputLabel id="VerifyLabel" for="verify">Verify:</h:outputLabel></div>
<div class="input">
- <s:decorate>
+ <s:decorate id="DecoratePasswordVerify">
<h:inputSecret id="verify" value="#{changePassword.verify}" required="true"/>
</s:decorate>
</div>
</div>
<div class="entry errors">
- <h:messages globalOnly="true"/>
+ <h:messages id="messages" globalOnly="true"/>
</div>
<div class="entry">
Modified: branches/Seam_2_0/examples/jpa/view/register.xhtml
===================================================================
--- branches/Seam_2_0/examples/jpa/view/register.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
+++ branches/Seam_2_0/examples/jpa/view/register.xhtml 2008-06-04 15:55:09 UTC (rev 8328)
@@ -27,43 +27,43 @@
<h:form id="register">
<fieldset>
- <s:validateAll>
+ <s:validateAll id="ValidateAll">
- <f:facet name="aroundInvalidField">
- <s:span styleClass="errors"/>
+ <f:facet id="AroundInvalidFieldFacet" name="aroundInvalidField">
+ <s:span id="ErrorsSpan" styleClass="errors"/>
</f:facet>
- <f:facet name="afterInvalidField">
- <s:div styleClass="errors">
- <s:message/>
+ <f:facet id="AfterInvalidFieldFacet" name="afterInvalidField">
+ <s:div id="ErrorsDiv" styleClass="errors">
+ <s:message id="message"/>
</s:div>
</f:facet>
<div class="entry">
- <div class="label"><h:outputLabel for="username">Username:</h:outputLabel></div>
+ <div class="label"><h:outputLabel id="UsernameLabel" for="username">Username:</h:outputLabel></div>
<div class="input">
<s:decorate id="usernameDecorate">
<h:inputText id="username" value="#{user.username}" required="true">
- <a:support event="onblur" reRender="usernameDecorate"/>
+ <a:support id="onblur" event="onblur" reRender="usernameDecorate"/>
</h:inputText>
</s:decorate>
</div>
</div>
<div class="entry">
- <div class="label"><h:outputLabel for="name">Real Name:</h:outputLabel></div>
+ <div class="label"><h:outputLabel id="RealNameLabel" for="name">Real Name:</h:outputLabel></div>
<div class="input">
<s:decorate id="nameDecorate">
<h:inputText id="name" value="#{user.name}" required="true">
- <a:support event="onblur" reRender="nameDecorate"/>
+ <a:support id="onblur" event="onblur" reRender="nameDecorate"/>
</h:inputText>
</s:decorate>
</div>
</div>
<div class="entry">
- <div class="label"><h:outputLabel for="password">Password:</h:outputLabel></div>
+ <div class="label"><h:outputLabel id="PasswordLabel" for="password">Password:</h:outputLabel></div>
<div class="input">
- <s:decorate>
+ <s:decorate id="passwordDecorate">
<h:inputSecret id="password" value="#{user.password}" required="true"/>
</s:decorate>
</div>
@@ -72,7 +72,7 @@
<div class="entry">
<div class="label"><h:outputLabel for="verify">Verify Password:</h:outputLabel></div>
<div class="input">
- <s:decorate>
+ <s:decorate id="verifyDecorate">
<h:inputSecret id="verify" value="#{register.verify}" required="true"/>
</s:decorate>
</div>
@@ -81,7 +81,7 @@
</s:validateAll>
<div class="entry errors">
- <h:messages globalOnly="true"/>
+ <h:messages id="messages" globalOnly="true"/>
</div>
<div class="entry">
16 years, 6 months
Seam SVN: r8327 - branches/Seam_2_0/examples/booking/view.
by seam-commits@lists.jboss.org
Author: stan.silvert(a)jboss.com
Date: 2008-06-04 10:47:55 -0400 (Wed, 04 Jun 2008)
New Revision: 8327
Modified:
branches/Seam_2_0/examples/booking/view/book.xhtml
branches/Seam_2_0/examples/booking/view/confirm.xhtml
branches/Seam_2_0/examples/booking/view/conversations.xhtml
branches/Seam_2_0/examples/booking/view/edit.xhtml
branches/Seam_2_0/examples/booking/view/home.xhtml
branches/Seam_2_0/examples/booking/view/hotelview.xhtml
branches/Seam_2_0/examples/booking/view/main.xhtml
branches/Seam_2_0/examples/booking/view/password.xhtml
branches/Seam_2_0/examples/booking/view/register.xhtml
Log:
JBSEAM-3048
Modified: branches/Seam_2_0/examples/booking/view/book.xhtml
===================================================================
--- branches/Seam_2_0/examples/booking/view/book.xhtml 2008-06-04 14:36:51 UTC (rev 8326)
+++ branches/Seam_2_0/examples/booking/view/book.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
@@ -15,7 +15,7 @@
</div>
<div class="section">
<div class="entry errors">
- <h:messages globalOnly="true"/>
+ <h:messages id="messages" globalOnly="true"/>
</div>
<ui:include src="hotelview.xhtml"/>
@@ -38,56 +38,56 @@
<s:decorate id="bedsDecorate" template="edit.xhtml">
<ui:define name="label">Room Preference:</ui:define>
<h:selectOneMenu id="beds" value="#{booking.beds}">
- <f:selectItem itemLabel="One king-size bed" itemValue="1"/>
- <f:selectItem itemLabel="Two double beds" itemValue="2"/>
- <f:selectItem itemLabel="Three beds" itemValue="3"/>
+ <f:selectItem id="OneKingBed" itemLabel="One king-size bed" itemValue="1"/>
+ <f:selectItem id="TwoDoubleBeds" itemLabel="Two double beds" itemValue="2"/>
+ <f:selectItem id="ThreeBeds" itemLabel="Three beds" itemValue="3"/>
</h:selectOneMenu>
</s:decorate>
<s:decorate id="smokingDecorate" template="edit.xhtml">
<ui:define name="label">Smoking Preference:</ui:define>
<h:selectOneRadio id="smoking" value="#{booking.smoking}" layout="pageDirection" styleClass="radio">
- <f:selectItem itemLabel="Smoking" itemValue="true"/>
- <f:selectItem itemLabel="Non Smoking" itemValue="false"/>
+ <f:selectItem id="Smoking" itemLabel="Smoking" itemValue="true"/>
+ <f:selectItem id="NonSmoking" itemLabel="Non Smoking" itemValue="false"/>
</h:selectOneRadio>
</s:decorate>
<s:decorate id="creditCardDecorate" template="edit.xhtml">
<ui:define name="label">Credit Card #:</ui:define>
<h:inputText id="creditCard" value="#{booking.creditCard}" required="true">
- <a:support event="onblur" reRender="creditCardDecorate"/>
+ <a:support id="onblur" event="onblur" reRender="creditCardDecorate"/>
</h:inputText>
</s:decorate>
<s:decorate id="creditCardNameDecorate" template="edit.xhtml">
<ui:define name="label">Credit Card Name:</ui:define>
<h:inputText id="creditCardName" value="#{booking.creditCardName}" required="true">
- <a:support event="onblur" reRender="creditCardNameDecorate"/>
+ <a:support id="onblur" event="onblur" reRender="creditCardNameDecorate"/>
</h:inputText>
</s:decorate>
<s:decorate id="creditCardExpiryDecorate" template="edit.xhtml">
<ui:define name="label">Credit Card Expiry:</ui:define>
<h:selectOneMenu id="creditCardExpiryMonth" value="#{booking.creditCardExpiryMonth}">
- <f:selectItem itemLabel="Jan" itemValue="1"/>
- <f:selectItem itemLabel="Feb" itemValue="2"/>
- <f:selectItem itemLabel="Mar" itemValue="3"/>
- <f:selectItem itemLabel="Apr" itemValue="4"/>
- <f:selectItem itemLabel="May" itemValue="5"/>
- <f:selectItem itemLabel="Jun" itemValue="6"/>
- <f:selectItem itemLabel="Jul" itemValue="7"/>
- <f:selectItem itemLabel="Aug" itemValue="8"/>
- <f:selectItem itemLabel="Sep" itemValue="9"/>
- <f:selectItem itemLabel="Oct" itemValue="10"/>
- <f:selectItem itemLabel="Nov" itemValue="11"/>
- <f:selectItem itemLabel="Dec" itemValue="12"/>
+ <f:selectItem id="Jan" itemLabel="Jan" itemValue="1"/>
+ <f:selectItem id="Feb" itemLabel="Feb" itemValue="2"/>
+ <f:selectItem id="Mar" itemLabel="Mar" itemValue="3"/>
+ <f:selectItem id="Apr" itemLabel="Apr" itemValue="4"/>
+ <f:selectItem id="May" itemLabel="May" itemValue="5"/>
+ <f:selectItem id="Jun" itemLabel="Jun" itemValue="6"/>
+ <f:selectItem id="Jul" itemLabel="Jul" itemValue="7"/>
+ <f:selectItem id="Aug" itemLabel="Aug" itemValue="8"/>
+ <f:selectItem id="Sep" itemLabel="Sep" itemValue="9"/>
+ <f:selectItem id="Oct" itemLabel="Oct" itemValue="10"/>
+ <f:selectItem id="Nov" itemLabel="Nov" itemValue="11"/>
+ <f:selectItem id="Dec" itemLabel="Dec" itemValue="12"/>
</h:selectOneMenu>
<h:selectOneMenu id="creditCardExpiryYear" value="#{booking.creditCardExpiryYear}">
- <f:selectItem itemLabel="2005" itemValue="2005"/>
- <f:selectItem itemLabel="2006" itemValue="2006"/>
- <f:selectItem itemLabel="2007" itemValue="2007"/>
- <f:selectItem itemLabel="2008" itemValue="2008"/>
- <f:selectItem itemLabel="2009" itemValue="2009"/>
+ <f:selectItem id="Year2005" itemLabel="2005" itemValue="2005"/>
+ <f:selectItem id="Year2006" itemLabel="2006" itemValue="2006"/>
+ <f:selectItem id="Year2007" itemLabel="2007" itemValue="2007"/>
+ <f:selectItem id="Year2008" itemLabel="2008" itemValue="2008"/>
+ <f:selectItem id="Year2009" itemLabel="2009" itemValue="2009"/>
</h:selectOneMenu>
</s:decorate>
Modified: branches/Seam_2_0/examples/booking/view/confirm.xhtml
===================================================================
--- branches/Seam_2_0/examples/booking/view/confirm.xhtml 2008-06-04 14:36:51 UTC (rev 8326)
+++ branches/Seam_2_0/examples/booking/view/confirm.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
@@ -17,24 +17,24 @@
<ui:include src="hotelview.xhtml"/>
- <s:decorate template="display.xhtml">
+ <s:decorate id="DecorateTotalPayment" template="display.xhtml">
<ui:define name="label">Total Payment:</ui:define>
- <h:outputText value="#{booking.total}">
+ <h:outputText id="BookingTotal" value="#{booking.total}">
<f:convertNumber type="currency" currencySymbol="$"/>
</h:outputText>
</s:decorate>
- <s:decorate template="display.xhtml">
+ <s:decorate id="DecorateCheckInDate" template="display.xhtml">
<ui:define name="label">Check In Date:</ui:define>
- <h:outputText value="#{booking.checkinDate}"/>
+ <h:outputText id="BookingCheckinDate" value="#{booking.checkinDate}"/>
</s:decorate>
- <s:decorate template="display.xhtml">
+ <s:decorate id="DecorateCheckoutDate" template="display.xhtml">
<ui:define name="label">Check Out Date:</ui:define>
- <h:outputText value="#{booking.checkoutDate}"/>
+ <h:outputText id="BookingCheckoutDate" value="#{booking.checkoutDate}"/>
</s:decorate>
- <s:decorate template="display.xhtml">
+ <s:decorate id="DecorateCreditCard" template="display.xhtml">
<ui:define name="label">Credit Card #:</ui:define>
#{booking.creditCard}
</s:decorate>
Modified: branches/Seam_2_0/examples/booking/view/conversations.xhtml
===================================================================
--- branches/Seam_2_0/examples/booking/view/conversations.xhtml 2008-06-04 14:36:51 UTC (rev 8326)
+++ branches/Seam_2_0/examples/booking/view/conversations.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
@@ -12,19 +12,19 @@
</div>
<div class="section">
- <h:form>
- <h:dataTable value="#{conversationList}" var="entry">
- <h:column>
- <h:commandLink action="#{entry.select}" value="#{entry.description}"/>
+ <h:form id="ConversationListForm">
+ <h:dataTable id="ConversationListDataTable" value="#{conversationList}" var="entry">
+ <h:column id="column1">
+ <h:commandLink id="EntryDescriptionLink" action="#{entry.select}" value="#{entry.description}"/>
 
- <h:outputText value="[current]" rendered="#{entry.current}"/>
+ <h:outputText id="CurrentEntry" value="[current]" rendered="#{entry.current}"/>
</h:column>
- <h:column>
- <h:outputText value="#{entry.startDatetime}">
+ <h:column id="column2">
+ <h:outputText id="EntryStartDateTime" value="#{entry.startDatetime}">
<s:convertDateTime type="time" pattern="hh:mm"/>
</h:outputText>
-
- <h:outputText value="#{entry.lastDatetime}">
+ <h:outputText id="EntryLastDateTime" value="#{entry.lastDatetime}">
<s:convertDateTime type="time" pattern="hh:mm"/>
</h:outputText>
</h:column>
Modified: branches/Seam_2_0/examples/booking/view/edit.xhtml
===================================================================
--- branches/Seam_2_0/examples/booking/view/edit.xhtml 2008-06-04 14:36:51 UTC (rev 8326)
+++ branches/Seam_2_0/examples/booking/view/edit.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
@@ -6,16 +6,16 @@
xmlns:s="http://jboss.com/products/seam/taglib">
<div class="entry">
- <s:label styleClass="label #{invalid?'errors':''}">
+ <s:label id="Label" styleClass="label #{invalid?'errors':''}">
<ui:insert name="label"/>
- <s:span styleClass="required" rendered="#{required}">*</s:span>
+ <s:span id="RequiredStyle" styleClass="required" rendered="#{required}">*</s:span>
</s:label>
<span class="input #{invalid?'errors':''}">
- <s:validateAll>
+ <s:validateAll id="ValidateAll">
<ui:insert/>
</s:validateAll>
</span>
- <s:message styleClass="error errors"/>
+ <s:message id="message" styleClass="error errors"/>
</div>
</ui:composition>
\ No newline at end of file
Modified: branches/Seam_2_0/examples/booking/view/home.xhtml
===================================================================
--- branches/Seam_2_0/examples/booking/view/home.xhtml 2008-06-04 14:36:51 UTC (rev 8326)
+++ branches/Seam_2_0/examples/booking/view/home.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
@@ -20,15 +20,15 @@
<h:form id="login">
<fieldset>
<div>
- <h:outputLabel for="username">Login Name</h:outputLabel>
+ <h:outputLabel id="UsernameLabel" for="username">Login Name</h:outputLabel>
<h:inputText id="username" value="#{identity.username}" style="width: 175px;"/>
- <div class="errors"><h:message for="username"/></div>
+ <div class="errors"><h:message id="UsernameMessage" for="username"/></div>
</div>
<div>
- <h:outputLabel for="password">Password</h:outputLabel>
+ <h:outputLabel id="PasswordLabel" for="password">Password</h:outputLabel>
<h:inputSecret id="password" value="#{identity.password}" style="width: 175px;"/>
</div>
- <div class="errors"><h:messages globalOnly="true"/></div>
+ <div class="errors"><h:messages id="messages" globalOnly="true"/></div>
<div class="buttonBox"><h:commandButton id="login" action="#{identity.login}" value="Account Login"/></div>
<div class="notes"><s:link id="register" view="/register.xhtml" value="Register New User"/></div>
</fieldset>
Modified: branches/Seam_2_0/examples/booking/view/hotelview.xhtml
===================================================================
--- branches/Seam_2_0/examples/booking/view/hotelview.xhtml 2008-06-04 14:36:51 UTC (rev 8326)
+++ branches/Seam_2_0/examples/booking/view/hotelview.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
@@ -5,39 +5,39 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib">
- <s:decorate template="display.xhtml">
+ <s:decorate id="DecorateName" template="display.xhtml">
<ui:define name="label">Name:</ui:define>
#{hotel.name}
</s:decorate>
- <s:decorate template="display.xhtml">
+ <s:decorate id="DecorateAddress" template="display.xhtml">
<ui:define name="label">Address:</ui:define>
#{hotel.address}
</s:decorate>
- <s:decorate template="display.xhtml">
+ <s:decorate id="DecorateCity" template="display.xhtml">
<ui:define name="label">City:</ui:define>
#{hotel.city}
</s:decorate>
- <s:decorate template="display.xhtml">
+ <s:decorate id="DecorateState" template="display.xhtml">
<ui:define name="label">State:</ui:define>
#{hotel.state}
</s:decorate>
- <s:decorate template="display.xhtml">
+ <s:decorate id="DecorateZip" template="display.xhtml">
<ui:define name="label">Zip:</ui:define>
#{hotel.zip}
</s:decorate>
- <s:decorate template="display.xhtml">
+ <s:decorate id="DecorateCountry" template="display.xhtml">
<ui:define name="label">Country:</ui:define>
#{hotel.country}
</s:decorate>
- <s:decorate template="display.xhtml">
+ <s:decorate id="DecorateNightlyRate" template="display.xhtml">
<ui:define name="label">Nightly rate:</ui:define>
- <h:outputText value="#{hotel.name}">
+ <h:outputText id="HotelPrice" value="#{hotel.price}">
<f:convertNumber type="currency" currencySymbol="$"/>
</h:outputText>
</s:decorate>
Modified: branches/Seam_2_0/examples/booking/view/main.xhtml
===================================================================
--- branches/Seam_2_0/examples/booking/view/main.xhtml 2008-06-04 14:36:51 UTC (rev 8326)
+++ branches/Seam_2_0/examples/booking/view/main.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
@@ -13,7 +13,7 @@
<div class="section">
<span class="errors">
- <h:messages globalOnly="true"/>
+ <h:messages id="messages" globalOnly="true"/>
</span>
<h1>Search Hotels</h1>
@@ -21,22 +21,22 @@
<h:form id="searchCriteria">
<fieldset>
<h:inputText id="searchString" value="#{hotelSearch.searchString}" style="width: 165px;">
- <a:support event="onkeyup" actionListener="#{hotelSearch.find}" reRender="searchResults" />
+ <a:support id="onkeyup" event="onkeyup" actionListener="#{hotelSearch.find}" reRender="searchResults" />
</h:inputText>
 
<a:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}" reRender="searchResults"/>
 
- <a:status>
- <f:facet name="start">
- <h:graphicImage value="/img/spinner.gif"/>
+ <a:status id="status">
+ <f:facet id="StartStatus" name="start">
+ <h:graphicImage id="SpinnerGif" value="/img/spinner.gif"/>
</f:facet>
</a:status>
<br/>
- <h:outputLabel for="pageSize">Maximum results:</h:outputLabel> 
- <h:selectOneMenu value="#{hotelSearch.pageSize}" id="pageSize">
- <f:selectItem itemLabel="5" itemValue="5"/>
- <f:selectItem itemLabel="10" itemValue="10"/>
- <f:selectItem itemLabel="20" itemValue="20"/>
+ <h:outputLabel id="MaximumResultsLabel" for="pageSize">Maximum results:</h:outputLabel> 
+ <h:selectOneMenu id="pageSize" value="#{hotelSearch.pageSize}">
+ <f:selectItem id="PageSize5" itemLabel="5" itemValue="5"/>
+ <f:selectItem id="PageSize10" itemLabel="10" itemValue="10"/>
+ <f:selectItem id="PageSize20" itemLabel="20" itemValue="20"/>
</h:selectOneMenu>
</fieldset>
</h:form>
@@ -45,30 +45,30 @@
<a:outputPanel id="searchResults">
<div class="section">
- <h:outputText value="No Hotels Found" rendered="#{hotels != null and hotels.rowCount==0}"/>
+ <h:outputText id="NoHotelsFoundMessage" value="No Hotels Found" rendered="#{hotels != null and hotels.rowCount==0}"/>
<h:dataTable id="hotels" value="#{hotels}" var="hot" rendered="#{hotels.rowCount>0}">
- <h:column>
- <f:facet name="header">Name</f:facet>
+ <h:column id="column1">
+ <f:facet id="NameFacet" name="header">Name</f:facet>
#{hot.name}
</h:column>
- <h:column>
- <f:facet name="header">Address</f:facet>
+ <h:column id="column2">
+ <f:facet id="AddressFacet" name="header">Address</f:facet>
#{hot.address}
</h:column>
- <h:column>
- <f:facet name="header">City, State</f:facet>
+ <h:column id="column3">
+ <f:facet id="CityStateFacet" name="header">City, State</f:facet>
#{hot.city}, #{hot.state}, #{hot.country}
</h:column>
- <h:column>
- <f:facet name="header">Zip</f:facet>
+ <h:column id="column4">
+ <f:facet id="ZipFacet" name="header">Zip</f:facet>
#{hot.zip}
</h:column>
- <h:column>
- <f:facet name="header">Action</f:facet>
+ <h:column id="column5">
+ <f:facet id="ActionFacet" name="header">Action</f:facet>
<s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>
</h:column>
</h:dataTable>
- <s:link value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}"/>
+ <s:link id="MoreResultsLink" value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}"/>
</div>
</a:outputPanel>
@@ -77,34 +77,34 @@
</div>
<div class="section">
<h:form id="bookings">
- <h:outputText value="No Bookings Found" rendered="#{bookings.rowCount==0}"/>
+ <h:outputText id="NoBookingsFoundMessage" value="No Bookings Found" rendered="#{bookings.rowCount==0}"/>
<h:dataTable id="bookings" value="#{bookings}" var="book" rendered="#{bookings.rowCount>0}">
- <h:column>
- <f:facet name="header">Name</f:facet>
+ <h:column id="column1">
+ <f:facet id="NameFacet" name="header">Name</f:facet>
#{book.hotel.name}
</h:column>
- <h:column>
- <f:facet name="header">Address</f:facet>
+ <h:column id="column2">
+ <f:facet id="AddressFacet" name="header">Address</f:facet>
#{book.hotel.address}
</h:column>
- <h:column>
- <f:facet name="header">City, State</f:facet>
+ <h:column id="column3">
+ <f:facet id="CityStateFacet" name="header">City, State</f:facet>
#{book.hotel.city}, #{book.hotel.state}
</h:column>
- <h:column>
- <f:facet name="header">Check in date</f:facet>
- <h:outputText value="#{book.checkinDate}"/>
+ <h:column id="column4">
+ <f:facet id="CheckInDateFacet" name="header">Check in date</f:facet>
+ <h:outputText id="BookingCheckInDate" value="#{book.checkinDate}"/>
</h:column>
- <h:column>
- <f:facet name="header">Check out date</f:facet>
- <h:outputText value="#{book.checkoutDate}"/>
+ <h:column id="column5">
+ <f:facet id="CheckOutDateFacet" name="header">Check out date</f:facet>
+ <h:outputText id="BookingCheckOutDate" value="#{book.checkoutDate}"/>
</h:column>
- <h:column>
- <f:facet name="header">Confirmation number</f:facet>
+ <h:column id="column6">
+ <f:facet id="ConfNumberFacet" name="header">Confirmation number</f:facet>
#{book.id}
</h:column>
- <h:column>
- <f:facet name="header">Action</f:facet>
+ <h:column id="column7">
+ <f:facet id="ActionFacet" name="header">Action</f:facet>
<h:commandLink id="cancel" value="Cancel" action="#{bookingList.cancel}"/>
</h:column>
</h:dataTable>
Modified: branches/Seam_2_0/examples/booking/view/password.xhtml
===================================================================
--- branches/Seam_2_0/examples/booking/view/password.xhtml 2008-06-04 14:36:51 UTC (rev 8326)
+++ branches/Seam_2_0/examples/booking/view/password.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
@@ -16,19 +16,19 @@
<div class="section">
<div class="entry errors">
- <h:messages globalOnly="true"/>
+ <h:messages id="messages" globalOnly="true"/>
</div>
<h:form id="setpassword">
<fieldset>
- <s:decorate template="edit.xhtml">
+ <s:decorate id="PasswordDecorate" template="edit.xhtml">
<ui:define name="label">Password:</ui:define>
<h:inputSecret id="password" value="#{user.password}" required="true"/>
</s:decorate>
- <s:decorate template="edit.xhtml">
+ <s:decorate id="VerifyDecorate" template="edit.xhtml">
<ui:define name="label">Verify:</ui:define>
<h:inputSecret id="verify" value="#{changePassword.verify}" required="true"/>
</s:decorate>
Modified: branches/Seam_2_0/examples/booking/view/register.xhtml
===================================================================
--- branches/Seam_2_0/examples/booking/view/register.xhtml 2008-06-04 14:36:51 UTC (rev 8326)
+++ branches/Seam_2_0/examples/booking/view/register.xhtml 2008-06-04 14:47:55 UTC (rev 8327)
@@ -48,7 +48,7 @@
<div class="section">
<div class="entry errors">
- <h:messages globalOnly="true"/>
+ <h:messages id="messages" globalOnly="true"/>
</div>
<h:form id="registration">
@@ -57,14 +57,14 @@
<s:decorate id="usernameDecorate" template="edit.xhtml">
<ui:define name="label">Username:</ui:define>
<h:inputText id="username" value="#{user.username}" required="true">
- <a:support event="onblur" reRender="usernameDecorate"/>
+ <a:support id="onblur" event="onblur" reRender="usernameDecorate"/>
</h:inputText>
</s:decorate>
<s:decorate id="nameDecorate" template="edit.xhtml">
<ui:define name="label">Real Name:</ui:define>
<h:inputText id="name" value="#{user.name}" required="true">
- <a:support event="onblur" reRender="nameDecorate"/>
+ <a:support id="onblur" event="onblur" reRender="nameDecorate"/>
</h:inputText>
</s:decorate>
16 years, 6 months
Seam SVN: r8325 - trunk/src/mail/org/jboss/seam/mail/ui.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-06-04 09:20:41 -0400 (Wed, 04 Jun 2008)
New Revision: 8325
Modified:
trunk/src/mail/org/jboss/seam/mail/ui/UIHeader.java
Log:
ws
Modified: trunk/src/mail/org/jboss/seam/mail/ui/UIHeader.java
===================================================================
--- trunk/src/mail/org/jboss/seam/mail/ui/UIHeader.java 2008-06-04 09:26:38 UTC (rev 8324)
+++ trunk/src/mail/org/jboss/seam/mail/ui/UIHeader.java 2008-06-04 13:20:41 UTC (rev 8325)
@@ -17,9 +17,12 @@
{
try
{
- if (getValue() != null) {
+ if (getValue() != null)
+ {
findMimeMessage().addHeader(getName(), getValue());
- } else {
+ }
+ else
+ {
findMimeMessage().addHeader(getName(), encode(facesContext));
}
}
16 years, 6 months
Seam SVN: r8324 - trunk/src/main/org/jboss/seam/security.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-06-04 05:26:38 -0400 (Wed, 04 Jun 2008)
New Revision: 8324
Modified:
trunk/src/main/org/jboss/seam/security/Identity.java
Log:
explicit check that authentication is successful upon calling login(), if not, throw an exception
Modified: trunk/src/main/org/jboss/seam/security/Identity.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/Identity.java 2008-06-04 09:03:33 UTC (rev 8323)
+++ trunk/src/main/org/jboss/seam/security/Identity.java 2008-06-04 09:26:38 UTC (rev 8324)
@@ -222,6 +222,11 @@
authenticate();
+ if (!isLoggedIn(false))
+ {
+ throw new LoginException();
+ }
+
if ( log.isDebugEnabled() )
{
log.debug("Login successful for: " + getUsername());
@@ -239,8 +244,9 @@
log.debug("Login failed for: " + getUsername(), ex);
}
if (Events.exists()) Events.instance().raiseEvent(EVENT_LOGIN_FAILED, ex);
- return null;
}
+
+ return null;
}
/**
16 years, 6 months
Seam SVN: r8323 - trunk/src/main/org/jboss/seam/security.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-06-04 05:03:33 -0400 (Wed, 04 Jun 2008)
New Revision: 8323
Modified:
trunk/src/main/org/jboss/seam/security/Identity.java
Log:
javadoc for deprecated methods
Modified: trunk/src/main/org/jboss/seam/security/Identity.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/Identity.java 2008-06-04 00:18:06 UTC (rev 8322)
+++ trunk/src/main/org/jboss/seam/security/Identity.java 2008-06-04 09:03:33 UTC (rev 8323)
@@ -590,24 +590,36 @@
return Expressions.instance().createValueExpression(expr, Boolean.class).getValue();
}
+ /**
+ * @see org.jboss.seam.security.Credentials#getUsername()
+ */
@Deprecated
public String getUsername()
{
return credentials.getUsername();
}
+ /**
+ * @see org.jboss.seam.security.Credentials#setUsername(String)
+ */
@Deprecated
public void setUsername(String username)
{
credentials.setUsername(username);
}
-
+
+ /**
+ * @see org.jboss.seam.security.Credentials#getPassword()
+ */
@Deprecated
public String getPassword()
{
return credentials.getPassword();
}
+ /**
+ * @see org.jboss.seam.security.Credentials#setPassword(String)
+ */
@Deprecated
public void setPassword(String password)
{
16 years, 6 months
Seam SVN: r8322 - trunk/src/main/org/jboss/seam/security/permission.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-06-03 20:18:06 -0400 (Tue, 03 Jun 2008)
New Revision: 8322
Modified:
trunk/src/main/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java
Log:
JBSEAM-3064
Modified: trunk/src/main/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java 2008-06-04 00:17:32 UTC (rev 8321)
+++ trunk/src/main/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java 2008-06-04 00:18:06 UTC (rev 8322)
@@ -93,21 +93,21 @@
if (securityContext == null) return false;
List<FactHandle> handles = new ArrayList<FactHandle>();
-
- if (!(target instanceof String) && !(target instanceof Class))
- {
- handles.add( securityContext.insert(target) );
- }
- else if (target instanceof Class)
- {
- String componentName = Seam.getComponentName((Class) target);
- target = componentName != null ? componentName : ((Class) target).getName();
- }
-
+
PermissionCheck check = new PermissionCheck(target, action);
synchronized( securityContext )
{
+ if (!(target instanceof String) && !(target instanceof Class))
+ {
+ handles.add( securityContext.insert(target) );
+ }
+ else if (target instanceof Class)
+ {
+ String componentName = Seam.getComponentName((Class) target);
+ target = componentName != null ? componentName : ((Class) target).getName();
+ }
+
try
{
synchronizeContext();
@@ -146,21 +146,20 @@
RoleCheck roleCheck = new RoleCheck(roleName);
List<FactHandle> handles = new ArrayList<FactHandle>();
-
- if (!(target instanceof String) && !(target instanceof Class))
- {
- handles.add( securityContext.insert(target) );
- }
- else if (target instanceof Class)
- {
- String componentName = Seam.getComponentName((Class) target);
- target = componentName != null ? componentName : ((Class) target).getName();
- }
-
PermissionCheck check = new PermissionCheck(target, action);
synchronized( securityContext )
{
+ if (!(target instanceof String) && !(target instanceof Class))
+ {
+ handles.add( securityContext.insert(target) );
+ }
+ else if (target instanceof Class)
+ {
+ String componentName = Seam.getComponentName((Class) target);
+ target = componentName != null ? componentName : ((Class) target).getName();
+ }
+
try
{
synchronizeContext();
16 years, 6 months
Seam SVN: r8321 - branches/Seam_2_0/src/main/org/jboss/seam/security.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-06-03 20:17:32 -0400 (Tue, 03 Jun 2008)
New Revision: 8321
Modified:
branches/Seam_2_0/src/main/org/jboss/seam/security/RuleBasedIdentity.java
Log:
JBSEAM-3064
Modified: branches/Seam_2_0/src/main/org/jboss/seam/security/RuleBasedIdentity.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/security/RuleBasedIdentity.java 2008-06-02 12:37:38 UTC (rev 8320)
+++ branches/Seam_2_0/src/main/org/jboss/seam/security/RuleBasedIdentity.java 2008-06-04 00:17:32 UTC (rev 8321)
@@ -117,15 +117,14 @@
StatefulSession securityContext = getSecurityContext();
if (securityContext == null) return false;
-
- synchronizeContext();
-
+
List<FactHandle> handles = new ArrayList<FactHandle>();
-
PermissionCheck check = new PermissionCheck(name, action);
synchronized( securityContext )
{
+ synchronizeContext();
+
handles.add( securityContext.insert(check) );
for (int i = 0; i < arg.length; i++)
@@ -222,44 +221,47 @@
{
if (getSecurityContext() != null)
{
- for ( Group sg : getSubject().getPrincipals(Group.class) )
- {
- if ( ROLES_GROUP.equals( sg.getName() ) )
+ synchronized(getSecurityContext())
+ {
+ for ( Group sg : getSubject().getPrincipals(Group.class) )
{
- Enumeration e = sg.members();
- while (e.hasMoreElements())
+ if ( ROLES_GROUP.equals( sg.getName() ) )
{
- Principal role = (Principal) e.nextElement();
-
- boolean found = false;
- Iterator<Role> iter = getSecurityContext().iterateObjects(new ClassObjectFilter(Role.class));
- while (iter.hasNext())
+ Enumeration e = sg.members();
+ while (e.hasMoreElements())
{
- Role r = iter.next();
- if (r.getName().equals(role.getName()))
+ Principal role = (Principal) e.nextElement();
+
+ boolean found = false;
+ Iterator<Role> iter = getSecurityContext().iterateObjects(new ClassObjectFilter(Role.class));
+ while (iter.hasNext())
{
- found = true;
- break;
+ Role r = iter.next();
+ if (r.getName().equals(role.getName()))
+ {
+ found = true;
+ break;
+ }
}
+
+ if (!found)
+ {
+ getSecurityContext().insert(new Role(role.getName()));
+ }
+
}
-
- if (!found)
- {
- getSecurityContext().insert(new Role(role.getName()));
- }
-
}
- }
- }
-
- Iterator<Role> iter = getSecurityContext().iterateObjects(new ClassObjectFilter(Role.class));
- while (iter.hasNext())
- {
- Role r = iter.next();
- if (!super.hasRole(r.getName()))
+ }
+
+ Iterator<Role> iter = getSecurityContext().iterateObjects(new ClassObjectFilter(Role.class));
+ while (iter.hasNext())
{
- FactHandle fh = getSecurityContext().getFactHandle(r);
- getSecurityContext().retract(fh);
+ Role r = iter.next();
+ if (!super.hasRole(r.getName()))
+ {
+ FactHandle fh = getSecurityContext().getFactHandle(r);
+ getSecurityContext().retract(fh);
+ }
}
}
}
16 years, 6 months
Seam SVN: r8320 - in branches/Seam_2_0: examples/wiki/src/main/org/jboss/seam/wiki/core/engine and 2 other directories.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-06-02 08:37:38 -0400 (Mon, 02 Jun 2008)
New Revision: 8320
Added:
branches/Seam_2_0/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiFormattedTextValidator.java
Modified:
branches/Seam_2_0/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextParser.java
branches/Seam_2_0/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java
branches/Seam_2_0/seam-text.g
branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/validator/FormattedTextValidator.java
Log:
Backported JBSEAM-3058
Added: branches/Seam_2_0/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiFormattedTextValidator.java
===================================================================
--- branches/Seam_2_0/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiFormattedTextValidator.java (rev 0)
+++ branches/Seam_2_0/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiFormattedTextValidator.java 2008-06-02 12:37:38 UTC (rev 8320)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.seam.wiki.core.engine;
+
+import org.jboss.seam.ui.validator.FormattedTextValidator;
+import org.jboss.seam.text.SeamTextParser;
+import antlr.SemanticException;
+
+/**
+ * Disables the Seam Text validation for link tags, so wiki links are OK.
+ *
+ * @author Christian Bauer
+ */
+public class WikiFormattedTextValidator extends FormattedTextValidator {
+
+ public SeamTextParser getSeamTextParser(String s) {
+ SeamTextParser parser = super.getSeamTextParser(s);
+ parser.setSanitizer(
+ new SeamTextParser.DefaultSanitizer() {
+ @Override
+ public void validateLinkTagURI(String s) throws SemanticException {}
+ }
+ );
+ return parser;
+ }
+
+}
Modified: branches/Seam_2_0/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextParser.java
===================================================================
--- branches/Seam_2_0/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextParser.java 2008-06-02 11:58:44 UTC (rev 8319)
+++ branches/Seam_2_0/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextParser.java 2008-06-02 12:37:38 UTC (rev 8320)
@@ -7,6 +7,7 @@
package org.jboss.seam.wiki.core.engine;
import antlr.ANTLRException;
+import antlr.SemanticException;
import org.jboss.seam.text.SeamTextLexer;
import org.jboss.seam.text.SeamTextParser;
import org.jboss.seam.wiki.core.model.*;
@@ -50,6 +51,16 @@
super(new SeamTextLexer(new StringReader(wikiText)));
this.renderDuplicateMacros = renderDuplicateMacros;
this.resolveLinks = resolveLinks;
+
+ setSanitizer(
+ new DefaultSanitizer() {
+ @Override
+ public void validateLinkTagURI(String s) throws SemanticException {
+ // NOOP, we validate that later in linkTag()
+ }
+ }
+ );
+
}
/**
Modified: branches/Seam_2_0/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java
===================================================================
--- branches/Seam_2_0/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java 2008-06-02 11:58:44 UTC (rev 8319)
+++ branches/Seam_2_0/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java 2008-06-02 12:37:38 UTC (rev 8320)
@@ -5,7 +5,7 @@
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.ScopeType;
import org.jboss.seam.faces.FacesMessages;
-import org.jboss.seam.ui.validator.FormattedTextValidator;
+import org.jboss.seam.wiki.core.engine.WikiFormattedTextValidator;
import java.util.Map;
import java.util.HashMap;
@@ -41,7 +41,9 @@
public void validate(String textEditorId, String value) {
if (value == null) return;
- FormattedTextValidator validator = new FormattedTextValidator();
+
+ WikiFormattedTextValidator validator = new WikiFormattedTextValidator();
+
try {
validator.validate(null, null, value);
} catch (ValidatorException e) {
Modified: branches/Seam_2_0/seam-text.g
===================================================================
--- branches/Seam_2_0/seam-text.g 2008-06-02 11:58:44 UTC (rev 8319)
+++ branches/Seam_2_0/seam-text.g 2008-06-02 12:37:38 UTC (rev 8320)
@@ -6,24 +6,359 @@
class SeamTextParser extends Parser;
options
{
- k=4;
- defaultErrorHandler=false;
+ k=4;
+ defaultErrorHandler=false;
}
{
- private java.util.Set htmlElements = new java.util.HashSet( java.util.Arrays.asList( new String[] { "a", "p", "q", "blockquote", "code", "pre", "table", "tr", "td", "th", "ul", "ol", "li", "b", "i", "u", "tt", "del", "em", "hr", "br", "div", "span", "h1", "h2", "h3", "h4", "img"} ) );
- private java.util.Set htmlAttributes = new java.util.HashSet( java.util.Arrays.asList( new String[] { "src", "href", "lang", "class", "id", "style", "width", "height", "name", "value", "type", "cellpadding", "cellspacing", "border" } ) );
+ public class Macro {
+ public String name;
+ public java.util.SortedMap<String,String> params = new java.util.TreeMap<String,String>();
- public class Macro {
- public String name;
- public java.util.SortedMap<String,String> params = new java.util.TreeMap<String,String>();
+ public Macro(String name) {
+ this.name = name;
+ }
+ }
- public Macro(String name) {
- this.name = name;
- }
- }
+ /**
+ * Sanitization of user input, used to clean links and plain HTML.
+ */
+ public interface Sanitizer {
- private Macro currentMacro;
-
+ /**
+ * Called by the SeamTextParser when a link tag is parsed, i.e. [=>some URI].
+ *
+ * @param uri the user-entered link text
+ * @throws SemanticException thrown if the URI is not syntactically or semantically valid
+ */
+ public void validateLinkTagURI(String uri) throws SemanticException;
+
+ /**
+ * Called by the SeamTextParser when a plain HTML element is parsed.
+ *
+ * @param element the token of the parse tree, call <tt>getText()</tt> to access the HTML tag name
+ * @throws SemanticException thrown when the HTML tag is not valid
+ */
+ public void validateHtmlElement(Token element) throws SemanticException;
+
+ /**
+ * Called by the SeamTextParser when a plain HTML attribute is parsed.
+ *
+ * @param element the token of the parse tree that represents the HTML tag
+ * @param attribute the token of the parse tree that represents the HTML attribute
+ * @throws SemanticException thrown if the attribute is not valid for the given HTML tag
+ */
+ public void validateHtmlAttribute(Token element, Token attribute) throws SemanticException;
+
+ /**
+ * Called by the SeamTextParser when a plain HTML attribute value is parsed.
+ *
+ * @param element the token of the parse tree that represents the HTML tag
+ * @param attribute the token of the parse tree that represents the HTML attribute
+ * @param attributeValue the plain string value of the HTML attribute
+ * @throws SemanticException thrown if the attribute value is not valid for the given HTML attribute and element
+ */
+ public void validateHtmlAttributeValue(Token element, Token attribute, String attributeValue) throws SemanticException;
+
+ public String getInvalidURIMessage(String uri);
+ public String getInvalidElementMessage(String elementName);
+ public String getInvalidAttributeMessage(String elementName, String attributeName);
+ public String getInvalidAttributeValueMessage(String elementName, String attributeName, String value);
+ }
+
+ /**
+ * Implementation of the rules in http://wiki.whatwg.org/wiki/Sanitization_rules
+ *
+ * Changes and additions:
+ *
+ * 1. Expanded all -* wildcard values to their full CSS property name (e.g. border-*).
+ *
+ * 2. Added dash as allowed characater to REGEX_VALID_CSS_STRING1.
+ *
+ * 3. Improved REGEX_VALID_CSS_VALUE with range {n,m} checks for color values and negative units.
+ *
+ * 4. Added more options (mostly of vertical-align property, e.g. "middle", "text-top") as allowed CSS values.
+ *
+ * 5. Added "max-height", "max-width", "min-height", "min-width" to CSS properties.
+ *
+ * 6. Removed 'data' URI scheme.
+ *
+ * 7. Not implemented filtering of CSS url() - it's an invalid value always.
+ *
+ */
+ public static class DefaultSanitizer implements SeamTextParser.Sanitizer {
+
+ public final java.util.regex.Pattern REGEX_VALID_CSS_STRING1 = java.util.regex.Pattern.compile(
+ "^([-:,;#%.\\sa-zA-Z0-9!]|\\w-\\w|'[\\s\\w]+'|\"[\\s\\w]+\"|\\([\\d,\\s]+\\))*$"
+ );
+
+ public final java.util.regex.Pattern REGEX_VALID_CSS_STRING2 = java.util.regex.Pattern.compile(
+ "^(\\s*[-\\w]+\\s*:\\s*[^:;]*(;|$))*$"
+ );
+
+ public final java.util.regex.Pattern REGEX_VALID_CSS_VALUE = java.util.regex.Pattern.compile(
+ "^(#[0-9a-f]{3,6}|rgb\\(\\d{1,3}%?,\\d{1,3}%?,?\\d{1,3}%?\\)?|-?\\d{0,2}\\.?\\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\\))?)$"
+ );
+
+ public final java.util.regex.Pattern REGEX_INVALID_CSS_URL = java.util.regex.Pattern.compile(
+ "url\\s*\\(\\s*[^\\s)]+?\\s*\\)\\s*"
+ );
+
+ protected java.util.Set<String> acceptableElements = new java.util.HashSet(java.util.Arrays.asList(
+ "a", "abbr", "acronym", "address", "area", "b", "bdo", "big", "blockquote",
+ "br", "button", "caption", "center", "cite", "code", "col", "colgroup", "dd",
+ "del", "dfn", "dir", "div", "dl", "dt", "em", "fieldset", "font", "form",
+ "h1", "h2", "h3", "h4", "h5", "h6", "hr", "i", "img", "input", "ins", "kbd",
+ "label", "legend", "li", "map", "menu", "ol", "optgroup", "option", "p",
+ "pre", "q", "s", "samp", "select", "small", "span", "strike", "strong",
+ "sub", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead",
+ "tr", "tt", "u", "ul", "var", "wbr"
+ ));
+
+ protected java.util.Set<String> mathmlElements = new java.util.HashSet(java.util.Arrays.asList(
+ "maction", "math", "merror", "mfrac", "mi", "mmultiscripts", "mn", "mo",
+ "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "mspace",
+ "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext",
+ "mtr", "munder", "munderover", "none"
+ ));
+
+ protected java.util.Set<String> svgElements = new java.util.HashSet(java.util.Arrays.asList(
+ "a", "animate", "animateColor", "animateMotion", "animateTransform",
+ "circle", "defs", "desc", "ellipse", "font-face", "font-face-name",
+ "font-face-src", "g", "glyph", "hkern", "image", "line", "linearGradient",
+ "marker", "metadata", "missing-glyph", "mpath", "path", "polygon",
+ "polyline", "radialGradient", "rect", "set", "stop", "svg", "switch", "text",
+ "title", "tspan", "use"
+ ));
+
+ protected java.util.Set<String> acceptableAttributes = new java.util.HashSet(java.util.Arrays.asList(
+ "abbr", "accept", "accept-charset", "accesskey", "action", "align", "alt",
+ "axis", "border", "cellpadding", "cellspacing", "char", "charoff", "charset",
+ "checked", "cite", "class", "clear", "color", "cols", "colspan", "compact",
+ "coords", "datetime", "dir", "disabled", "enctype", "for", "frame",
+ "headers", "height", "href", "hreflang", "hspace", "id", "ismap", "label",
+ "lang", "longdesc", "maxlength", "media", "method", "multiple", "name",
+ "nohref", "noshade", "nowrap", "prompt", "readonly", "rel", "rev", "rows",
+ "rowspan", "rules", "scope", "selected", "shape", "size", "span", "src",
+ "start", "style", "summary", "tabindex", "target", "title", "type", "usemap",
+ "valign", "value", "vspace", "width", "xml:lang"
+ ));
+
+ protected java.util.Set<String> mathmlAttributes = new java.util.HashSet(java.util.Arrays.asList(
+ "actiontype", "align", "columnalign", "columnalign", "columnalign",
+ "columnlines", "columnspacing", "columnspan", "depth", "display",
+ "displaystyle", "equalcolumns", "equalrows", "fence", "fontstyle",
+ "fontweight", "frame", "height", "linethickness", "lspace", "mathbackground",
+ "mathcolor", "mathvariant", "mathvariant", "maxsize", "minsize", "other",
+ "rowalign", "rowalign", "rowalign", "rowlines", "rowspacing", "rowspan",
+ "rspace", "scriptlevel", "selection", "separator", "stretchy", "width",
+ "width", "xlink:href", "xlink:show", "xlink:type", "xmlns", "xmlns:xlink"
+ ));
+
+ protected java.util.Set<String> svgAttributes = new java.util.HashSet(java.util.Arrays.asList(
+ "accent-height", "accumulate", "additive", "alphabetic", "arabic-form",
+ "ascent", "attributeName", "attributeType", "baseProfile", "bbox", "begin",
+ "by", "calcMode", "cap-height", "class", "color", "color-rendering",
+ "content", "cx", "cy", "d", "descent", "display", "dur", "dx", "dy", "end",
+ "fill", "fill-rule", "font-family", "font-size", "font-stretch",
+ "font-style", "font-variant", "font-weight", "from", "fx", "fy", "g1", "g2",
+ "glyph-name", "gradientUnits", "hanging", "height", "horiz-adv-x",
+ "horiz-origin-x", "id", "ideographic", "k", "keyPoints", "keySplines",
+ "keyTimes", "lang", "marker-end", "marker-mid", "marker-start",
+ "markerHeight", "markerUnits", "markerWidth", "mathematical", "max", "min",
+ "name", "offset", "opacity", "orient", "origin", "overline-position",
+ "overline-thickness", "panose-1", "path", "pathLength", "points",
+ "preserveAspectRatio", "r", "refX", "refY", "repeatCount", "repeatDur",
+ "requiredExtensions", "requiredFeatures", "restart", "rotate", "rx", "ry",
+ "slope", "stemh", "stemv", "stop-color", "stop-opacity",
+ "strikethrough-position", "strikethrough-thickness", "stroke",
+ "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin",
+ "stroke-miterlimit", "stroke-opacity", "stroke-width", "systemLanguage",
+ "target", "text-anchor", "to", "transform", "type", "u1", "u2",
+ "underline-position", "underline-thickness", "unicode", "unicode-range",
+ "units-per-em", "values", "version", "viewBox", "visibility", "width",
+ "widths", "x", "x-height", "x1", "x2", "xlink:actuate", "xlink:arcrole",
+ "xlink:href", "xlink:role", "xlink:show", "xlink:title", "xlink:type",
+ "xml:base", "xml:lang", "xml:space", "xmlns", "xmlns:xlink", "y", "y1", "y2",
+ "zoomAndPan"
+ ));
+
+ protected java.util.Set<String> styleProperties = new java.util.HashSet(java.util.Arrays.asList(
+ "azimuth",
+ "background", "background-attachment", "background-color", "background-image",
+ "background-position", "background-repeat",
+ "border", "border-bottom", "border-bottom-color", "border-bottom-style",
+ "border-bottom-width", "border-collapse", "border-color", "border-left",
+ "border-left-color", "border-left-style", "border-left-width", "border-right",
+ "border-right-color", "border-right-style", "border-right-width", "border-spacing",
+ "border-style", "border-top", "border-top-color", "border-top-style",
+ "border-top-width", "border-width",
+ "clear", "color",
+ "cursor", "direction", "display", "elevation", "float", "font",
+ "font-family", "font-size", "font-style", "font-variant", "font-weight",
+ "height", "letter-spacing", "line-height",
+ "margin", "margin-bottom", "margin-left", "margin-right", "margin-top",
+ "max-height", "max-width", "min-height", "min-width",
+ "overflow",
+ "padding", "padding-bottom", "padding-left", "padding-right", "padding-top",
+ "pause", "pause-after", "pause-before", "pitch",
+ "pitch-range", "richness", "speak", "speak-header", "speak-numeral",
+ "speak-punctuation", "speech-rate", "stress", "text-align",
+ "text-decoration", "text-indent", "unicode-bidi", "vertical-align",
+ "voice-family", "volume", "white-space", "width"
+ ));
+
+ protected java.util.Set<String> stylePropertiesValues = new java.util.HashSet(java.util.Arrays.asList(
+ "aqua", "auto", "baseline", "black", "block", "blue", "bold", "both", "bottom", "brown",
+ "center", "collapse", "dashed", "dotted", "fuchsia", "gray", "green",
+ "inherit", "italic", "left", "length", "lime", "maroon", "medium", "middle", "navy", "none", "normal",
+ "nowrap", "olive", "percentage", "pointer", "purple", "red", "right", "silver", "solid", "sub", "super",
+ "teal", "text-bottom", "text-top", "top", "transparent", "underline", "white", "yellow"
+ ));
+
+ protected java.util.Set<String> svgStyleProperties = new java.util.HashSet(java.util.Arrays.asList(
+ "fill", "fill-opacity", "fill-rule", "stroke", "stroke-linecap",
+ "stroke-linejoin", "stroke-opacity", "stroke-width"
+ ));
+
+ protected java.util.Set<String> attributesWhoseValueIsAURI = new java.util.HashSet(java.util.Arrays.asList(
+ "action", "cite", "href", "longdesc", "src", "xlink:href", "xml:base"
+ ));
+
+ protected java.util.Set<String> uriSchemes = new java.util.HashSet(java.util.Arrays.asList(
+ "afs", "aim", "callto", "ed2k", "feed", "ftp", "gopher", "http", "https",
+ "irc", "mailto", "news", "nntp", "rsync", "rtsp", "sftp", "ssh", "tag",
+ "tel", "telnet", "urn", "webcal", "wtai", "xmpp"
+ ));
+
+ public void validateLinkTagURI(String uri) throws SemanticException {
+ if (!validateURI(uri)) {
+ throw new SemanticException("Invalid URI");
+ }
+ }
+
+ public void validateHtmlElement(Token element) throws SemanticException {
+ String elementName = element.getText().toLowerCase();
+
+ if (!acceptableElements.contains(elementName) &&
+ !svgElements.contains(elementName) &&
+ !mathmlElements.contains(elementName)) {
+ throw new SemanticException(getInvalidElementMessage(elementName));
+ }
+ }
+
+ public void validateHtmlAttribute(Token element, Token attribute) throws SemanticException {
+ String elementName = element.getText().toLowerCase();
+ String attributeName = attribute.getText().toLowerCase();
+ if (!acceptableAttributes.contains(attributeName) &&
+ !svgAttributes.contains(attributeName) &&
+ !mathmlAttributes.contains(attributeName)) {
+ throw new SemanticException(getInvalidAttributeMessage(elementName, attributeName));
+ }
+ }
+
+ public void validateHtmlAttributeValue(Token element,
+ Token attribute,
+ String attributeValue) throws SemanticException {
+
+ String elementName = element.getText().toLowerCase();
+ String attributeName = attribute.getText().toLowerCase();
+
+ // Check element with attribute that has URI value (href, src, etc.)
+ if (attributesWhoseValueIsAURI.contains(attributeName) && !validateURI(attributeValue)) {
+ throw new SemanticException(getInvalidURIMessage(attributeValue));
+ }
+
+ // Check attribute value of style (CSS filtering)
+ if (attributeName.equals("style")) {
+ if (!REGEX_VALID_CSS_STRING1.matcher(attributeValue).matches() ||
+ !REGEX_VALID_CSS_STRING2.matcher(attributeValue).matches()) {
+ throw new SemanticException(getInvalidAttributeValueMessage(elementName, attributeName, attributeValue));
+ }
+
+ String[] cssProperties = attributeValue.split(";");
+ for (String cssProperty : cssProperties) {
+ if (!cssProperty.contains(":")) {
+ throw new SemanticException(getInvalidAttributeValueMessage(elementName, attributeName, attributeValue));
+ }
+ String[] property = cssProperty.split(":");
+ String propertyName = property[0].trim();
+ String propertyValue = property.length == 2 ? property[1].trim() : null;
+
+ // CSS property name
+ if (!styleProperties.contains(propertyName) &&
+ !svgStyleProperties.contains(propertyName)) {
+ throw new SemanticException(getInvalidAttributeValueMessage(elementName, attributeName, attributeValue));
+ }
+
+ // CSS property value
+ if (!stylePropertiesValues.contains(propertyValue)) {
+ // Not in list, now check the regex
+ if (!REGEX_VALID_CSS_VALUE.matcher(propertyValue).matches()) {
+ throw new SemanticException(getInvalidAttributeValueMessage(elementName, attributeName, attributeValue));
+ }
+ }
+ }
+ }
+
+ // TODO: Implement SVG style checking?! Who cares...
+ }
+
+ /**
+ * Validate a URI string.
+ * <p>
+ * The default implementation accepts any URI string that starts with a slash,
+ * this is considered a relative URL. Any absolute URI is parsed by the JDK with
+ * the <tt>java.net.URI</tt> constructor. Finally, the scheme of the parsed
+ * absolute URI is checked with a list of valid schemes.
+ * </p>
+ *
+ * @param uri the URI string
+ * @return return true if the String represents a safe and valid URI
+ */
+ protected boolean validateURI(String uri) {
+
+ // Relative URI starts with a slash
+ if (uri.startsWith("/")) return true;
+
+ java.net.URI parsedURI;
+ try {
+ parsedURI = new java.net.URI(uri);
+ } catch (java.net.URISyntaxException ex) {
+ return false;
+ }
+
+ if (!uriSchemes.contains(parsedURI.getScheme())) {
+ return false;
+ }
+ return true;
+ }
+
+ public String getInvalidURIMessage(String uri) {
+ return "invalid URI";
+ }
+
+ public String getInvalidElementMessage(String elementName) {
+ return "invalid element '" + elementName + "'";
+ }
+
+ public String getInvalidAttributeMessage(String elementName, String attributeName) {
+ return "invalid attribute '" + attributeName + "' for element '" + elementName + "'";
+ }
+
+ public String getInvalidAttributeValueMessage(String elementName, String attributeName, String value) {
+ return "invalid value of attribute '" + attributeName + "' for element '" + elementName + "'";
+ };
+
+ }
+
+ private Sanitizer sanitizer = new DefaultSanitizer();
+ public void setSanitizer(Sanitizer sanitizer) {
+ this.sanitizer = sanitizer;
+ }
+
+ private Macro currentMacro;
+ private java.util.Stack<Token> htmlElementStack = new java.util.Stack<Token>();
+
private StringBuilder mainBuilder = new StringBuilder();
private StringBuilder builder = mainBuilder;
@@ -38,19 +373,7 @@
private static boolean hasMultiple(String string, char c) {
return string.indexOf(c)!=string.lastIndexOf(c);
}
-
- private void validateElement(Token t) throws NoViableAltException {
- if ( !htmlElements.contains( t.getText().toLowerCase() ) ) {
- throw new NoViableAltException(t, null);
- }
- }
- private void validateAttribute(Token t) throws NoViableAltException {
- if ( !htmlAttributes.contains( t.getText().toLowerCase() ) ) {
- throw new NoViableAltException(t, null);
- }
- }
-
private void beginCapture() {
builder = new StringBuilder();
}
@@ -200,7 +523,11 @@
EQ GT
{ beginCapture(); }
attributeValue
- { String link = endCapture(); append(linkTag(text, link)); }
+ {
+ String link = endCapture();
+ sanitizer.validateLinkTagURI(link);
+ append(linkTag(text, link));
+ }
CLOSE
;
@@ -342,22 +669,54 @@
body: (plain|formatted|preformatted|quoted|html|list|newline)*
;
-openTag: LT name:ALPHANUMERICWORD { validateElement(name); append("<"); append(name.getText()); }
+openTag:
+ LT name:ALPHANUMERICWORD
+ {
+ htmlElementStack.push(name);
+ sanitizer.validateHtmlElement(name);
+ append("<");
+ append(name.getText());
+ }
;
-
+
beforeBody: GT { append(">"); }
;
-closeTagWithBody: LT SLASH name:ALPHANUMERICWORD GT { append("</"); append(name.getText()); append(">"); }
+closeTagWithBody:
+ LT SLASH name:ALPHANUMERICWORD GT
+ {
+ append("</");
+ append(name.getText());
+ append(">");
+ htmlElementStack.pop();
+ }
;
-closeTagWithNoBody: SLASH GT { append("/>"); }
+closeTagWithNoBody:
+ SLASH GT
+ {
+ append("/>");
+ htmlElementStack.pop();
+ }
;
attribute: att:ALPHANUMERICWORD (space)* EQ (space)*
- DOUBLEQUOTE { validateAttribute(att); append(att.getText()); append("=\""); }
- attributeValue
- DOUBLEQUOTE { append("\""); }
+ DOUBLEQUOTE
+ {
+ sanitizer.validateHtmlAttribute(htmlElementStack.peek(), att);
+ append(att.getText());
+ append("=\"");
+ }
+ {
+ beginCapture();
+ }
+ attributeValue
+ {
+ String attValue = endCapture();
+ sanitizer.validateHtmlAttributeValue(htmlElementStack.peek(), att, attValue);
+ append(attValue);
+ }
+ DOUBLEQUOTE { append("\""); }
;
attributeValue: ( AMPERSAND { append("&"); } |
Modified: branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/validator/FormattedTextValidator.java
===================================================================
--- branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/validator/FormattedTextValidator.java 2008-06-02 11:58:44 UTC (rev 8319)
+++ branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/validator/FormattedTextValidator.java 2008-06-02 12:37:38 UTC (rev 8320)
@@ -56,9 +56,7 @@
+ value);
}
String text = (String) value;
- Reader r = new StringReader(text);
- SeamTextLexer lexer = new SeamTextLexer(r);
- SeamTextParser parser = new SeamTextParser(lexer);
+ SeamTextParser parser = getSeamTextParser(text);
try {
parser.startRule();
}
@@ -81,6 +79,18 @@
}
/**
+ * Override to instantiate a custom <tt>SeamTextLexer</tt> and <tt>SeamTextParser</tt>.
+ *
+ * @param text the raw markup text
+ * @return an instance of <tt>SeamTextParser</tt>
+ */
+ public SeamTextParser getSeamTextParser(String text) {
+ Reader r = new StringReader(text);
+ SeamTextLexer lexer = new SeamTextLexer(r);
+ return new SeamTextParser(lexer);
+ }
+
+ /**
* Extracts the error from the <tt>RecognitionException</tt> and generates
* a message with some helpful context.
*
16 years, 6 months
Seam SVN: r8319 - in trunk/examples/wiki/src: main/org/jboss/seam/wiki/core/action and 8 other directories.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-06-02 07:58:44 -0400 (Mon, 02 Jun 2008)
New Revision: 8319
Added:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiFormattedTextValidator.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/MacroPluginModule.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/PluginModule.java
Removed:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/module/
Modified:
trunk/examples/wiki/src/etc/WEB-INF/web.xml
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/cache/PageFragmentCache.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextParser.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedEntryManager.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/PluginRegistry.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/WikiPluginMacro.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/binding/lacewiki/PluginBinder.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/Plugin.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/UIWikiFormattedText.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiPluginThemeResource.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java
trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java
Log:
Minor changes in plugin system, new wiki text validator
Modified: trunk/examples/wiki/src/etc/WEB-INF/web.xml
===================================================================
--- trunk/examples/wiki/src/etc/WEB-INF/web.xml 2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/etc/WEB-INF/web.xml 2008-06-02 11:58:44 UTC (rev 8319)
@@ -69,12 +69,12 @@
<context-param>
<param-name>com.sun.faces.numberOfViewsInSession</param-name>
- <param-value>3</param-value>
+ <param-value>15</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.numberOfLogicalViews</param-name>
- <param-value>3</param-value>
+ <param-value>15</param-value>
</context-param>
<context-param>
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java 2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -8,7 +8,6 @@
import org.jboss.seam.ScopeType;
import org.jboss.seam.Component;
-import org.jboss.seam.ui.validator.FormattedTextValidator;
import org.jboss.seam.security.AuthorizationException;
import org.jboss.seam.security.Identity;
import org.jboss.seam.core.Events;
@@ -23,6 +22,7 @@
import org.jboss.seam.wiki.core.action.prefs.CommentsPreferences;
import org.jboss.seam.wiki.core.exception.InvalidWikiRequestException;
import org.jboss.seam.wiki.core.ui.WikiRedirect;
+import org.jboss.seam.wiki.core.engine.WikiFormattedTextValidator;
import org.jboss.seam.wiki.util.WikiUtil;
import static org.jboss.seam.international.StatusMessage.Severity.INFO;
@@ -211,7 +211,7 @@
// TODO: Why again are we using a different validator here for the text editor?
protected boolean validateContent() {
- FormattedTextValidator validator = new FormattedTextValidator();
+ WikiFormattedTextValidator validator = new WikiFormattedTextValidator();
try {
validator.validate(null, null, getInstance().getContent());
} catch (ValidatorException e) {
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/cache/PageFragmentCache.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/cache/PageFragmentCache.java 2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/cache/PageFragmentCache.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -13,14 +13,13 @@
import org.jboss.seam.ScopeType;
import org.jboss.seam.wiki.core.plugin.PluginRegistry;
import org.jboss.seam.wiki.core.plugin.metamodel.Plugin;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.PluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.PluginModule;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
-import java.io.Serializable;
import java.util.*;
/**
@@ -74,7 +73,7 @@
for (String cacheRegion : requiredCacheRegions) {
Cache cache = EHCacheManager.instance().getCache(cacheRegion);
if (cache == null) {
- log.info("could not find configuration for region '" + cacheRegion + "', using defaults");
+ log.info("using default configuration for region '" + cacheRegion + "'");
manager.addCache(cacheRegion);
cache = manager.getCache(cacheRegion);
log.debug("started EHCache region: " + cacheRegion);
Added: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiFormattedTextValidator.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiFormattedTextValidator.java (rev 0)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiFormattedTextValidator.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.seam.wiki.core.engine;
+
+import org.jboss.seam.ui.validator.FormattedTextValidator;
+import org.jboss.seam.text.SeamTextParser;
+import antlr.SemanticException;
+
+/**
+ * Disables the Seam Text validation for link tags, so wiki links are OK.
+ * <p>
+ * Also provides some i18n error messages.
+ * </p>
+ *
+ * @author Christian Bauer
+ */
+public class WikiFormattedTextValidator extends FormattedTextValidator {
+
+ public SeamTextParser getSeamTextParser(String s) {
+ SeamTextParser parser = super.getSeamTextParser(s);
+ parser.setSanitizer(
+ new SeamTextParser.DefaultSanitizer() {
+ @Override
+ public void validateLinkTagURI(String s) throws SemanticException {}
+
+ @Override
+ public String getInvalidURIMessage(String s) {
+ return super.getInvalidURIMessage(s);
+ }
+
+ @Override
+ public String getInvalidElementMessage(String s) {
+ return super.getInvalidElementMessage(s);
+ }
+
+ @Override
+ public String getInvalidAttributeMessage(String s, String s1) {
+ return super.getInvalidAttributeMessage(s, s1);
+ }
+
+ @Override
+ public String getInvalidAttributeValueMessage(String s, String s1, String s2) {
+ return super.getInvalidAttributeValueMessage(s, s1, s2);
+ }
+ }
+ );
+ return parser;
+ }
+
+ @Override
+ public String getNoViableAltErrorMessage(String s, String s1) {
+ return super.getNoViableAltErrorMessage(s, s1);
+ }
+
+ @Override
+ public String getMismatchedTokenErrorMessage(String s, String s1) {
+ return super.getMismatchedTokenErrorMessage(s, s1);
+ }
+
+ @Override
+ public String getSemanticErrorMessage(String s) {
+ return super.getSemanticErrorMessage(s);
+ }
+
+ @Override
+ public int getNumberOfCharsBeforeErrorLocation() {
+ return 20;
+ }
+
+ @Override
+ public int getNumberOfCharsAfterErrorLocation() {
+ return 20;
+ }
+
+}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextParser.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextParser.java 2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextParser.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -7,6 +7,7 @@
package org.jboss.seam.wiki.core.engine;
import antlr.ANTLRException;
+import antlr.SemanticException;
import org.jboss.seam.text.SeamTextLexer;
import org.jboss.seam.text.SeamTextParser;
import org.jboss.seam.wiki.core.model.*;
@@ -50,6 +51,15 @@
super(new SeamTextLexer(new StringReader(wikiText)));
this.renderDuplicateMacros = renderDuplicateMacros;
this.resolveLinks = resolveLinks;
+
+ setSanitizer(
+ new DefaultSanitizer() {
+ @Override
+ public void validateLinkTagURI(String s) throws SemanticException {
+ // NOOP, we validate that later in linkTag()
+ }
+ }
+ );
}
/**
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedEntryManager.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedEntryManager.java 2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedEntryManager.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -14,10 +14,10 @@
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.log.Log;
-import org.jboss.seam.ui.validator.FormattedTextValidator;
import org.jboss.seam.wiki.core.engine.WikiLink;
import org.jboss.seam.wiki.core.engine.WikiLinkResolver;
import org.jboss.seam.wiki.core.engine.WikiTextParser;
+import org.jboss.seam.wiki.core.engine.WikiFormattedTextValidator;
import org.jboss.seam.wiki.core.model.FeedEntry;
import org.jboss.seam.wiki.core.model.WikiTextMacro;
import org.jboss.seam.wiki.core.renderer.DefaultWikiTextRenderer;
@@ -70,7 +70,7 @@
} catch (RecognitionException rex) {
// Swallow and log and low debug level
- log.debug( "Ignored parse error generating feed entry text: " + FormattedTextValidator.getErrorMessage(wikiText, rex) );
+ log.debug( "Ignored parse error generating feed entry text: " + WikiFormattedTextValidator.getErrorMessage(wikiText, rex) );
} catch (ANTLRException ex) {
// All other errors are fatal;
throw new RuntimeException(ex);
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/PluginRegistry.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/PluginRegistry.java 2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/PluginRegistry.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -16,10 +16,9 @@
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
import org.jboss.seam.wiki.core.plugin.metamodel.Plugin;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.MacroPluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.MacroPluginModule;
import org.jboss.seam.wiki.core.plugin.binding.PluginBinder;
import org.jboss.seam.wiki.core.exception.InvalidWikiConfigurationException;
-import org.jboss.seam.wiki.core.plugin.WikiPluginMacro;
import org.jboss.seam.wiki.core.model.WikiTextMacro;
import java.util.*;
@@ -67,10 +66,12 @@
return Collections.unmodifiableSortedMap(plugins);
}
+ // TODO: This should be unmodifiable and additions only allowed through a new registry method
public SortedMap<String, MacroPluginModule> getMacroPluginModulesByKey() {
return macroPluginModulesByKey;
}
+ // TODO: This should be unmodifiable and additions only allowed through a new registry method
public SortedMap<String, MacroPluginModule> getMacroPluginModulesByMacroName() {
return macroPluginModulesByMacroName;
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/WikiPluginMacro.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/WikiPluginMacro.java 2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/WikiPluginMacro.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -13,7 +13,7 @@
import org.jboss.seam.log.Logging;
import org.jboss.seam.wiki.core.model.WikiDocument;
import org.jboss.seam.wiki.core.model.WikiTextMacro;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.MacroPluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.MacroPluginModule;
import org.jboss.seam.wiki.util.Hash;
import java.io.Serializable;
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/binding/lacewiki/PluginBinder.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/binding/lacewiki/PluginBinder.java 2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/binding/lacewiki/PluginBinder.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -13,10 +13,9 @@
import org.jboss.seam.wiki.core.exception.InvalidWikiConfigurationException;
import org.jboss.seam.wiki.core.plugin.PluginRegistry;
import org.jboss.seam.wiki.core.plugin.PluginCacheManager;
-import org.jboss.seam.wiki.core.plugin.metamodel.Plugin;
-import org.jboss.seam.wiki.core.plugin.metamodel.PluginInfo;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.MacroPluginModule;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.PluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.MacroPluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.*;
+import org.jboss.seam.wiki.core.plugin.metamodel.PluginModule;
import org.jboss.seam.wiki.preferences.PreferenceVisibility;
import org.jboss.seam.wiki.preferences.metamodel.PreferenceEntity;
import org.jboss.seam.wiki.preferences.metamodel.PreferenceRegistry;
Copied: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/MacroPluginModule.java (from rev 8261, trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/module/MacroPluginModule.java)
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/MacroPluginModule.java (rev 0)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/MacroPluginModule.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -0,0 +1,163 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.seam.wiki.core.plugin.metamodel;
+
+import org.jboss.seam.wiki.core.plugin.metamodel.Plugin;
+import org.jboss.seam.wiki.preferences.metamodel.PreferenceEntity;
+
+import java.util.*;
+
+/**
+ * @author Christian Bauer
+ */
+public class MacroPluginModule extends PluginModule {
+
+ private String name;
+ private String[] skins = {"d"};
+ private DocumentArea[] applicableTo = {DocumentArea.CONTENT};
+ private RenderOption[] renderOptions;
+ private RenderDependency[] renderDependencies;
+ private PreferenceEntity preferenceEntity;
+ private SortedSet<PreferenceEntity.Property> parameters = new TreeSet<PreferenceEntity.Property>();
+
+ public MacroPluginModule(Plugin plugin, String key) {
+ super(plugin, key);
+ }
+
+ // TODO: This is currently not used at all, implement it in metadata/xsd/renderer
+ public static enum DocumentArea {
+ HEADER, CONTENT, FOOTER
+ }
+
+ public static enum RenderOption {
+ SINGLETON
+ }
+
+ // TODO: This is currently not used at all, implement it in metadata/xsd/renderer
+ public static class RenderDependency {
+
+ private String onMacro;
+ private Type type = Type.REQUIRED;
+
+ public RenderDependency(String onMacro, Type type) {
+ this.onMacro = onMacro;
+ this.type = type;
+ }
+
+ public String getOnMacro() {
+ return onMacro;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public enum Type {
+ REQUIRED, INCOMPATIBLE
+ }
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String[] getSkins() {
+ return skins;
+ }
+
+ public void setSkins(String[] skins) {
+ this.skins = skins;
+ }
+
+ public boolean isAvailableForSkin(String skin) {
+ for (String s : skins) {
+ if (skin.equals(s)) return true;
+ }
+ return false;
+ }
+
+ public DocumentArea[] getApplicableTo() {
+ return applicableTo;
+ }
+
+ public void setApplicableTo(DocumentArea[] applicableTo) {
+ this.applicableTo = applicableTo;
+ }
+
+ public boolean isApplicableTo(DocumentArea area) {
+ for (DocumentArea documentArea : getApplicableTo()) {
+ if (area.equals(documentArea)) return true;
+ }
+ return false;
+ }
+
+ public RenderOption[] getRenderOptions() {
+ return renderOptions;
+ }
+
+ public void setRenderOptions(RenderOption[] renderOptions) {
+ this.renderOptions = renderOptions;
+ }
+
+ public boolean isRenderOptionSet(RenderOption renderOption) {
+ if (getRenderOptions() == null) return false;
+ for (RenderOption option : getRenderOptions()) {
+ if (renderOption.equals(option)) return true;
+ }
+ return false;
+ }
+
+ public RenderDependency[] getRenderDependencies() {
+ return renderDependencies;
+ }
+
+ public void setRenderDependencies(RenderDependency[] renderDependencies) {
+ this.renderDependencies = renderDependencies;
+ }
+
+ public PreferenceEntity getPreferenceEntity() {
+ return preferenceEntity;
+ }
+
+ public void setPreferenceEntity(PreferenceEntity preferenceEntity) {
+ this.preferenceEntity = preferenceEntity;
+ for (PreferenceEntity.Property property : preferenceEntity.getPropertiesInstanceVisible()) {
+ parameters.add(property);
+ }
+ }
+
+ public SortedSet<PreferenceEntity.Property> getParameters() {
+ return parameters;
+ }
+
+ public List<PreferenceEntity.Property> getParametersAsList() {
+ return Collections.unmodifiableList(new ArrayList(parameters));
+ }
+
+ public String getRequestImagePath() {
+ return Plugin.GENERATE_RESOURCE_PATH_THEME
+ + "/" + getPlugin().getKey()
+ + "/" + getKey()
+ + "/" + Plugin.PACKAGE_THEMES_IMG;
+ }
+
+ public String getRequestCSSPath() {
+ return Plugin.GENERATE_RESOURCE_PATH_THEME
+ + "/" + getPlugin().getKey()
+ + "/" + getKey()
+ + "/" + Plugin.PACKAGE_THEMES_CSS;
+ }
+
+ // TODO: This is only used in the Administration UI
+ public String getModuleTypeLabel() {
+ return "Macro";
+ }
+}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/Plugin.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/Plugin.java 2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/Plugin.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -8,7 +8,7 @@
import org.jboss.seam.Component;
import org.jboss.seam.wiki.core.exception.InvalidWikiConfigurationException;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.PluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.PluginModule;
import java.util.ArrayList;
import java.util.List;
Copied: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/PluginModule.java (from rev 8261, trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/module/PluginModule.java)
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/PluginModule.java (rev 0)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/PluginModule.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.seam.wiki.core.plugin.metamodel;
+
+import org.jboss.seam.wiki.core.plugin.metamodel.Plugin;
+import org.jboss.seam.wiki.core.exception.InvalidWikiConfigurationException;
+
+import java.util.*;
+
+/**
+ * @author Christian Bauer
+ */
+public abstract class PluginModule {
+
+ private Plugin plugin;
+ private String key;
+ private String label;
+ private String description;
+ private String className;
+ private SortedSet<String> fragmentCacheRegions = new TreeSet<String>();
+
+ protected PluginModule(Plugin plugin, String key) {
+ if (!key.matches(Plugin.KEY_PATTERN))
+ throw new InvalidWikiConfigurationException("Key doesn't match pattern '"+Plugin.KEY_PATTERN+"': " + key);
+
+ this.plugin = plugin;
+ this.key = key;
+ }
+
+ public Plugin getPlugin() {
+ return plugin;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public SortedSet<String> getFragmentCacheRegions() {
+ return fragmentCacheRegions;
+ }
+
+ public List<String> getFragmentCacheRegionsAsList() {
+ return Collections.unmodifiableList(new ArrayList<String>(getFragmentCacheRegions()));
+ }
+
+ public void setFragmentCacheRegions(SortedSet<String> fragmentCacheRegions) {
+ this.fragmentCacheRegions = fragmentCacheRegions;
+ }
+
+ public void addFragmentCacheRegion(String name) {
+ getFragmentCacheRegions().add(getQualifiedCacheRegionName(name));
+ }
+
+ public String getFullyQualifiedKey() {
+ return getPlugin().getKey() + "." + getKey();
+ }
+
+ public String getQualifiedCacheRegionName(String name) {
+ return getFullyQualifiedKey() + "." + name;
+ }
+
+
+}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/UIWikiFormattedText.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/UIWikiFormattedText.java 2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/UIWikiFormattedText.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -14,7 +14,6 @@
import org.jboss.seam.log.Log;
import org.jboss.seam.log.Logging;
import org.jboss.seam.ui.util.JSF;
-import org.jboss.seam.ui.validator.FormattedTextValidator;
import org.jboss.seam.wiki.core.engine.*;
import org.jboss.seam.wiki.core.model.WikiFile;
import org.jboss.seam.wiki.core.model.WikiUploadImage;
@@ -272,7 +271,7 @@
} catch (RecognitionException rex) {
// Log a nice message for any lexer/parser errors, users can disable this if they want to
- log.warn( FormattedTextValidator.getErrorMessage((String) getValue(), rex) );
+ log.warn( WikiFormattedTextValidator.getErrorMessage((String) getValue(), rex) );
} catch (ANTLRException ex) {
// All other errors are fatal;
throw new RuntimeException(ex);
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java 2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -25,7 +25,7 @@
import org.jboss.seam.wiki.core.engine.WikiTextParser;
import org.jboss.seam.wiki.core.plugin.WikiPluginMacro;
import org.jboss.seam.wiki.core.plugin.PluginRegistry;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.MacroPluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.MacroPluginModule;
import org.jboss.seam.wiki.core.renderer.NullWikiTextRenderer;
import org.jboss.seam.wiki.core.model.WikiTextMacro;
import org.ajax4jsf.component.html.HtmlLoadStyle;
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiPluginThemeResource.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiPluginThemeResource.java 2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiPluginThemeResource.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -18,7 +18,7 @@
import org.jboss.seam.wiki.core.plugin.PluginRegistry;
import org.jboss.seam.wiki.core.plugin.WikiPluginMacro;
import org.jboss.seam.wiki.core.plugin.metamodel.Plugin;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.MacroPluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.MacroPluginModule;
import org.jboss.seam.wiki.core.model.WikiTextMacro;
import org.jboss.seam.core.Expressions;
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java 2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -4,9 +4,9 @@
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.wiki.core.engine.WikiFormattedTextValidator;
import org.jboss.seam.international.StatusMessages;
import org.jboss.seam.log.Log;
-import org.jboss.seam.ui.validator.FormattedTextValidator;
import static org.jboss.seam.international.StatusMessage.Severity.WARN;
@@ -30,12 +30,11 @@
public void validate(String textEditorId, String value) {
if (value == null) return;
log.debug("validating value of text editor: " + textEditorId);
- FormattedTextValidator validator = new FormattedTextValidator();
+ WikiFormattedTextValidator validator = new WikiFormattedTextValidator();
try {
validator.validate(null, null, value);
} catch (ValidatorException e) {
log.debug("exception during validation: " + e.getFacesMessage().getSummary());
- // TODO: Needs to use resource bundle, how?
StatusMessages.instance().addToControl(
textEditorId + "TextArea",
WARN,
Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java 2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java 2008-06-02 11:58:44 UTC (rev 8319)
@@ -7,13 +7,13 @@
import org.jboss.seam.core.Events;
import org.jboss.seam.faces.Renderer;
import org.jboss.seam.international.StatusMessages;
-import org.jboss.seam.ui.validator.FormattedTextValidator;
import org.jboss.seam.wiki.core.action.DocumentHome;
import org.jboss.seam.wiki.core.model.WikiDirectory;
import org.jboss.seam.wiki.core.model.WikiDocument;
import org.jboss.seam.wiki.core.model.WikiTextMacro;
import org.jboss.seam.wiki.core.ui.WikiRedirect;
import org.jboss.seam.wiki.core.plugin.PluginRegistry;
+import org.jboss.seam.wiki.core.engine.WikiFormattedTextValidator;
import org.jboss.seam.wiki.preferences.Preferences;
import static org.jboss.seam.international.StatusMessage.Severity.WARN;
@@ -69,11 +69,11 @@
@Override
protected boolean preparePersist() {
- FormattedTextValidator validator = new FormattedTextValidator();
+ // TODO: Why here again?
+ WikiFormattedTextValidator validator = new WikiFormattedTextValidator();
try {
validator.validate(null, null, getInstance().getContent());
} catch (ValidatorException e) {
- // TODO: Needs to use resource bundle, how?
StatusMessages.instance().addToControl(
"topicTextArea",
WARN,
16 years, 6 months