[seam-commits] Seam SVN: r11288 - branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue Jul 14 05:57:47 EDT 2009
Author: manaRH
Date: 2009-07-14 05:57:47 -0400 (Tue, 14 Jul 2009)
New Revision: 11288
Modified:
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Configuration.xml
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Controls.xml
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Dependencies.xml
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Framework.xml
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Getting_Started_With_JBoss_Tools.xml
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Gettingstarted.xml
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Hsearch.xml
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/I18n.xml
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Mail.xml
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Preface.xml
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Tutorial.xml
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Webservices.xml
Log:
JBPAPP-2154 - documentation changes
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Configuration.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Configuration.xml 2009-07-13 21:06:19 UTC (rev 11287)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Configuration.xml 2009-07-14 09:57:47 UTC (rev 11288)
@@ -86,17 +86,6 @@
<param-value>.xhtml</param-value>
</context-param>]]></programlisting>
- <para>
- If you are using facelets in JBoss AS, you'll find that Facelets logging is broken (the log messages
- don't make it to the server log). Seam provides a bridge to fix this, to use it copy
- <literal>lib/interop/jboss-seam-jul.jar</literal> to
- <literal>$JBOSS_HOME/server/default/deploy/jboss-web.deployer/jsf-libs/</literal> and include the
- <literal>jboss-seam-ui.jar</literal> in the <literal>WEB-INF/lib</literal> of your application. The
- Facelets logging catagories are itemized in the <ulink
- url="https://facelets.dev.java.net/nonav/docs/dev/docbook.html#config-logging">Facelets Developer
- Documentation</ulink>.
- </para>
-
</sect2>
<sect2>
@@ -884,110 +873,6 @@
</imageobject>
</mediaobject>
- <para> The booking example application may even be deployed to Tomcat. </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/e-ejb3.png" align="center"/>
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/e-ejb3.png" align="center"/>
- </imageobject>
- </mediaobject>
-
- <sect2 id="config.install.embedded">
- <title>Installing Embedded JBoss</title>
-
-
- <para>
- Embedded JBoss must by installed into Tomcat for Seam applications
- to run correctly on it. Embedded JBoss runs with JDK 5 or JDK 6 (
- see <xref linkend="jdk_dependencies" /> for details on using JDK 6).
- Embedded JBoss can be downloaded
- <ulink url="http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=228977">here</ulink>.
- The process for installing Embedded JBoss into Tomcat 6 is quite
- simple. First, you should copy the Embedded JBoss JARs and
- configuration files into Tomcat.
- </para>
-
- <itemizedlist>
-
- <listitem>
- <para> Copy all files and directories under the Embedded JBoss <literal>bootstrap</literal> and
- <literal>lib</literal> directories, except for the <literal>jndi.properties</literal> file,
- into the Tomcat <literal>lib</literal> directory. </para>
- </listitem>
-
-
- <listitem>
- <para>Remove the <literal>annotations-api.jar</literal> file from the Tomcat <literal>lib</literal>
- directory. </para>
- </listitem>
- </itemizedlist>
-
-
- <para>Next, two configuration files need to be updated to add Embedded JBoss-specific functionality.</para>
-
- <itemizedlist>
-
-
- <listitem>
- <para> Add the Embedded JBoss listener <literal>EmbeddedJBossBootstrapListener</literal> to
- <literal>conf/server.xml</literal>. It must appear after all other listeners in the file:</para>
-
- <programlisting role="XML"><![CDATA[<Server port="8005" shutdown="SHUTDOWN">
-
- <!-- Comment these entries out to disable JMX MBeans support used for the
- administration web application -->
- <Listener className="org.apache.catalina.core.AprLifecycleListener" />
- <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
- <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
- <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener" />]]></programlisting>
- <programlisting role="XML"><![CDATA[ <!-- Add this listener -->
- <Listener className="org.jboss.embedded.tomcat.EmbeddedJBossBootstrapListener" />]]></programlisting>
- </listitem>
-
- <listitem>
- <para>WAR file scanning should be enabled by adding the <literal>WebinfScanner</literal> listener to
- <literal>conf/context.xml</literal>: </para>
-
- <programlisting role="XML"><![CDATA[<Context>
- <!-- Default set of monitored resources -->
- <WatchedResource>WEB-INF/web.xml</WatchedResource>
-
- <!-- Uncomment this to disable session persistence across Tomcat restarts -->
- <!--
- <Manager pathname="" />
- -->]]></programlisting>
- <programlisting role="XML"><![CDATA[ <!-- Add this listener -->
- <Listener className="org.jboss.embedded.tomcat.WebinfScanner" />]]></programlisting>
- <programlisting role="XML"><![CDATA[</Context>]]></programlisting>
- </listitem>
-
- <listitem>
- <para>If you are using Sun JDK 6, you need to set the Java option
- <literal>sun.lang.ClassLoader.allowArraySyntax</literal> to <literal>true</literal> in the
- JAVA_OPTS environment variable used by the Catalina startup script (catalina.bat on Windows or
- catalina.sh on Unix).</para>
-
- <para>Open the script appropriate for your operating system in a text editor. Add a new line
- immediately below the comments at the top of the file where you will define the JAVA_OPTS
- environment variable. On Windows, use the following syntax:</para>
-
- <programlisting><![CDATA[set JAVA_OPTS=%JAVA_OPTS% -Dsun.lang.ClassLoader.allowArraySyntax=true]]></programlisting>
-
- <para>On Unix, use this syntax instead:</para>
-
- <programlisting><![CDATA[JAVA_OPTS="$JAVA_OPTS -Dsun.lang.ClassLoader.allowArraySyntax=true"]]></programlisting>
-
- </listitem>
- </itemizedlist>
-
- <para>For more configuration options, please see the Embedded JBoss Tomcat integration
- <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=EmbeddedAndTomcat">wiki entry</ulink>.</para>
-
- </sect2>
-
<sect2>
<title>Packaging</title>
@@ -1091,7 +976,7 @@
jboss-seam.jar
lib/
jboss-el.jar
- jbpm-3.1.jar
+ jbpm-jpdl.jar
META-INF/
MANIFEST.MF
application.xml
@@ -1165,8 +1050,7 @@
</container-cache-conf>]]></programlisting>
<para> The default HTTP session timeout can be modified in
- <literal>server/default/deploy/jbossweb-tomcat55.sar/conf/web.xml</literal> for JBoss 4.0.x, or in
- <literal>server/default/deploy/jboss-web.deployer/conf/web.xml</literal> for JBoss 4.2.x or later. The following
+ <literal>server/default/deploy/jboss-web.deployer/conf/web.xml</literal> for JBoss 4.2.x or later. The following
entry in this file controls the default session timeout for all web applications: </para>
<programlisting role="XML"><![CDATA[<session-config>
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Controls.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Controls.xml 2009-07-13 21:06:19 UTC (rev 11287)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Controls.xml 2009-07-14 09:57:47 UTC (rev 11288)
@@ -7,7 +7,7 @@
Seam includes a number of JSF controls that are useful for working with
Seam. These are intended to complement the built-in JSF controls, and
controls from other third-party libraries. We recommend
- JBoss RichFaces, ICEsoft ICEfaces and Apache MyFaces Trinidad tag libraries for use with Seam.
+ JBoss RichFaces and Apache MyFaces Trinidad tag libraries for use with Seam.
We do not recommend the use of the Tomahawk tag library.
</para>
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Dependencies.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Dependencies.xml 2009-07-13 21:06:19 UTC (rev 11287)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Dependencies.xml 2009-07-14 09:57:47 UTC (rev 11288)
@@ -163,21 +163,6 @@
<para>Required when using Seam's <trademark class="registered">Microsoft</trademark> <trademark class="registered">Excel</trademark> features</para>
</entry>
</row>
-
- <row>
- <entry>
- <para><literal>jboss-seam-rss.jar</literal></para>
- </entry>
- <entry align="center">
- <para>runtime</para>
- </entry>
- <entry align="center">
- <para>war</para>
- </entry>
- <entry>
- <para>Required when using Seam's RSS generation features</para>
- </entry>
- </row>
<row>
<entry>
@@ -256,7 +241,7 @@
<row>
<entry>
- <para><literal>urlrewrite.jar</literal></para>
+ <para><literal>urlrewritefilter.jar</literal></para>
</entry>
<entry align="center">
<para>runtime</para>
@@ -634,11 +619,15 @@
</table>
</section>
- <section id="dependencies.rss">
- <title>Seam RSS support</title>
-
+ <section>
+ <title>JBoss Rules</title>
+
+ <para>
+ The JBoss Rules libraries can be found in the <literal>drools/lib</literal> directory in Seam.
+ </para>
+
<table>
- <title>Seam RSS Dependencies</title>
+ <title>JBoss Rules Dependencies</title>
<tgroup cols="4">
<colspec colnum="1" colwidth="4*" />
@@ -652,10 +641,10 @@
<para>Name</para>
</entry>
<entry align="center">
- <para>Type</para>
+ <para>Scope</para>
</entry>
<entry align="center">
- <para>Scope</para>
+ <para>Type</para>
</entry>
<entry align="center">
<para>Notes</para>
@@ -667,168 +656,67 @@
<row>
<entry>
- <para><literal>yarfraw.jar</literal></para>
+ <para><literal>antlr-runtime.jar</literal></para>
</entry>
<entry align="center">
<para>runtime</para>
</entry>
<entry align="center">
- <para>war</para>
+ <para>ear</para>
</entry>
<entry>
- <para>YARFRAW RSS library</para>
+ <para>ANTLR Runtime Library</para>
</entry>
</row>
-
+
<row>
<entry>
- <para><literal>JAXB</literal></para>
+ <para><literal>core.jar</literal></para>
</entry>
<entry align="center">
<para>runtime</para>
</entry>
<entry align="center">
- <para>war</para>
+ <para>ear</para>
</entry>
<entry>
- <para>JAXB XML parsing libraries</para>
+ <para>Eclipse JDT</para>
</entry>
- </row>
-
+ </row>
+
<row>
<entry>
- <para><literal>http-client.jar</literal></para>
+ <para><literal>drools-api.jar</literal></para>
</entry>
<entry align="center">
<para>runtime</para>
</entry>
<entry align="center">
- <para>war</para>
+ <para>ear</para>
</entry>
<entry>
- <para>Apache HTTP Client libraies</para>
+ <para></para>
</entry>
</row>
-
- <row>
- <entry>
- <para><literal>commons-io</literal></para>
- </entry>
- <entry align="center">
- <para>runtime</para>
- </entry>
- <entry align="center">
- <para>war</para>
- </entry>
- <entry>
- <para>Apache commons IO library</para>
- </entry>
- </row>
-
- <row>
- <entry>
- <para><literal>commons-lang</literal></para>
- </entry>
- <entry align="center">
- <para>runtime</para>
- </entry>
- <entry align="center">
- <para>war</para>
- </entry>
- <entry>
- <para>Apache commons lang library</para>
- </entry>
- </row>
-
- <row>
- <entry>
- <para><literal>commons-codec</literal></para>
- </entry>
- <entry align="center">
- <para>runtime</para>
- </entry>
- <entry align="center">
- <para>war</para>
- </entry>
- <entry>
- <para>Apache commons codec library</para>
- </entry>
- </row>
-
- <row>
- <entry>
- <para><literal>commons-collections</literal></para>
- </entry>
- <entry align="center">
- <para>runtime</para>
- </entry>
- <entry align="center">
- <para>war</para>
- </entry>
- <entry>
- <para>Apache commons collections library</para>
- </entry>
- </row>
<row>
<entry>
- <para><literal>jboss-seam-rss.jar</literal></para>
+ <para><literal>drools-compiler.jar</literal></para>
</entry>
<entry align="center">
<para>runtime</para>
</entry>
<entry align="center">
- <para>war</para>
+ <para>ear</para>
</entry>
<entry>
- <para>Seam RSS core library</para>
+ <para></para>
</entry>
- </row>
+ </row>
- </tbody>
- </tgroup>
- </table>
- </section>
-
-
- <section>
- <title>JBoss Rules</title>
-
- <para>
- The JBoss Rules libraries can be found in the <literal>drools/lib</literal> directory in Seam.
- </para>
-
- <table>
- <title>JBoss Rules Dependencies</title>
-
- <tgroup cols="4">
- <colspec colnum="1" colwidth="4*" />
- <colspec colnum="2" colwidth="2*" />
- <colspec colnum="3" colwidth="3*" />
- <colspec colnum="4" colwidth="5*" />
-
- <thead>
<row>
- <entry align="center">
- <para>Name</para>
- </entry>
- <entry align="center">
- <para>Scope</para>
- </entry>
- <entry align="center">
- <para>Type</para>
- </entry>
- <entry align="center">
- <para>Notes</para>
- </entry>
- </row>
- </thead>
-
- <tbody>
-
- <row>
<entry>
- <para><literal>antlr-runtime.jar</literal></para>
+ <para><literal>drools-core.jar</literal></para>
</entry>
<entry align="center">
<para>runtime</para>
@@ -837,13 +725,13 @@
<para>ear</para>
</entry>
<entry>
- <para>ANTLR Runtime Library</para>
+ <para></para>
</entry>
</row>
<row>
<entry>
- <para><literal>core.jar</literal></para>
+ <para><literal>drools-decisiontables.jar</literal></para>
</entry>
<entry align="center">
<para>runtime</para>
@@ -852,28 +740,13 @@
<para>ear</para>
</entry>
<entry>
- <para>Eclipse JDT</para>
- </entry>
- </row>
-
- <row>
- <entry>
- <para><literal>drools-compiler.jar</literal></para>
- </entry>
- <entry align="center">
- <para>runtime</para>
- </entry>
- <entry align="center">
- <para>ear</para>
- </entry>
- <entry>
<para></para>
</entry>
- </row>
+ </row>
<row>
<entry>
- <para><literal>drools-core.jar</literal></para>
+ <para><literal>drools-templates.jar</literal></para>
</entry>
<entry align="center">
<para>runtime</para>
@@ -903,7 +776,7 @@
<row>
<entry>
- <para><literal>mvel.jar</literal></para>
+ <para><literal>mvel2.jar</literal></para>
</entry>
<entry align="center">
<para>runtime</para>
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Framework.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Framework.xml 2009-07-13 21:06:19 UTC (rev 11287)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Framework.xml 2009-07-14 09:57:47 UTC (rev 11288)
@@ -76,8 +76,7 @@
<para>
A second advantage is that your classes may be EJB stateful
session beans, if you like. (They do not have to be, they
- can be plain JavaBean components if you prefer.) If you are using
- JBoss AS, you'll need 4.2.2.GA or later:
+ can be plain JavaBean components if you prefer.)
</para>
<programlisting role="JAVA"><![CDATA[@Stateful
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Getting_Started_With_JBoss_Tools.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Getting_Started_With_JBoss_Tools.xml 2009-07-13 21:06:19 UTC (rev 11287)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Getting_Started_With_JBoss_Tools.xml 2009-07-14 09:57:47 UTC (rev 11288)
@@ -27,7 +27,7 @@
<title>Before you start</title>
<para>
- Make sure you have JDK 5, JBoss AS 4.2 or 5.0, Eclipse 3.3, the JBoss
+ Make sure you have JDK 5, JBoss EAP 5, Eclipse 3.3, the JBoss
Tools plugins (at least Seam Tools, the Visual Page Editor, jBPM Tools
and JBoss AS Tools) and the TestNG plugin for Eclipse correctly
installed before starting.
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Gettingstarted.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Gettingstarted.xml 2009-07-13 21:06:19 UTC (rev 11287)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Gettingstarted.xml 2009-07-14 09:57:47 UTC (rev 11288)
@@ -11,8 +11,7 @@
yourself trapped in an elevator with one of those tedious Ruby guys ranting about how great and wonderful his
new toy is for building totally trivial applications that put things in databases.</para>
- <para>In this release, seam-gen works best for people with JBoss AS. You can use the generated project with other
- J2EE or Java EE 5 application servers by making a few manual changes to the project configuration.</para>
+ <para>In this release, seam-gen works best for people with JBoss EAP.</para>
<para>You <emphasis>can</emphasis> use seam-gen without Eclipse, but in this tutorial, we want to show you how to
use it in conjunction with Eclipse for debugging and integration testing. If you don't want to install Eclipse,
@@ -25,7 +24,7 @@
<title>Before you start</title>
<para>Make sure you have JDK 5 or JDK 6 (see <xref
- linkend="jdk_dependencies"/> for details), JBoss AS 4.2 or 5.0 and Ant 1.7.0, along with recent versions of
+ linkend="jdk_dependencies"/> for details), JBoss EAP 5 and Ant 1.7.0, along with recent versions of
Eclipse, the JBoss IDE plugin for Eclipse and the TestNG plugin for Eclipse correctly installed before
starting. Add your JBoss installation to the JBoss Server View in Eclipse. Start JBoss in debug mode.
Finally, start a command prompt in the directory where you unzipped the Seam distribution.</para>
@@ -55,12 +54,12 @@
<para>The first thing we need to do is configure seam-gen for your environment: JBoss AS installation directory,
project workspace, and database connection. It's easy, just type:</para>
- <programlisting>cd jboss-seam-2.0.x
+ <programlisting>cd <seam_distribution_dir>
seam setup</programlisting>
<para>And you will be prompted for the needed information:</para>
- <programlisting>~/workspace/jboss-seam$ ./seam setup
+ <programlisting><seam_distribution_dir>$ ./seam setup
Buildfile: build.xml
init:
@@ -70,7 +69,7 @@
[input] Enter your project workspace (the directory that contains your Seam projects) [C:/Projects] [C:/Projects]
/Users/pmuir/workspace
[input] Enter your JBoss home directory [C:/Program Files/jboss-4.2.3.GA] [C:/Program Files/jboss-4.2.3.GA]
-/Applications/jboss-4.2.3.GA
+/var/lib/jbossas
[input] Enter the project name [myproject] [myproject]
helloworld
[echo] Accepted project name as: helloworld
@@ -89,7 +88,7 @@
[input] Enter the Hibernate dialect for your database [org.hibernate.dialect.MySQLDialect] [org.hibernate.dialect.MySQLDialect]
[input] Enter the filesystem path to the JDBC driver jar [lib/hsqldb.jar] [lib/hsqldb.jar]
-/Users/pmuir/java/mysql.jar
+/usr/share/java/mysql.jar
[input] Enter JDBC driver class for your database [com.mysql.jdbc.Driver] [com.mysql.jdbc.Driver]
[input] Enter the JDBC URL for your database [jdbc:mysql:///test] [jdbc:mysql:///test]
@@ -134,7 +133,7 @@
<programlisting>seam new-project</programlisting>
- <programlisting>C:\Projects\jboss-seam>seam new-project
+ <programlisting><seam_distribution_dir> seam new-project
Buildfile: build.xml
...
@@ -407,41 +406,4 @@
incremental hot deployment for EAR projects.</para>
</section>
- <section>
- <title>Using Seam with JBoss 4.0</title>
-
- <para> Seam 2.0 was developed for JavaServer Faces 1.2. When using JBoss AS, we recommend using JBoss 4.2 or
- JBoss 5.0, both of which bundle the JSF 1.2 reference implementation. However, it is still possible to use
- Seam 2.0 on the JBoss 4.0 platform. There are two basic steps required to do this: install an EJB3-enabled
- version of JBoss 4.0 and replace MyFaces with the JSF 1.2 reference implementation. Once you complete these
- steps, Seam 2.0 applications can be deployed to JBoss 4.0.</para>
-
- <section>
- <title>Install JBoss 4.0</title>
- <para>JBoss 4.0 does not ship a default configuration compatible with Seam. To run Seam, you must install
- JBoss 4.0.5 using the JEMS 1.2 installer with the ejb3 profile selected. Seam will not run with an
- installation that doesn't include EJB3 support. The JEMS installer can be downloaded from <ulink
- url="http://labs.jboss.com/jemsinstaller/downloads"
- >http://labs.jboss.com/jemsinstaller/downloads</ulink>. </para>
- </section>
-
- <section>
- <title>Install the JSF 1.2 RI</title>
-
- <para> The web configuration for JBoss 4.0 can be found in the
- <literal>server/default/deploy/jbossweb-tomcat55.sar</literal>. You'll need to delete
- <literal>myfaces-api.jar</literal> any <literal>myfaces-impl.jar</literal> from the
- <literal>jsf-libs </literal>directory. Then, you'll need to copy <literal>jsf-api.jar</literal>,
- <literal>jsf-impl.jar</literal>, <literal>el-api.jar</literal>, and <literal>el-ri.jar</literal>
- to that directory. The JSF JARs can be found in the Seam <literal>lib</literal> directory. The el JARs
- can be obtained from the Seam 1.2 release. </para>
-
- <para>You'll also need to edit the <literal>conf/web.xml</literal>, replacing
- <literal>myfaces-impl.jar</literal> with <literal>jsf-impl.jar</literal>. </para>
- </section>
-
-
-
- </section>
-
</chapter>
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Hsearch.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Hsearch.xml 2009-07-13 21:06:19 UTC (rev 11287)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Hsearch.xml 2009-07-14 09:57:47 UTC (rev 11288)
@@ -53,34 +53,8 @@
</properties>
</persistence-unit>]]></programlisting>
- <para>If you plan to target Hibernate Annotations or EntityManager 3.2.x
- (embedded into JBoss AS 4.2.x and later), you also need to configure the
- appropriate event listeners.</para>
-
- <programlisting role="XML"><![CDATA[<persistence-unit name="sample">
- <jta-data-source>java:/DefaultDS</jta-data-source>
- <properties>
- [...]
- <!-- use a file system based index -->
- <property name="hibernate.search.default.directory_provider"
- value="org.hibernate.search.store.FSDirectoryProvider"/>
- <!-- directory where the indexes will be stored -->
- <property name="hibernate.search.default.indexBase"
- value="/Users/prod/apps/dvdstore/dvdindexes"/>
-
- <property name="hibernate.ejb.event.post-insert"
- value="org.hibernate.search.event.FullTextIndexEventListener"/>
- <property name="hibernate.ejb.event.post-update"
- value="org.hibernate.search.event.FullTextIndexEventListener"/>
- <property name="hibernate.ejb.event.post-delete"
- value="org.hibernate.search.event.FullTextIndexEventListener"/>
-
- </properties>
-</persistence-unit>]]></programlisting>
-
- <note>
- <para>It is not longer necessary the register the event listeners if
- Hibernate Annotations or EntityManager 3.3.x are used.
+ <note>
+ <para>
When using Hibernate Search 3.1.x more eventlisteners are needed, but
these are registered automatically by Hibernate Annotations; refer
to the Hibernate Search reference for configuring it without
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/I18n.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/I18n.xml 2009-07-13 21:06:19 UTC (rev 11287)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/I18n.xml 2009-07-14 09:57:47 UTC (rev 11288)
@@ -31,9 +31,9 @@
<para>
To ensure that the application server receives the request
parameters in the correct encoding from client requests you have to
- configure the tomcat connector. If you use Tomcat or JBoss AS, add
+ configure the tomcat connector. Add
the <literal>URIEncoding="UTF-8"</literal> attribute to the
- connector configuration. For JBoss AS 4.2 change
+ connector configuration in
<literal>${JBOSS_HOME}/server/(default)/deploy/jboss-web.deployer/server.xml</literal>:
</para>
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Mail.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Mail.xml 2009-07-13 21:06:19 UTC (rev 11287)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Mail.xml 2009-07-14 09:57:47 UTC (rev 11288)
@@ -469,30 +469,6 @@
</section>
</section>
- <section>
- <title>Meldware</title>
-
- <para>
- Seam's mail examples use Meldware (from <ulink url="http://buni.org">buni.org</ulink>)
- as a mail server. Meldware is a groupware package that provides
- <literal>SMTP</literal>, <literal>POP3</literal>, <literal>IMAP</literal>,
- webmail, a shared calendar and an graphical admin tool; it's written as a
- JEE application so can be deployed onto JBoss AS alongside your Seam
- application.
- </para>
-
- <caution>
- <para>
- The version of Meldware distributed with Seam (downloaded on demand)
- is specially tailored for development - mailboxes, users and
- aliases (email addresses) are created every time the application
- deploys. If you want to use Meldware in production you should install
- the latest release from <ulink url="http://buni.org">buni.org</ulink>.
- </para>
- </caution>
-
- </section>
-
<section id="mail.tags">
<title>Tags</title>
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Preface.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Preface.xml 2009-07-13 21:06:19 UTC (rev 11287)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Preface.xml 2009-07-14 09:57:47 UTC (rev 11288)
@@ -79,9 +79,9 @@
<term><emphasis>Integrated AJAX</emphasis></term>
<listitem>
<para>
- Seam supports the best open source JSF-based AJAX solutions: JBoss RichFaces and
- ICEfaces. These solutions let you add AJAX capability to your user interface without
- the need to write any JavaScript code.
+ Seam supports the best open source JSF-based AJAX solution - JBoss
+ RichFaces. These solutions let you add AJAX capability to your user
+ interface without the need to write any JavaScript code.
</para>
<para>
Alternatively, Seam provides a built-in JavaScript remoting layer that lets you call
@@ -264,17 +264,6 @@
</listitem>
</varlistentry>
- <varlistentry>
- <term><emphasis>Get started now!</emphasis></term>
- <listitem>
- <para>
- Seam works in any Java EE application server, and even works in Tomcat. If your environment
- supports EJB 3.0, great! If it doesn't, no problem, you can use Seam's built-in transaction
- management with JPA or Hibernate3 for persistence. Or, you can deploy JBoss Embedded in
- Tomcat, and get full support for EJB 3.0.
- </para>
- </listitem>
- </varlistentry>
</variablelist>
<mediaobject>
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Tutorial.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Tutorial.xml 2009-07-13 21:06:19 UTC (rev 11287)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Tutorial.xml 2009-07-14 09:57:47 UTC (rev 11288)
@@ -32,23 +32,20 @@
</itemizedlist>
- <para>
- The example applications run both on JBoss AS and Tomcat with no additional configuration.
- The following sections will explain the procedure in both cases. Note that all the examples
- are built and run from the Ant <filename>build.xml</filename>, so you'll need a recent version
- of Ant installed before you get started.
- </para>
+ <para>
+ Note that all the examples are built and run from the Ant
+ <filename>build.xml</filename>, so you'll need a recent version
+ of Ant installed before you get started.
+ </para>
-
-
<section>
<title>Running the examples on JBoss AS</title>
- <para>The examples are configured for use on JBoss AS 4.2 or 5.0. You'll need to set <literal>jboss.home</literal>,
+ <para>The examples are configured for use on JBoss EAP AS. You'll need to set <literal>jboss.home</literal>,
in the shared <literal>build.properties</literal> file in the root folder of your Seam
installation, to the location of your JBoss AS installation.</para>
- <para>Once you've set the location of JBoss AS and started the application server, you can build and deploy
+ <para>Once you've set the location of JBoss EAP AS and started the application server, you can build and deploy
any example by typing <literal>ant explode</literal> in the the directory for that example. Any example
that is packaged as an EAR deploys to a URL like
<literal>/seam-<replaceable>example</replaceable></literal>, where <replaceable>example</replaceable> is
@@ -60,43 +57,13 @@
<literal>http://localhost:8080/seam-space/</literal></ulink>.</para>
<para>If, on the other hand, the example gets packaged as a WAR, then it deploys to a URL like
- <literal>/jboss-seam-<replaceable>example</replaceable></literal>. Most of the examples can be deployed as a WAR
- to Tomcat with Embedded JBoss by typing <literal>ant tomcat.deploy</literal>. Several of the examples
+ <literal>/jboss-seam-<replaceable>example</replaceable></literal>. Several of the examples
can only be deployed as a WAR. Those examples are groovybooking, hibernate, jpa, and spring.
</para>
</section>
<section>
- <title>Running the examples on Tomcat</title>
-
- <para>The examples are also configured for use on Tomcat 6.0. You will need to follow the
- instructions in <xref linkend="config.install.embedded"/>
- for installing JBoss Embedded on Tomcat 6.0. JBoss Embedded is only required to run the Seam
- demos that use EJB3 components on Tomcat. There are also examples of non-EJB3 applications that
- can be run on Tomcat without the use of JBoss Embedded.
- </para>
- <para>You'll need to
- set <literal>tomcat.home</literal>, in the shared <literal>build.properties</literal> file in
- the root folder of your Seam installation, to the location of your Tomcat installation.
- make sure you set the location of your Tomcat.
- </para>
-
- <para>You'll need to use a different Ant target when using Tomcat. Use
- <literal>ant tomcat.deploy</literal> in example subdirectory to build and deploy
- any example for Tomcat.
- </para>
-
- <para>On Tomcat, the examples deploy to URLs like
- <literal>/jboss-seam-<replaceable>example</replaceable></literal>, so for the registration
- example the URL would be <ulink url="http://localhost:8080/jboss-seam-registration/">
- <literal>http://localhost:8080/jboss-seam-registration/</literal></ulink>. The same is true
- for examples that deploy as a WAR, as mentioned in the previous section.
- </para>
-
- </section>
-
- <section>
<title>Running the example tests</title>
<para>
Most of the examples come with a suite of TestNG integration tests. The easiest way to run the tests is
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Webservices.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Webservices.xml 2009-07-13 21:06:19 UTC (rev 11287)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Webservices.xml 2009-07-14 09:57:47 UTC (rev 11288)
@@ -198,475 +198,4 @@
</sect1>
- <sect1>
- <title>RESTful HTTP webservices with RESTEasy</title>
-
- <para>
- Seam integrates the RESTEasy implementation of the JAX-RS specification (JSR 311). You can decide how
- "deep" the integration into your Seam application is going to be:
- </para>
-
- <itemizedlist>
- <listitem>
- <para>
- Seamless integration of RESTEasy bootstrap and configuration, automatic detection of resources
- and providers.
- </para>
- </listitem>
- <listitem>
- <para>
- Serving HTTP/REST requests with the SeamResourceServlet, no external servlet or configuration in
- web.xml required.
- </para>
- </listitem>
- <listitem>
- <para>
- Writing resources as Seam components, with full Seam lifecycle management and interception (bijection).
- </para>
- </listitem>
- </itemizedlist>
-
- <sect2>
- <title>RESTEasy configuration and request serving</title>
-
- <para>
- First, get the RESTEasy libraries and the <literal>jaxrs-api.jar</literal>, deploy them with the
- other libraries of your application. Also deploy the integration library,
- <literal>jboss-seam-resteasy.jar</literal>.
- </para>
-
- <para>
- On startup, all classes annotated <literal>@javax.ws.rs.Path</literal> will be discovered automatically
- and registered as HTTP resources. Seam automatically accepts and serves HTTP requests with its built-in
- <literal>SeamResourceServlet</literal>. The URI of a resource is build as follows:
- </para>
-
- <itemizedlist>
- <listitem>
- <para>
- The URI starts with the pattern mapped in <literal>web.xml</literal> for the
- <literal>SeamResourceServlet</literal>, e.g <literal>/seam/resource</literal> if you follow
- the common examples. Change this setting to expose your RESTful resources under a different base.
- Note that this is a global change and other Seam resources (e.g. <literal>s:graphicImage</literal>)
- are then also served under that base path.
- </para>
- </listitem>
- <listitem>
- <para>
- The RESTEasy integration for Seam then appends a configurable string to the base path, by default
- this is <literal>/rest</literal>. Hence, the full base path of your resources would e.g. be
- <literal>/seam/resource/rest</literal>. We recommend that you change this string in your application,
- you could for example add a version number to prepare for a future REST API upgrade of your services
- (old clients would keep the old URI base): <literal>/seam/resource/restv1</literal>.
- </para>
- </listitem>
- <listitem>
- <para>
- Finally, the actual resource is available under the defined <literal>@Path</literal>, e.g. a resource
- mapped with <literal>@Path("/customer")</literal> would be available under
- <literal>/seam/resource/rest/customer</literal>.
- </para>
- </listitem>
- </itemizedlist>
-
- <para>
- As an example, the following resource definition would return a plaintext representation for any
- GET requests using the URI <literal>http://your.hostname/seam/resource/rest/customer/123</literal>:
- </para>
-
- <programlisting role="JAVA"><![CDATA[@Path("/customer")
-public class MyCustomerResource {
-
- @GET
- @Path("/{customerId}")
- @Produces("text/plain")
- public String getCustomer(@PathParam("customerId") int id) {
- return ...;
- }
-
-}]]></programlisting>
-
- <para>
- No additional configuration is required, you do not have to edit <literal>web.xml</literal> or any
- other setting if these defauls are acceptable. However, you can configure RESTEasy in your Seam application.
- First import the <literal>resteasy</literal> namespace into your XML configuration file header:
- </para>
-
- <programlisting role="XML"><![CDATA[<components
- xmlns="http://jboss.com/products/seam/components"
- xmlns:resteasy="http://jboss.com/products/seam/resteasy"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation=
- http://jboss.com/products/seam/resteasy
- http://jboss.com/products/seam/resteasy-2.2.xsd
- http://jboss.com/products/seam/components
- http://jboss.com/products/seam/components-2.2.xsd">]]></programlisting>
-
- <para>
- You can then change the <literal>/rest</literal> prefix as mentioned earlier:
- </para>
-
- <programlisting role="XML"><![CDATA[<resteasy:application resource-path-prefix="/restv1"/>]]></programlisting>
-
- <para>
- The full base path to your resources is now <literal>/seam/resource/restv1/{resource}</literal> - note
- that your <literal>@Path</literal> definitions and mappings do NOT change. This is an application-wide
- switch usually used for versioning of the HTTP API.
- </para>
-
- <para>
- You can disable stripping of the base path if you'd like to map the full path in your resources:
- </para>
-
- <programlisting role="XML"><![CDATA[<resteasy:application strip-seam-resource-path="false"/>]]></programlisting>
-
- <para>
- The path of a resource is now mapped with e.g.
- <literal>@Path("/seam/resource/rest/customer")</literal>. We do not recommend disabling this feature,
- as your resource class mappings are then bound to a particular deployment scenario.
- </para>
-
- <para>
- Seam will scan your classpath for any deployed <literal>@javax.ws.rs.Path</literal> resources and any
- <literal>@javax.ws.rs.ext.Provider</literal> classes. You can disable scanning and configure these
- classes manually:
- </para>
-
- <programlisting role="XML"><![CDATA[<resteasy:application
- scan-providers="false"
- scan-resources="false"
- use-builtin-providers="true">
-
- <resteasy:resource-class-names>
- <value>org.foo.MyCustomerResource</value>
- <value>org.foo.MyOrderResource</value>
- <value>org.foo.MyStatelessEJBImplementation</value>
- </resteasy:resource-class-names>
-
- <resteasy:provider-class-names>
- <value>org.foo.MyFancyProvider</value>
- </resteasy:provider-class-names>
-
- </resteasy:application>]]></programlisting>
-
- <para>
- The <literal>use-built-in-providers</literal> switch enables (default) or disables the RESTEasy built-in
- providers. We recommend you leave them enabled, as they provide plaintext, JSON, and JAXB marshalling
- out of the box.
- </para>
-
- <para>
- RESTEasy supports plain EJBs (EJBs that are not Seam components) as resources. Instead of configuring the
- JNDI names in a non-portable fashion in <literal>web.xml</literal> (see RESTEasy documentation), you can
- simply list the EJB implementation classes, not the business interfaces, in <literal>components.xml</literal>
- as shown above. Note that you have to annotate the <literal>@Local</literal> interface of the EJB with
- <literal>@Path</literal>, <literal>@GET</literal>, and so on - not the bean implementation class. This allows
- you to keep your application deployment-portable with the global Seam <literal>jndi-pattern</literal> switch
- on <literal><core:init/></literal>. Note that EJB resources will not be found even if scanning of
- resources is enabled, you always have to list them manually. Again, this is only relevant for EJB resources
- that are not also Seam components and that do not have a <literal>@Name</literal> annotation.
- </para>
-
- <para>
- Finally, you can configure media type and language URI extensions:
- </para>
-
- <programlisting role="XML"><![CDATA[<resteasy:application>
-
- <resteasy:media-type-mappings>
- <key>txt</key><value>text/plain</value>
- </resteasy:media-type-mappings>
-
- <resteasy:language-mappings>
- <key>deutsch</key><value>de-DE</value>
- </resteasy:language-mappings>
-
-</resteasy:application>]]></programlisting>
-
- <para>
- This definition would map the URI suffix of <literal>.txt.deutsch</literal> to
- additional <literal>Accept</literal> and <literal>Accept-Language</literal> header values
- <literal>text/plain</literal> and <literal>de-DE</literal>.
- </para>
-
- </sect2>
-
- <sect2>
- <title>Resources and providers as Seam components</title>
-
- <para>
- Any resource and provider instances are managed by RESTEasy by default. That means a resource class
- will be instantiated by RESTEasy and serve a single request, after which it will be destroyed. This is
- the default JAX-RS lifecycle. Providers are instantiated once for the whole application and are
- effectively singletons and supposed to be stateless.
- </para>
-
- <para>
- You can write resources and providers as Seam components and benefit from the richer lifecycle management
- of Seam, and interception for bijection, security, and so on. Simply make your resource class a
- Seam component:
- </para>
-
- <programlisting role="JAVA"><![CDATA[@Name("customerResource")
- at Path("/customer")
-public class MyCustomerResource {
-
- @In
- CustomerDAO customerDAO;
-
- @GET
- @Path("/{customerId}")
- @Produces("text/plain")
- public String getCustomer(@PathParam("customerId") int id) {
- return customerDAO.find(id).getName();
- }
-
-}]]></programlisting>
-
- <para>
- An instance of <literal>customerResource</literal> is now handled by Seam when a request hits the
- server. This is a Seam JavaBean component that is <literal>EVENT</literal>-scoped, hence no different
- than the default JAX-RS lifecycle. You get full Seam injection and interception support, and all other Seam
- components and contexts are available to you. Currently also supported are <literal>APPLICATION</literal>
- and <literal>STATELESS</literal> resource Seam components. These three scopes allow you to create an effectively
- stateless Seam middle-tier HTTP request-processing application.
- </para>
-
- <para>
- You can annotate an interface and keep the implementation free from JAX-RS annotations:
- </para>
-
- <programlisting role="JAVA"><![CDATA[@Path("/customer")
-public interface MyCustomerResource {
-
- @GET
- @Path("/{customerId}")
- @Produces("text/plain")
- public String getCustomer(@PathParam("customerId") int id);
-
-}]]></programlisting>
-
- <programlisting role="JAVA"><![CDATA[@Name("customerResource")
- at Scope(ScopeType.STATELESS)
-public class MyCustomerResourceBean implements MyCustomerResource {
-
- @In
- CustomerDAO customerDAO;
-
- public String getCustomer(int id) {
- return customerDAO.find(id).getName();
- }
-
-}]]></programlisting>
-
- <para>
- You can use <literal>SESSION</literal>-scoped Seam components. By default, the session will however be shortened
- to a single request. In other words, when an HTTP request is being processed by the RESTEasy integration code,
- an HTTP session will be created so that Seam components can utilize that context. When the request has
- been processed, Seam will look at the session and decide if the session was created only to serve that
- single request (no session identifier has been provided with the request, or no session existed for the request).
- If the session has been created only to serve this request, the session will be destroyed after the request!
- </para>
-
- <para>
- Assuming that your Seam application only uses event, application, or stateless components, this procedure
- prevents exhaustion of available HTTP sessions on the server. The RESTEasy integration with Seam assumes
- by default that sessions are not used, hence anemic sessions would add up as every REST request would start
- a session that will only be removed when timed out.
- </para>
-
- <para>
- If your RESTful Seam application has to preserve session state across REST HTTP requests, disable this
- behavior in your configuration file:
- </para>
-
- <programlisting role="XML"><![CDATA[<resteasy:application destroy-session-after-request="false"/>]]></programlisting>
-
- <para>
- Every REST HTTP request will now create a new session that will only be removed by timeout or explicit
- invalidation in your code through <literal>Session.instance().invalidate()</literal>.
- It is your responsibility to pass a valid session identifier along with your HTTP requests, if you want
- to utilize the session context across requests.
- </para>
-
- <para>
- <literal>CONVERSATION</literal>-scoped resource components and mapping of conversations to temporary HTTP
- resources and paths is planned but currently not supported.
- </para>
-
- <para>
- EJB Seam components are supported. Always annotate the local business interface, not the EJB implementation
- class, with JAX-RS annotations. The EJB has to be <literal>STATELESS</literal>.
- </para>
-
- <para>
- Provider classes can also be Seam components, only <literal>APPLICATION</literal>-scoped
- provider components are supported. You can annotate the bean interface or implementation with JAX-RS annotations.
- EJB Seam components as providers are currently <emphasis>NOT</emphasis> supported, only POJOs!
- </para>
-
- </sect2>
-
- <sect2>
- <title>Securing resources</title>
-
- <para>
- You can enable the Seam authentication filter for HTTP Basic and Digest authentication in
- <literal>components.xml</literal>:
- </para>
-
- <programlisting role="XML"><![CDATA[<web:authentication-filter url-pattern="/seam/resource/rest/*" auth-type="basic"/>]]></programlisting>
-
- <para>
- See the Seam security chapter on how to write an authentication routine.
- </para>
-
- <para>
- After successful authentication, authorization rules with the common
- <literal>@Restrict</literal> and <literal>@PermissionCheck</literal> annotations are in effect. You can
- also access the client <literal>Identity</literal>, work with permission mapping, and so on. All
- regular Seam security features for authorization are available.
- </para>
-
- </sect2>
-
- <sect2>
- <title>Mapping exceptions to HTTP responses</title>
-
- <para>
- Section 3.3.4 of the JAX-RS specification defines how checked or unchecked exceptions are handled by the
- JAX RS implementation. In addition to using an exception mapping provider as defined by JAX-RS, the integration
- of RESTEasy with Seam allows you to map exceptions to HTTP response codes within Seam's <literal>pages.xml</literal>
- facility. If you are already using <literal>pages.xml</literal> declarations, this is easier to maintain than
- potentially many JAX RS exception mapper classes.
- </para>
-
- <para>
- Exception handling within Seam requires that the Seam filter is executed for your HTTP request. Ensure that
- you do filter <emphasis>all</emphasis> requests in your <literal>web.xml</literal>, not - as
- some Seam examples might show - a request URI pattern that doesn't cover your REST request paths.
- The following example intercepts <emphasis>all</emphasis> HTTP requests and enables Seam exception handling:
- </para>
-
- <programlisting role="XML"><![CDATA[<filter>
- <filter-name>Seam Filter</filter-name>
- <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
-</filter>
-
-<filter-mapping>
- <filter-name>Seam Filter</filter-name>
- <url-pattern>/*</url-pattern>
-</filter-mapping>]]></programlisting>
-
- <para>
- To convert the unchecked <literal>UnsupportedOperationException</literal> thrown by your resource
- methods to a <literal>501 Not Implemented</literal> HTTP status response, add the following to your
- <literal>pages.xml</literal> descriptor:
- </para>
-
- <programlisting role="XML"><![CDATA[<exception class="java.lang.UnsupportedOperationException">
- <http-error error-code="501">
- <message>The requested operation is not supported</message>
- </http-error>
-</exception>]]></programlisting>
-
- <para>
- Custom or checked exceptions are handled the same:
- </para>
-
- <programlisting role="XML"><![CDATA[<exception class="my.CustomException" log="false">
- <http-error error-code="503">
- <message>Service not available: #{org.jboss.seam.handledException.message}</message>
- </http-error>
-</exception>]]></programlisting>
-
- <para>
- You do not have to send an HTTP error to the client if an exception occurs. Seam allows you to map the
- exception as a redirect to a view of your Seam application. As this feature is typically used for human
- clients (web browsers) and not for REST API remote clients, you should pay extra attention to conflicting
- exception mappings in <literal>pages.xml</literal>.
- </para>
-
- <para>
- Note that the HTTP response still passes through the servlet container, so an additional mapping might apply
- if you have <literal><error-page></literal> mappings in your <literal>web.xml</literal> configuration.
- The HTTP status code would then be mapped to a rendered HTML error page with status <literal>200 OK</literal>!
- </para>
-
- </sect2>
-
- <sect2>
- <title>Testing resources and providers</title>
-
- <para>
- Seam includes a unit testing utility class that helps you create unit tests for a RESTful
- architecture. Extend the <literal>SeamTest</literal> class as usual and use the
- <literal>ResourceRequestEnvironment.ResourceRequest</literal> to emulate HTTP requests/response cycles:
- </para>
-
- <programlisting role="JAVA"><![CDATA[import org.jboss.seam.mock.ResourceRequestEnvironment;
-import org.jboss.seam.mock.EnhancedMockHttpServletRequest;
-import org.jboss.seam.mock.EnhancedMockHttpServletResponse;
-import static org.jboss.seam.mock.ResourceRequestEnvironment.ResourceRequest;
-import static org.jboss.seam.mock.ResourceRequestEnvironment.Method;
-
-public class MyTest extends SeamTest {
-
- ResourceRequestEnvironment sharedEnvironment;
-
- @BeforeClass
- public void prepareSharedEnvironment() throws Exception {
- sharedEnvironment = new ResourceRequestEnvironment(this) {
- @Override
- public Map<String, Object> getDefaultHeaders() {
- return new HashMap<String, Object>() {{
- put("Accept", "text/plain");
- }};
- }
- };
- }
-
- @Test
- public void test() throws Exception
- {
- //Not shared: new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, "/my/relative/uri)
-
- new ResourceRequest(sharedEnvironment, Method.GET, "/my/relative/uri)
- {
- @Override
- protected void prepareRequest(EnhancedMockHttpServletRequest request)
- {
- request.addQueryParameter("foo", "123");
- request.addHeader("Accept-Language", "en_US, de");
- }
-
- @Override
- protected void onResponse(EnhancedMockHttpServletResponse response)
- {
- assert response.getStatus() == 200;
- assert response.getContentAsString().equals("foobar");
- }
-
- }.run();
- }
-}]]></programlisting>
-
- <para>
- This test only executes local calls, it does not communicate with the <literal>SeamResourceServlet</literal>
- through TCP. The mock request is passed through the Seam servlet and filters and the response is then
- available for test assertions. Overriding the <literal>getDefaultHeaders()</literal> method in a shared
- instance of <literal>ResourceRequestEnvironment</literal> allows you to set request headers for every
- test method in the test class.
- </para>
-
- <para>
- Note that a <literal>ResourceRequest</literal> has to be executed in a <literal>@Test</literal> method
- or in a <literal>@BeforeMethod</literal> callback. You can not execute it in any other callback,
- such as <literal>@BeforeClass</literal>.
- </para>
-
- </sect2>
-
- </sect1>
-
</chapter>
More information about the seam-commits
mailing list