Skip to content

Commit 8be7299

Browse files
committed
Documentation of the new development mode
1 parent 242727c commit 8be7299

3 files changed

Lines changed: 83 additions & 1 deletion

File tree

‎CHANGELOG.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
Features & Enhancements:
66
* Support of query parameter and action inheritance (#75)
7+
* Development mode can now be enabled by setting the context parameter 'com.ocpsoft.pretty.DEVELOPMENT'
78

89
Bugfixes:
910
* Implemented equals()/hashcode() for LazyExpression (#115)
@@ -13,6 +14,7 @@ Bugfixes:
1314
* Fixed decoding of quotation mark character. Thanks to Bruno Aranda for the patch. (#122)
1415
* Use equals() instead of matches() to compare URL with view-id. Thanks to mbenson for bringing this up.
1516
* Prevent rewrite loops by avoiding nested rewrites for forwarded requests (#121)
17+
* Fixed bug causing CDIBeanNameResolver to don't reload configuration in development mode on JBoss AS7
1618

1719
------------------------------------
1820
VERSION 3.3.0

‎docs/src/main/docbook/en-US/Extensions.xml‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,53 @@
134134

135135
</section>
136136

137+
<section id="DevelopmentModeDetector">
138+
<title>com.ocpsoft.pretty.faces.spi.DevelopmentModeDetector</title>
139+
140+
<para>
141+
If PrettyFaces is executed in development mode, the configuration will be automatically reloaded
142+
every few seconds. This allows the developer to modify the <filename>pretty-config.xml</filename>
143+
and immediately test the changes without restarting the servlet container.
144+
</para>
145+
146+
<para>
147+
The DevelopmentModeDetector SPI allows the user to implement custom strategies to determine whether the application
148+
is in development mode. The following class shows a simple detector which enables the development
149+
mode if the system property <constant>devmode</constant> is set to <constant>true</constant>.
150+
</para>
151+
152+
<programlisting><![CDATA[public class CustomDevelopmentModeDetector implements DevelopmentModeDetector {
153+
154+
public int getPriority() {
155+
return 10;
156+
}
157+
158+
public Boolean isDevelopmentMode(ServletContext servletContext) {
159+
return System.getProperty("devmode", "false").equals("true");
160+
}
161+
162+
}]]></programlisting>
163+
164+
<tip>
165+
<para>
166+
You can give your own implementation a high precedence of the other implementations by giving
167+
it a very low priority.
168+
</para>
169+
</tip>
170+
171+
<para>
172+
To let PrettyFaces know about your custom detector, you'll have to register your
173+
implementation by creating a file named
174+
<code>META-INF/services/com.ocpsoft.pretty.faces.spi.DevelopmentModeDetector</code>
175+
in your classpath and add the fully-qualified class name of your implementation
176+
class there.
177+
</para>
178+
179+
<programlisting>
180+
<filename>META-INF/services/com.ocpsoft.pretty.faces.spi.DevelopmentModeDetector</filename>
181+
com.example.CustomDevelopmentModeDetector
182+
</programlisting>
183+
184+
</section>
185+
137186
</chapter>

‎docs/src/main/docbook/en-US/Get_started.xml‎

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@
135135
136136
</pretty-config>]]></programlisting>
137137
</example>
138-
</section>
139138

140139
<tip>
141140
<para>
@@ -157,4 +156,36 @@
157156
configuration options, framework integration with JavaServer Faces, and
158157
special use-cases.
159158
</para>
159+
160+
</section>
161+
162+
<section id="getstarted.dev_mode">
163+
164+
<title>PrettyFaces Development Mode</title>
165+
166+
<para>
167+
During the development of your application you will typically have to make changes to your
168+
<filename>pretty-config.xml</filename> very often. As server restarts take a lot of time and decrease productivity,
169+
PrettyFaces is capable of reloading its configuration on a regular basis. As the configuration reloading
170+
may be a time consuming process for large applications, PrettyFaces reloads its configuration only
171+
if the application is executed in development mode.
172+
</para>
173+
174+
<para>
175+
To enable the development mode, add the following context parameter to your <filename>web.xml</filename>:
176+
</para>
177+
178+
<programlisting><![CDATA[<context-param>
179+
<param-name>com.ocpsoft.pretty.DEVELOPMENT</param-name>
180+
<param-value>true</param-value>
181+
</context-param>]]></programlisting>
182+
183+
<para>
184+
If your are using the JSF 2.0 version of PrettyFaces, you typically won't have to explicitly enable
185+
the development mode. In this case the development mode is automatically enabled for all project
186+
stages except for <constant>Production</constant>.
187+
</para>
188+
189+
</section>
190+
160191
</chapter>

0 commit comments

Comments
 (0)