http://code.google.com/p/prettyfaces/source/detail?r=466
Added:
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/Navigator.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/dynaview
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/dynaview/DynaviewEngine.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/spi/ELBeanNameResolver.java
/prettyfaces/trunk/core/src/main/resources/META-INF/services/com.ocpsoft.pretty.faces.spi.ELBeanNameResolver
/prettyfaces/trunk/docs/src/main/docbook/en-US/Extensions.xml
/prettyfaces/trunk/docs/src/main/docbook/en-US/config/Parent_mappings.xml
Deleted:
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/DynaviewEngine.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/PrettyNavigator.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/BeanNameResolver.java
/prettyfaces/trunk/core/src/main/resources/META-INF/services/com.ocpsoft.pretty.faces.el.BeanNameResolver
Modified:
/prettyfaces/trunk/CHANGELOG.txt
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/annotation/URLBeanName.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/DigesterPrettyConfigParser.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/PrettyConfigurator.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/AnnotationConfigurationProvider.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/ClassLoaderConfigurationProvider.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/ContextSpecifiedConfigurationProvider.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/DefaultXMLConfigurationProvider.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/ParentingPostProcessor.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/ValidatingPostProcessor.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/LazyBeanNameFinder.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/resolver/CDIBeanNameResolver.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/resolver/FacesConfigBeanNameResolver.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/resolver/SeamBeanNameResolver.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/resolver/SpringBeanNameResolver.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/spi/ConfigurationPostProcessor.java
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/spi/ConfigurationProvider.java
/prettyfaces/trunk/core/src/main/resources/META-INF/ocpsoft-pretty-faces-3.1.1.xsd
/prettyfaces/trunk/core/src/main/resources/META-INF/services/com.ocpsoft.pretty.faces.spi.ConfigurationPostProcessor
/prettyfaces/trunk/core/src/test/java/com/ocpsoft/pretty/faces/DynaviewEngineTest.java
/prettyfaces/trunk/core/src/test/resources/mock-pretty-config.xml
/prettyfaces/trunk/core/src/test/resources/parenting-pretty-config.xml
/prettyfaces/trunk/docs/src/main/docbook/en-US/Configuration.xml
/prettyfaces/trunk/docs/src/main/docbook/en-US/Updating.xml
/prettyfaces/trunk/docs/src/main/docbook/en-US/config/Annotations.xml
/prettyfaces/trunk/docs/src/main/docbook/en-US/master.xml
/prettyfaces/trunk/impl-jsf2/src/main/java/com/ocpsoft/pretty/faces/el/resolver/ManagedBeanAnnotationResolver.java
=======================================
--- /dev/null
+++ /prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/Navigator.java
Tue Nov 9 10:23:42 2010
@@ -0,0 +1,30 @@
+/*
+ * PrettyFaces is an OpenSource JSF library to create bookmarkable URLs.
+ * Copyright (C) 2009 - Lincoln Baxter, III <lin...@ocpsoft.com> This
program
+ * is free software: you can redistribute it and/or modify it under the
terms of
+ * the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any
later
+ * version. This program is distributed in the hope that it will be
useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License
+ * for more details. You should have received a copy of the GNU Lesser
General
+ * Public License along with this program. If not, see the file
COPYING.LESSER3
+ * or visit the GNU website at <http://www.gnu.org/licenses/>.
+ */
+package com.ocpsoft.pretty;
+
+/**
+ * @author Lincoln Baxter, III <lin...@ocpsoft.com>
+ */
+public interface Navigator
+{
+ public void forward(String target);
+
+ public void forward(String target, Object params);
+
+ public void redirect(String target);
+
+ public void redirect(String target, Object params);
+
+ public void sendHttpStatusCode(int code);
+}
=======================================
--- /dev/null
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/dynaview/DynaviewEngine.java
Tue Nov 9 10:23:42 2010
@@ -0,0 +1,55 @@
+package com.ocpsoft.pretty.faces.config.dynaview;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class DynaviewEngine
+{
+
+ public static final String DYNAVIEW = "com.ocpsoft.dynaView";
+
+ /**
+ * Given the string value of the Faces Servlet mapping, return a
string that
+ * is guaranteed to match when a servlet forward is issued. It doesn't
+ * matter which FacesServlet we get to, as long as we get to one.
+ */
+ public String buildDynaViewId(final String facesServletMapping)
+ {
+ StringBuffer result = new StringBuffer();
+
+ Map<Pattern, String> patterns = new HashMap<Pattern, String>();
+
+ Pattern pathMapping = Pattern.compile("^(/.*/)\\*$");
+ Pattern extensionMapping = Pattern.compile("^\\*(\\..*)$");
+ Pattern defaultMapping = Pattern.compile("^/$");
+
+ patterns.put(pathMapping, "$1" + DYNAVIEW + ".jsf");
+ patterns.put(extensionMapping, "/" + DYNAVIEW + "$1");
+ patterns.put(defaultMapping, "/" + DYNAVIEW + ".jsf");
+
+ boolean matched = false;
+ Iterator<Pattern> iterator = patterns.keySet().iterator();
+ while (matched == false && iterator.hasNext())
+ {
+ Pattern p = iterator.next();
+ Matcher m = p.matcher(facesServletMapping);
+ if (m.matches())
+ {
+ String replacement = patterns.get(p);
+ m.appendReplacement(result, replacement);
+ matched = true;
+ }
+ }
+
+ if (matched == false)
+ {
+ // This is an exact url-mapping, use it.
+ result.append(facesServletMapping);
+ }
+
+ return result.toString();
+ }
+}
=======================================
--- /dev/null
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/spi/ELBeanNameResolver.java
Tue Nov 9 10:23:42 2010
@@ -0,0 +1,46 @@
+package com.ocpsoft.pretty.faces.spi;
+
+import javax.servlet.ServletContext;
+
+import com.ocpsoft.pretty.faces.util.ServiceLoader;
+
+/**
+ * <p>
+ * Implementations of this interfaces help PrettyFaces in getting the name
a
+ * bean has in the EL context.
+ * </p>
+ *
+ * <p>
+ * Implementations are looked up at runtime via the {@link ServiceLoader}
+ * mechanism.
+ * </p>
+ *
+ * @author Christian Kaltepoth
+ *
+ */
+public interface ELBeanNameResolver
+{
+ /**
+ * This method is called once prior to calls of {@link
#getBeanName(Class)}
+ * and should be used to initialize the resolver. Implementations must
return
+ * <code>true</code> when the initialization succeeded. If
<code>false</code>
+ * is returned, the resolver will be disabled!
+ *
+ * @param servletContext The {@link ServletContext}
+ * @param classLoader A {@link ClassLoader} to use
+ * @return <code>true</code> if initialization succeeded.
<code>false</code>
+ * will disable the resolver.
+ */
+ public boolean init(ServletContext servletContext, ClassLoader
classLoader);
+
+ /**
+ * This method returns the name of a bean with the supplied type. The
method
+ * MUST return <code>null</code>, if it cannot resolve the bean name or
isn't
+ * absolutely certain about it.
+ *
+ * @param clazz Class of the bean
+ * @return The bean name or <code>null</code>.
+ */
+ public String getBeanName(Class<?> clazz);
+
+}
=======================================
--- /dev/null
+++
/prettyfaces/trunk/core/src/main/resources/META-INF/services/com.ocpsoft.pretty.faces.spi.ELBeanNameResolver
Tue Nov 9 10:23:42 2010
@@ -0,0 +1,4 @@
+com.ocpsoft.pretty.faces.el.resolver.FacesConfigBeanNameResolver
+com.ocpsoft.pretty.faces.el.resolver.SpringBeanNameResolver
+com.ocpsoft.pretty.faces.el.resolver.SeamBeanNameResolver
+com.ocpsoft.pretty.faces.el.resolver.CDIBeanNameResolver
=======================================
--- /dev/null
+++ /prettyfaces/trunk/docs/src/main/docbook/en-US/Extensions.xml Tue Nov
9 10:23:42 2010
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<chapter id="Extensions">
+ <title>Extend PrettyFaces</title>
+
+ <para>
+ As a modern web-framework, it is important to provide extension and
integration points,
+ enabling complex functionality that goes beyond the scope of the
core framework itself.
+
+ In order to do this, PrettyFaces provides several extension points,
described below:
+ </para>
+
+ <section id="ConfigurationProvider">
+ <title>com.ocpsoft.pretty.faces.spi.ConfigurationProvider</title>
+
+ <para>
+ It may sometimes be necessary to provide custom <link
linkend="Configuration">configuration</link>
+ options in PrettyFaces. Loading URL-mappings from a database, for
example, or generating
+ mappings based on the state of the file-system. Due to this
requirement, PrettyFaces offers
+ an extension point for configuration providers to supply their
own additional configuration
+ to be merged with the master configuration at the time when
PrettyFaces boots up.
+ This is when you would implement a custom
<literal>ConfigurationProvider</literal>.
+ </para>
+
+ <programlisting><![CDATA[public class MyConfigurationProvider
implements ConfigurationProvider {
+
+ public PrettyConfig loadConfiguration(ServletContext servletContext)
+ {
+ // add new configuration elements here
+ return new PrettyConfig();
+ }
+}]]></programlisting>
+
+ <para>
+ To let PrettyFaces know about your provider, you'll have to
register your
+ implementation by creating a file named
+
<code>META-INF/services/com.ocpsoft.pretty.faces.spi.ConfigurationProvider</code>
+ in your classpath and add the fully-qualified class name of your
implementation
+ class there.
+ </para>
+
+ <programlisting>
+
<filename>META-INF/services/com.ocpsoft.pretty.faces.spi.ConfigurationProvider</filename>
+ com.example.MyConfigurationProvider
+ </programlisting>
+
+ </section>
+
+ <section id="ConfigurationPostProcessor">
+
<title>com.ocpsoft.pretty.faces.spi.ConfigurationPostProcessor</title>
+
+ <para>
+ After all configurations have been loaded and merged from any
built-in or registered
+ <link
linkend="ConfigurationProvider">ConfigurationProvider</link> sources, there
is an
+ additional opportunity to post-process the entire configuration,
for instance, if you
+ wanted to programmatically add security constraints to mappings
based on various patterns.
+ This is when you would implement a custom
<literal>ConfigurationPostProcessor</literal>.
+ </para>
+
+ <programlisting><![CDATA[public class MyPostProcessor implements
ConfigurationPostProcessor {
+
+ public PrettyConfig processConfiguration(ServletContext servletContext,
PrettyConfig config)
+ {
+ // make changes to the configuration here
+ return config;
+ }
+}]]></programlisting>
+
+ <para>
+ To let PrettyFaces know about your post-processor, you'll have to
register your
+ implementation by creating a file named
+
<code>META-INF/services/com.ocpsoft.pretty.faces.spi.ConfigurationPostProcessor</code>
+ in your classpath and add the fully-qualified class name of your
implementation
+ class there.
+ </para>
+
+ <programlisting>
+
<filename>META-INF/services/com.ocpsoft.pretty.faces.spi.ConfigurationPostProcessor</filename>
+ com.example.MyPostProcessor
+ </programlisting>
+
+ </section>
+
+ <section id="ELBeanNameResolver">
+ <title>com.ocpsoft.pretty.faces.spi.ELBeanNameResolver</title>
+
+ <para>
+ As part of the <link
linkend="config.annotations.resolving">Annotations scanning</link>
+ (one of PrettyFaces' configuration methods,) it may sometimes be
necessary to integrate
+ with a custom bean-container that is not one of the built in
containers supported natively.
+
+ It is in these cases when you should implement a custom
ELBeanNameResolver. The following
+ example shows a resolver that will resolve the bean name by
searching for a <code>@Named</code>
+ annotation.
+ </para>
+
+ <programlisting><![CDATA[public class MyBeanNameResolver implements
ELBeanNameResolver {
+
+ public boolean init(ServletContext servletContext, ClassLoader
classLoader) {
+ // tell PrettyFaces that initialization was successful
+ return true;
+ }
+
+ public String getBeanName(Class<?> clazz) {
+
+ // try to find @Named annotation
+ Named annotation = clazz.getAnnotation(Named.class);
+
+ // return name attribute if annotation has been found
+ if(annotation != null) {
+ return annotation.value();
+ }
+
+ // we don't know the name
+ return null;
+
+ }
+
+ }]]></programlisting>
+
+ <para>
+ To let PrettyFaces know about your resolver, you'll have to
register your
+ implementation by creating a file named
+
<code>META-INF/services/com.ocpsoft.pretty.faces.spi.ELBeanNameResolver</code>
+ in your classpath and add the fully-qualified class name of your
implementation
+ class there.
+ </para>
+
+ <programlisting>
+
<filename>META-INF/services/com.ocpsoft.pretty.faces.spi.ELBeanNameResolver</filename>
+ com.example.MyBeanNameResolver
+ </programlisting>
+
+ </section>
+
+</chapter>
=======================================
--- /dev/null
+++
/prettyfaces/trunk/docs/src/main/docbook/en-US/config/Parent_mappings.xml
Tue Nov 9 10:23:42 2010
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+
+
+<section id="config.mapping.parents">
+ <title>Inherit from a parent URL-mapping</title>
+ <para>
+ Frequently, you may find that several - or all - of your mappings share
a common base-URL.
+ It is on these occasions when you should consider using a parent
URL-mapping by using the
+ <literal>parentId</literal> attribute.
+
+ <programlisting><![CDATA[<url-mapping parentId="store"
id="category"> ... </url-mapping>]]></programlisting>
+
+ Notice that the <literal>parentId</literal> attribute must refer to
a <literal>mappingId</literal>
+ of another URL-mapping. See examples below:
+
+ <programlisting><![CDATA[<url-mapping id="store">
+ <pattern value="/store/" />
+ <~-- Result: /store/ -->
+ <view-id value="/faces/shop/store.jsf" />
+</url-mapping>
+
+<url-mapping parentId="store" id="category">
+ <pattern value="/#{category}" />
+ <~-- Result: /store/#{category} -->
+ <view-id value="/faces/shop/category.jsf" />
+</url-mapping>
+
+<url-mapping parentId="category" id="item">
+ <pattern value="/#{item}" />
+ <~-- Result: /store/#{category}/#{item} -->
+ <view-id value="/faces/shop/item.jsf" />
+</url-mapping>
+
+<url-mapping parentId="category" id="sales">
+ <pattern value="/sales" />
+ <~-- Result: /store/#{category}/sales -->
+ <view-id value="/faces/shop/sales.jsf" />
+</url-mapping>
+]]></programlisting>
+
+ At this time, only the pattern and path-parameter
+ <link linkend="config.validation">validators</link> will be
inherited by child mappings;
+ however, this may be enhanced in future versions.
+ </para>
+
+</section>
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/DynaviewEngine.java
Thu May 13 09:52:33 2010
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.ocpsoft.pretty.faces;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class DynaviewEngine
-{
-
- public static final String DYNAVIEW = "com.ocpsoft.dynaView";
-
- /**
- * Given the string value of the Faces Servlet mapping, return a
string that
- * is guaranteed to match when a servlet forward is issued. It doesn't
- * matter which FacesServlet we get to, as long as we get to one.
- */
- public String buildDynaViewId(final String facesServletMapping)
- {
- StringBuffer result = new StringBuffer();
-
- Map<Pattern, String> patterns = new HashMap<Pattern, String>();
-
- Pattern pathMapping = Pattern.compile("^(/.*/)\\*$");
- Pattern extensionMapping = Pattern.compile("^\\*(\\..*)$");
- Pattern defaultMapping = Pattern.compile("^/$");
-
- patterns.put(pathMapping, "$1" + DYNAVIEW + ".jsf");
- patterns.put(extensionMapping, "/" + DYNAVIEW + "$1");
- patterns.put(defaultMapping, "/" + DYNAVIEW + ".jsf");
-
- boolean matched = false;
- Iterator<Pattern> iterator = patterns.keySet().iterator();
- while (matched == false && iterator.hasNext())
- {
- Pattern p = iterator.next();
- Matcher m = p.matcher(facesServletMapping);
- if (m.matches())
- {
- String replacement = patterns.get(p);
- m.appendReplacement(result, replacement);
- matched = true;
- }
- }
-
- if (matched == false)
- {
- // This is an exact url-mapping, use it.
- result.append(facesServletMapping);
- }
-
- return result.toString();
- }
-}
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/PrettyNavigator.java
Thu May 13 09:52:33 2010
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * PrettyFaces is an OpenSource JSF library to create bookmarkable URLs.
- * Copyright (C) 2009 - Lincoln Baxter, III <lin...@ocpsoft.com> This
program
- * is free software: you can redistribute it and/or modify it under the
terms of
- * the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any
later
- * version. This program is distributed in the hope that it will be
useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License
- * for more details. You should have received a copy of the GNU Lesser
General
- * Public License along with this program. If not, see the file
COPYING.LESSER3
- * or visit the GNU website at <http://www.gnu.org/licenses/>.
- */
-package com.ocpsoft.pretty.faces;
-
-/**
- * @author Lincoln Baxter, III <lin...@ocpsoft.com>
- */
-public interface PrettyNavigator
-{
- public void forward(String target);
-
- public void forward(String target, Object params);
-
- public void redirect(String target);
-
- public void redirect(String target, Object params);
-
- public void sendHttpStatusCode(int code);
-}
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/BeanNameResolver.java
Fri Oct 15 15:52:28 2010
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.ocpsoft.pretty.faces.el;
-
-import javax.servlet.ServletContext;
-
-import com.ocpsoft.pretty.faces.util.ServiceLoader;
-
-/**
- * <p>
- * Implementations of this interfaces help PrettyFaces in getting the name
a
- * bean has in the EL context.
- * </p>
- *
- * <p>
- * Implementations are looked up at runtime via the {@link ServiceLoader}
- * mechanism.
- * </p>
- *
- * @author Christian Kaltepoth
- *
- */
-public interface BeanNameResolver
-{
- /**
- * This method is called once prior to calls of {@link
#getBeanName(Class)}
- * and should be used to initialize the resolver. Implementations must
return
- * <code>true</code> when the initialization succeeded. If
<code>false</code>
- * is returned, the resolver will be disabled!
- *
- * @param servletContext The {@link ServletContext}
- * @param classLoader A {@link ClassLoader} to use
- * @return <code>true</code> if initialization succeeded.
<code>false</code>
- * will disable the resolver.
- */
- public boolean init(ServletContext servletContext, ClassLoader
classLoader);
-
- /**
- * This method returns the name of a bean with the supplied type. The
method
- * MUST return <code>null</code>, if it cannot resolve the bean name or
isn't
- * absolutely certain about it.
- *
- * @param clazz Class of the bean
- * @return The bean name or <code>null</code>.
- */
- public String getBeanName(Class<?> clazz);
-
-}
=======================================
---
/prettyfaces/trunk/core/src/main/resources/META-INF/services/com.ocpsoft.pretty.faces.el.BeanNameResolver
Wed Jun 30 11:26:10 2010
+++ /dev/null
@@ -1,4 +0,0 @@
-com.ocpsoft.pretty.faces.el.resolver.FacesConfigBeanNameResolver
-com.ocpsoft.pretty.faces.el.resolver.SpringBeanNameResolver
-com.ocpsoft.pretty.faces.el.resolver.SeamBeanNameResolver
-com.ocpsoft.pretty.faces.el.resolver.CDIBeanNameResolver
=======================================
--- /prettyfaces/trunk/CHANGELOG.txt Thu Nov 4 13:06:12 2010
+++ /prettyfaces/trunk/CHANGELOG.txt Tue Nov 9 10:23:42 2010
@@ -2,13 +2,11 @@
VERSION 3.1.1
------------------------------------
-Major:
-
+Major Changes:
* Added 'parentId' for Hierarchical Mappings in pretty-config.xml (#72)
-* Can now be run in a pure servlet environment (without JSF)
+* Can now be run in a pure servlet environment (without JSF and related
JARs)
Features & Enhancements:
-
* Added 'onPostback' configuration parameter for query parameters (#24)
* Added code-completion support for Eclipse Helios
* Added 'pretty:location' client behavior
@@ -20,12 +18,14 @@
* Changed some method signatures in PrettyContext
* PrettyFilter no longer wraps application exceptions in ServletException
* PrettyException no longer extends javax.faces.FacesException
+* Began deprecation of <view-id>/view.jsp</view-id> in favor of <view-id
value="/view.jsp" />
+* com.ocpsoft.pretty.faces.el.BeanNameResolver SPI has moved to
com.ocpsoft.pretty.faces.spi.ELBeanNameResolver
Bugfixes:
* Fixed compatibility with Java 1.5
* Fixed EL method invocation in JSF 1.1 branch.
* Removed HttpSession accesses that could potentially create an unwanted
user session. (#62)
-* Prevent downloading of web.xml DTDs
+* Prevent downloading of web.xml DTDs during configuration
------------------------------------
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/annotation/URLBeanName.java
Wed Jun 30 11:26:10 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/annotation/URLBeanName.java
Tue Nov 9 10:23:42 2010
@@ -7,7 +7,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import com.ocpsoft.pretty.faces.el.BeanNameResolver;
+import com.ocpsoft.pretty.faces.spi.ELBeanNameResolver;
/**
* <p>
@@ -29,7 +29,7 @@
* </p>
*
* <ul>
- * <li>Build your own implementation of the {@link BeanNameResolver}
interface.</li>
+ * <li>Build your own implementation of the {@link ELBeanNameResolver}
interface.</li>
* <li>Create a file
*
<code>META-INF/services/com.ocpsoft.pretty.faces.el.BeanNameResolver</code>
* and put the fully-qualified class name of your implementation class in
there.
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/DigesterPrettyConfigParser.java
Thu Nov 4 13:06:12 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/DigesterPrettyConfigParser.java
Tue Nov 9 10:23:42 2010
@@ -96,6 +96,13 @@
digester.addCallParam("pretty-config/url-mapping/pattern",
0, "value");
digester.addCallMethod("pretty-config/url-mapping/pattern", "setPattern",
0);
+ /*
+ * Parse View Id
+ */
+
digester.addCallMethod("pretty-config/url-mapping/view-id", "setViewId", 1);
+ digester.addCallParam("pretty-config/url-mapping/view-id",
0, "value");
+
digester.addCallMethod("pretty-config/url-mapping/view-id", "setViewId", 0);
+
/*
* Parse Path Validators
*/
@@ -119,11 +126,6 @@
digester.addCallMethod("pretty-config/url-mapping/action", "setAction", 0);
digester.addSetNext("pretty-config/url-mapping/action", "addAction");
- /*
- * Parse View Id
- */
-
digester.addCallMethod("pretty-config/url-mapping/view-id", "setViewId", 0);
-
/*
* Add Mapping to Builder
*/
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/PrettyConfigurator.java
Thu Nov 4 13:06:12 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/PrettyConfigurator.java
Tue Nov 9 10:23:42 2010
@@ -13,10 +13,6 @@
*/
package com.ocpsoft.pretty.faces.config;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-
import javax.servlet.ServletContext;
import org.apache.commons.logging.Log;
@@ -24,8 +20,10 @@
import com.ocpsoft.pretty.PrettyContext;
import com.ocpsoft.pretty.PrettyException;
-import com.ocpsoft.pretty.faces.DynaviewEngine;
+import com.ocpsoft.pretty.faces.config.dynaview.DynaviewEngine;
import com.ocpsoft.pretty.faces.config.servlet.WebXmlParser;
+import com.ocpsoft.pretty.faces.config.spi.ParentingPostProcessor;
+import com.ocpsoft.pretty.faces.config.spi.ValidatingPostProcessor;
import com.ocpsoft.pretty.faces.spi.ConfigurationPostProcessor;
import com.ocpsoft.pretty.faces.spi.ConfigurationProvider;
import com.ocpsoft.pretty.faces.util.ServiceLoader;
@@ -56,22 +54,31 @@
try
{
final PrettyConfigBuilder builder = new PrettyConfigBuilder();
- Map<String, String> initParameterMap =
buildInitParameterMap(servletContext);
ServiceLoader<ConfigurationProvider> configLoader =
ServiceLoader.load(ConfigurationProvider.class);
for (ConfigurationProvider p : configLoader)
{
- builder.addFromConfig(p.load(servletContext));
+ builder.addFromConfig(p.loadConfiguration(servletContext));
}
config = builder.build();
config.setDynaviewId(getFacesDynaViewId());
+ /*
+ * Do the built-in post-processing manually to ensure ordering
+ */
+ ConfigurationPostProcessor parenting = new
ParentingPostProcessor();
+
+ config = parenting.processConfiguration(servletContext, config);
+
ServiceLoader<ConfigurationPostProcessor> postProcessors =
ServiceLoader.load(ConfigurationPostProcessor.class);
for (ConfigurationPostProcessor p : postProcessors)
{
- config = p.process(config, initParameterMap);
- }
+ config = p.processConfiguration(servletContext, config);
+ }
+
+ ConfigurationPostProcessor validating = new
ValidatingPostProcessor();
+ config = validating.processConfiguration(servletContext, config);
log.trace("Setting config into ServletContext");
servletContext.setAttribute(PrettyContext.CONFIG_KEY, config);
@@ -81,23 +88,6 @@
throw new PrettyException("Failed to load configuration.", e);
}
}
-
- private Map<String, String> buildInitParameterMap(ServletContext
context)
- {
- Map<String, String> result = new HashMap<String, String>();
-
- Enumeration<String> names = context.getInitParameterNames();
-
- while ((names != null) && names.hasMoreElements())
- {
- String name = names.nextElement();
- String value = context.getInitParameter(name);
-
- result.put(name, value);
- }
-
- return result;
- }
private String getFacesDynaViewId()
{
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/AnnotationConfigurationProvider.java
Thu Nov 4 13:06:12 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/AnnotationConfigurationProvider.java
Tue Nov 9 10:23:42 2010
@@ -51,7 +51,7 @@
public static final String CONFIG_SCAN_LIB_DIR
= "com.ocpsoft.pretty.SCAN_LIB_DIRECTORY";
public static final String CONFIG_BASE_PACKAGES
= "com.ocpsoft.pretty.BASE_PACKAGES";
- public PrettyConfig load(ServletContext servletContext)
+ public PrettyConfig loadConfiguration(ServletContext servletContext)
{
String packageFilters =
servletContext.getInitParameter(CONFIG_BASE_PACKAGES);
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/ClassLoaderConfigurationProvider.java
Thu Nov 4 13:06:12 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/ClassLoaderConfigurationProvider.java
Tue Nov 9 10:23:42 2010
@@ -48,7 +48,7 @@
public static final String PRETTY_CONFIG_RESOURCE
= "META-INF/pretty-config.xml";
public static final String CLASSPATH_CONFIG_ENABLED
= "com.ocpsoft.pretty.LOAD_CLASSPATH_CONFIG";
- public PrettyConfig load(ServletContext context)
+ public PrettyConfig loadConfiguration(ServletContext context)
{
String enabled = context.getInitParameter(CLASSPATH_CONFIG_ENABLED);
if ((enabled != null) && "false".equalsIgnoreCase(enabled.trim()))
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/ContextSpecifiedConfigurationProvider.java
Thu Nov 4 13:06:12 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/ContextSpecifiedConfigurationProvider.java
Tue Nov 9 10:23:42 2010
@@ -52,7 +52,7 @@
{
private static final Log log =
LogFactory.getLog(ContextSpecifiedConfigurationProvider.class);
- public PrettyConfig load(ServletContext servletContext)
+ public PrettyConfig loadConfiguration(ServletContext servletContext)
{
final PrettyConfigBuilder builder = new PrettyConfigBuilder();
PrettyConfigParser configParser = new DigesterPrettyConfigParser();
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/DefaultXMLConfigurationProvider.java
Thu Nov 4 13:06:12 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/DefaultXMLConfigurationProvider.java
Tue Nov 9 10:23:42 2010
@@ -47,7 +47,7 @@
public static final String DEFAULT_PRETTY_FACES_CONFIG
= "/WEB-INF/pretty-config.xml";
- public PrettyConfig load(ServletContext servletContext)
+ public PrettyConfig loadConfiguration(ServletContext servletContext)
{
final PrettyConfigBuilder builder = new PrettyConfigBuilder();
PrettyConfigParser configParser = new DigesterPrettyConfigParser();
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/ParentingPostProcessor.java
Thu Nov 4 13:06:12 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/ParentingPostProcessor.java
Tue Nov 9 10:23:42 2010
@@ -16,8 +16,10 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
-
+
+import javax.servlet.ServletContext;
+
+import com.ocpsoft.pretty.PrettyException;
import com.ocpsoft.pretty.faces.config.PrettyConfig;
import com.ocpsoft.pretty.faces.config.mapping.PathValidator;
import com.ocpsoft.pretty.faces.config.mapping.UrlMapping;
@@ -31,9 +33,10 @@
public static final String HIERARCHY_ENABLED_PARAM
= "com.ocpsoft.pretty.INHERITABLE_CONFIG";
private final List<UrlMapping> seen = new ArrayList<UrlMapping>();
- public PrettyConfig process(PrettyConfig config, Map<String, String>
parameters)
- {
- if (parameters.containsKey(HIERARCHY_ENABLED_PARAM)
&& "false".equalsIgnoreCase(parameters.get(HIERARCHY_ENABLED_PARAM).trim()))
+ public PrettyConfig processConfiguration(ServletContext context,
PrettyConfig config)
+ {
+ String enabled = context.getInitParameter(HIERARCHY_ENABLED_PARAM);
+ if ((enabled != null) && "false".equalsIgnoreCase(enabled.trim()))
{
return config;
}
@@ -51,6 +54,11 @@
if (m.hasParent() && !seen.contains(m))
{
UrlMapping parent = config.getMappingById(m.getParentId());
+ if (parent == null)
+ {
+ throw new PrettyException("Error when building configuration
for URL-mapping [" + m.getId() + ":"
+ + m.getPattern() + "] - the requested parentId [" +
m.getParentId() + "] does not exist in the configuration.");
+ }
if (parent.hasParent())
{
createAncestry(config, parent);
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/ValidatingPostProcessor.java
Thu Nov 4 13:06:12 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/config/spi/ValidatingPostProcessor.java
Tue Nov 9 10:23:42 2010
@@ -14,7 +14,7 @@
package com.ocpsoft.pretty.faces.config.spi;
-import java.util.Map;
+import javax.servlet.ServletContext;
import com.ocpsoft.pretty.faces.config.PrettyConfig;
import com.ocpsoft.pretty.faces.config.mapping.UrlMapping;
@@ -30,9 +30,10 @@
{
public static final String VALIDATION_ENABLED_PARAM
= "com.ocpsoft.pretty.VALIDATE_CONFIG";
- public PrettyConfig process(PrettyConfig config, Map<String, String>
parameters)
- {
- if (parameters.containsKey(VALIDATION_ENABLED_PARAM)
&& "false".equalsIgnoreCase(parameters.get(VALIDATION_ENABLED_PARAM).trim()))
+ public PrettyConfig processConfiguration(ServletContext context,
PrettyConfig config)
+ {
+ String enabled = context.getInitParameter(VALIDATION_ENABLED_PARAM);
+ if ((enabled != null) && "false".equalsIgnoreCase(enabled.trim()))
{
return config;
}
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/LazyBeanNameFinder.java
Thu Nov 4 13:06:12 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/LazyBeanNameFinder.java
Tue Nov 9 10:23:42 2010
@@ -9,6 +9,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import com.ocpsoft.pretty.faces.spi.ELBeanNameResolver;
import com.ocpsoft.pretty.faces.util.ServiceLoader;
/**
@@ -32,11 +33,11 @@
/**
* List of all resolvers. Initialized once on object creation
*/
- private final List<BeanNameResolver> resolvers = new
ArrayList<BeanNameResolver>();
+ private final List<ELBeanNameResolver> resolvers = new
ArrayList<ELBeanNameResolver>();
/**
* Creates a new {@link LazyBeanNameFinder}. The constructor will find
all
- * implementations of {@link BeanNameResolver} by using the
+ * implementations of {@link ELBeanNameResolver} by using the
* {@link ServiceLoader} mechanism.
*
* @param servletContext The servlet context
@@ -54,14 +55,14 @@
}
// find resolvers via ServiceLoader
- Iterator<BeanNameResolver> beanNameFinderIterator =
ServiceLoader.load(BeanNameResolver.class).iterator();
+ Iterator<ELBeanNameResolver> beanNameFinderIterator =
ServiceLoader.load(ELBeanNameResolver.class).iterator();
// call init() method on all resolvers
while (beanNameFinderIterator.hasNext())
{
// log resolver name
- BeanNameResolver resolver = beanNameFinderIterator.next();
+ ELBeanNameResolver resolver = beanNameFinderIterator.next();
if (log.isTraceEnabled())
{
log.trace("Initializing BeanNameResolver: " +
resolver.getClass().getName());
@@ -81,7 +82,7 @@
/**
* Find the bean name of the supplied class. This method will try to
resolve
* the bean name by calling all registered implementations of
- * {@link BeanNameResolver}. This method will either return the
resolved name
+ * {@link ELBeanNameResolver}. This method will either return the
resolved name
* or throw an {@link IllegalStateException}, if no resolver knows the
name
* of the bean.
*
@@ -93,7 +94,7 @@
{
// process all resolvers
- for (BeanNameResolver resolver : resolvers)
+ for (ELBeanNameResolver resolver : resolvers)
{
// try to resolve bean name with current resolver
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/resolver/CDIBeanNameResolver.java
Wed Jun 30 11:26:10 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/resolver/CDIBeanNameResolver.java
Tue Nov 9 10:23:42 2010
@@ -14,11 +14,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import com.ocpsoft.pretty.faces.el.BeanNameResolver;
+import com.ocpsoft.pretty.faces.spi.ELBeanNameResolver;
/**
* <p>
- * A {@link BeanNameResolver} for CDI (JSR299) environments.
+ * A {@link ELBeanNameResolver} for CDI (JSR299) environments.
* </p>
*
* <p>
@@ -30,7 +30,7 @@
* @author Christian Kaltepoth
*
*/
-public class CDIBeanNameResolver implements BeanNameResolver
+public class CDIBeanNameResolver implements ELBeanNameResolver
{
private final static Log log =
LogFactory.getLog(CDIBeanNameResolver.class);
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/resolver/FacesConfigBeanNameResolver.java
Thu Nov 4 09:47:36 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/resolver/FacesConfigBeanNameResolver.java
Tue Nov 9 10:23:42 2010
@@ -24,13 +24,13 @@
import org.apache.commons.logging.LogFactory;
import org.xml.sax.SAXException;
-import com.ocpsoft.pretty.faces.el.BeanNameResolver;
+import com.ocpsoft.pretty.faces.spi.ELBeanNameResolver;
import com.ocpsoft.pretty.faces.util.EmptyEntityResolver;
/**
*
* <p>
- * Implementation of {@link BeanNameResolver} handling beans configured
via the
+ * Implementation of {@link ELBeanNameResolver} handling beans configured
via the
* standard XML configuration mechanism.
* </p>
*
@@ -44,7 +44,7 @@
* @author Christian Kaltepoth
*
*/
-public class FacesConfigBeanNameResolver implements BeanNameResolver
+public class FacesConfigBeanNameResolver implements ELBeanNameResolver
{
private final static Log log =
LogFactory.getLog(FacesConfigBeanNameResolver.class);
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/resolver/SeamBeanNameResolver.java
Wed Jun 30 11:26:10 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/resolver/SeamBeanNameResolver.java
Tue Nov 9 10:23:42 2010
@@ -8,11 +8,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import com.ocpsoft.pretty.faces.el.BeanNameResolver;
+import com.ocpsoft.pretty.faces.spi.ELBeanNameResolver;
/**
* <p>
- * Implementation of {@link BeanNameResolver} that resolves Seam
components.
+ * Implementation of {@link ELBeanNameResolver} that resolves Seam
components.
* </p>
*
* <p>
@@ -26,7 +26,7 @@
* @author Christian Kaltepoth
*
*/
-public class SeamBeanNameResolver implements BeanNameResolver
+public class SeamBeanNameResolver implements ELBeanNameResolver
{
private final static Log log =
LogFactory.getLog(SeamBeanNameResolver.class);
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/resolver/SpringBeanNameResolver.java
Wed Jun 30 11:26:10 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/el/resolver/SpringBeanNameResolver.java
Tue Nov 9 10:23:42 2010
@@ -8,11 +8,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import com.ocpsoft.pretty.faces.el.BeanNameResolver;
+import com.ocpsoft.pretty.faces.spi.ELBeanNameResolver;
/**
* <p>
- * Implementation of {@link BeanNameResolver} that will resolve names of
beans
+ * Implementation of {@link ELBeanNameResolver} that will resolve names of
beans
* managed by Spring.
* </p>
* <p>
@@ -23,7 +23,7 @@
*
* @author Christian Kaltepoth
*/
-public class SpringBeanNameResolver implements BeanNameResolver
+public class SpringBeanNameResolver implements ELBeanNameResolver
{
private final static Log log =
LogFactory.getLog(SpringBeanNameResolver.class);
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/spi/ConfigurationPostProcessor.java
Thu Nov 4 13:06:12 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/spi/ConfigurationPostProcessor.java
Tue Nov 9 10:23:42 2010
@@ -13,7 +13,7 @@
*/
package com.ocpsoft.pretty.faces.spi;
-import java.util.Map;
+import javax.servlet.ServletContext;
import com.ocpsoft.pretty.faces.config.PrettyConfig;
@@ -29,10 +29,11 @@
/**
* Process the given PrettyConfig, returning the modified configuration.
*
- * @param config The config to process
- * @param parameters The map of servlet context init parameters
+ * @param servletContext The {@link ServletContext} for the application
being
+ * configured.
+ * @param config The {@link PrettyConfig} to process
* @return The processed configuration
*/
- PrettyConfig process(PrettyConfig config, Map<String, String>
parameters);
+ PrettyConfig processConfiguration(ServletContext context, PrettyConfig
config);
}
=======================================
---
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/spi/ConfigurationProvider.java
Thu Nov 4 13:06:12 2010
+++
/prettyfaces/trunk/core/src/main/java/com/ocpsoft/pretty/faces/spi/ConfigurationProvider.java
Tue Nov 9 10:23:42 2010
@@ -32,5 +32,12 @@
*/
public interface ConfigurationProvider
{
- PrettyConfig load(ServletContext servletContext);
-}
+ /**
+ * Return a {@link PrettyConfig} object that will be appended to the
current
+ * PrettyFaces configuration.
+ *
+ * @param servletContext The {@link ServletContext} for the application
being
+ * configured.
+ */
+ PrettyConfig loadConfiguration(ServletContext servletContext);
+}
=======================================
---
/prettyfaces/trunk/core/src/main/resources/META-INF/ocpsoft-pretty-faces-3.1.1.xsd
Thu Nov 4 13:06:12 2010
+++
/prettyfaces/trunk/core/src/main/resources/META-INF/ocpsoft-pretty-faces-3.1.1.xsd
Tue Nov 9 10:23:42 2010
@@ -17,8 +17,8 @@
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified"
targetNamespace="http://ocpsoft.com/prettyfaces/3.1.0"
- xmlns="http://ocpsoft.com/prettyfaces/3.1.0">
+ elementFormDefault="qualified"
targetNamespace="http://ocpsoft.com/prettyfaces/3.1.1"
+ xmlns="http://ocpsoft.com/prettyfaces/3.1.1">
<xs:annotation>
<xs:documentation>PrettyFaces Configuration XSD Schema
@@ -263,8 +263,7 @@
</xs:simpleContent>
</xs:complexType>
</xs:element>
- <xs:element name="view-id" type="xs:string" minOccurs="1"
- maxOccurs="1">
+ <xs:element name="view-id" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>
Specify the URI displayed by this mapping, by either
@@ -276,6 +275,9 @@
non-Faces servlet.
</xs:documentation>
</xs:annotation>
+ <xs:complexType>
+ <xs:attribute name="value" type="xs:string"></xs:attribute>
+ </xs:complexType>
</xs:element>
<xs:element name="action" minOccurs="0"
maxOccurs="unbounded">
=======================================
---
/prettyfaces/trunk/core/src/main/resources/META-INF/services/com.ocpsoft.pretty.faces.spi.ConfigurationPostProcessor
Thu Nov 4 13:06:12 2010
+++
/prettyfaces/trunk/core/src/main/resources/META-INF/services/com.ocpsoft.pretty.faces.spi.ConfigurationPostProcessor
Tue Nov 9 10:23:42 2010
@@ -1,2 +0,0 @@
-com.ocpsoft.pretty.faces.config.spi.ValidatingPostProcessor
-com.ocpsoft.pretty.faces.config.spi.ParentingPostProcessor
=======================================
---
/prettyfaces/trunk/core/src/test/java/com/ocpsoft/pretty/faces/DynaviewEngineTest.java
Thu May 13 09:52:33 2010
+++
/prettyfaces/trunk/core/src/test/java/com/ocpsoft/pretty/faces/DynaviewEngineTest.java
Tue Nov 9 10:23:42 2010
@@ -4,6 +4,8 @@
import org.junit.Test;
+import com.ocpsoft.pretty.faces.config.dynaview.DynaviewEngine;
+
public class DynaviewEngineTest
{
private final DynaviewEngine dynaview = new DynaviewEngine();
=======================================
--- /prettyfaces/trunk/core/src/test/resources/mock-pretty-config.xml Sat
Oct 2 01:13:11 2010
+++ /prettyfaces/trunk/core/src/test/resources/mock-pretty-config.xml Tue
Nov 9 10:23:42 2010
@@ -6,17 +6,13 @@
<url-mapping id="0">
<pattern value="/project/#{viewProjectBean.projectId}/" />
- <view-id>
- #{viewProjectBean.getPrettyTarget}
- </view-id>
+ <view-id value="#{viewProjectBean.getPrettyTarget}" />
<action>#{viewProjectBean.authorize}</action>
<action>#{viewProjectBean.load}</action>
</url-mapping>
<url-mapping id="1" onPostback="false">
<pattern value="/project/#{addProjectBean.projectName}/" />
- <view-id>
- #{addProjectBean.getPrettyTarget}
- </view-id>
+ <view-id value="#{addProjectBean.getPrettyTarget}" />
<action onPostback="false">#{addProjectBean.authorize}</action>
<action onPostback="true">#{addProjectBean.create}</action>
</url-mapping>
=======================================
--- /prettyfaces/trunk/core/src/test/resources/parenting-pretty-config.xml
Thu Nov 4 13:06:12 2010
+++ /prettyfaces/trunk/core/src/test/resources/parenting-pretty-config.xml
Tue Nov 9 10:23:42 2010
@@ -6,23 +6,21 @@
<url-mapping id="parent">
<pattern value="/parent" />
- <view-id>/parent.jsf</view-id>
+ <view-id value="/parent.jsf" />
</url-mapping>
<url-mapping id="child" parentId="parent">
<pattern value="/child/#{name}">
- <validate index="0" validatorIds="validator1"
- onError="#{validationBean.handle}" />
+ <validate index="0" validatorIds="validator1"
onError="#{validationBean.handle}" />
</pattern>
- <view-id>/child.jsf</view-id>
+ <view-id value="/child.jsf" />
</url-mapping>
<url-mapping id="grandchild" parentId="child">
<pattern value="/grandchild/#{gname}">
- <validate index="0" validatorIds="validator2"
- onError="#{validationBean.handle2}"
validator="#{validationBean.validateMethod}" />
+ <validate index="0" validatorIds="validator2"
onError="#{validationBean.handle2}"
validator="#{validationBean.validateMethod}" />
</pattern>
- <view-id>/grandchild.jsf</view-id>
+ <view-id value="/grandchild.jsf" />
</url-mapping>
</pretty-config>
=======================================
--- /prettyfaces/trunk/docs/src/main/docbook/en-US/Configuration.xml Wed
Jun 30 11:26:10 2010
+++ /prettyfaces/trunk/docs/src/main/docbook/en-US/Configuration.xml Tue
Nov 9 10:23:42 2010
@@ -13,6 +13,7 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="config/URL_mapping.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="config/Path_parameters.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="config/Query_parameters.xml" />
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="config/Parent_mappings.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="config/Dynamic_views.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="config/Page_actions.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="config/Validation.xml" />
=======================================
--- /prettyfaces/trunk/docs/src/main/docbook/en-US/Updating.xml Wed Oct 6
09:50:13 2010
+++ /prettyfaces/trunk/docs/src/main/docbook/en-US/Updating.xml Tue Nov 9
10:23:42 2010
@@ -12,25 +12,26 @@
<title>Maven Artifact</title>
<para>
- PrettyFaces uses different Maven artifact identifiers than older
versions.
- Please use the following artifacts depending on the JSF version you
are using.
+ PrettyFaces uses new Maven artifact identifiers, changed from older
versions.
+ Please use the following artifacts depending on the JSF and Servlet
versions
+ you are using.
</para>
<simplesect>
- <title>JSF 2.0</title>
+ <title>JSF 2.0 or Servlet 2.5/3.0</title>
<programlisting><![CDATA[<dependency>
<groupId>com.ocpsoft</groupId>
<artifactId>prettyfaces-jsf2</artifactId>
- <version>3.1.0</version>
+ <version>3.1.1</version>
</dependency>]]></programlisting>
</simplesect>
<simplesect>
- <title>JSF 1.2</title>
+ <title>JSF 1.2 or Servlet 2.5/3.0</title>
<programlisting><![CDATA[<dependency>
<groupId>com.ocpsoft</groupId>
<artifactId>prettyfaces-jsf12</artifactId>
- <version>3.1.0</version>
+ <version>3.1.1</version>
</dependency>]]></programlisting>
</simplesect>
@@ -39,26 +40,10 @@
<programlisting><![CDATA[<dependency>
<groupId>com.ocpsoft</groupId>
<artifactId>prettyfaces-jsf11</artifactId>
- <version>3.1.0</version>
+ <version>3.1.1</version>
</dependency>]]></programlisting>
</simplesect>
- </simplesect>
-
- <simplesect>
- <title>MultiPageMessagesSupport</title>
-
- <para>
- As PrettyFaces renamed some packages you will have to update the class
name of
- the MultiPageMessagesSupport phase listener in your
<code>faces-config.xml</code>:
- </para>
-
- <programlisting><![CDATA[<lifecycle>
- <phase-listener>
- com.ocpsoft.pretty.faces.event.MultiPageMessagesSupport
- </phase-listener>
-</lifecycle>]]></programlisting>
-
</simplesect>
</section>
=======================================
--- /prettyfaces/trunk/docs/src/main/docbook/en-US/config/Annotations.xml
Mon Aug 23 08:39:41 2010
+++ /prettyfaces/trunk/docs/src/main/docbook/en-US/config/Annotations.xml
Tue Nov 9 10:23:42 2010
@@ -376,52 +376,9 @@
The other option to tell PrettyFaces about your beans names is
to implement a custom <code>BeanNameResolver</code>. PrettyFaces
already
ships with resolver implementations for the most common environments.
- If your environment is not supported, you can easily create your own
resolver.
+ If your environment is not supported, you can easily <link
linkend="ELBeanNameResolver">create your own resolver</link>.
</para>
- <para>
- The following example shows a resolver that will resolve the bean
name
- by searching for a <code>@Named</code> annotation.
- </para>
-
- <programlisting><![CDATA[public class MyBeanNameResolver implements
BeanNameResolver {
-
- public boolean init(ServletContext servletContext, ClassLoader
classLoader) {
- // tell PrettyFaces that initialization was successful
- return true;
- }
-
- public String getBeanName(Class<?> clazz) {
-
- // try to find @Named annotation
- Named annotation = clazz.getAnnotation(Named.class);
-
- // return name attribute if annotation has been found
- if(annotation != null) {
- return annotation.value();
- }
-
- // we don't know the name
- return null;
-
- }
-
-}]]></programlisting>
-
- <para>
- To let PrettyFaces know about your resolver, you'll have to register
your
- implementation by creating a file named
-
<code>META-INF/services/com.ocpsoft.pretty.faces.el.BeanNameResolver</code>
- in your classpath and add the fully-qualified class name of your
implementation
- class there.
- </para>
-
- <programlisting>
-
<filename>META-INF/services/com.ocpsoft.pretty.faces.el.BeanNameResolver</filename>
- com.example.prettyfaces.MyBeanNameResolver
- </programlisting>
-
-
</section>
</section>
=======================================
--- /prettyfaces/trunk/docs/src/main/docbook/en-US/master.xml Wed Oct 6
09:50:13 2010
+++ /prettyfaces/trunk/docs/src/main/docbook/en-US/master.xml Tue Nov 9
10:23:42 2010
@@ -15,6 +15,7 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="Rewriting_inbound.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="Rewriting_outbound.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="Custom_components.xml" />
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="Extensions.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="Feedback_contributing.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="Updating.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="FAQ.xml" />
=======================================
---
/prettyfaces/trunk/impl-jsf2/src/main/java/com/ocpsoft/pretty/faces/el/resolver/ManagedBeanAnnotationResolver.java
Wed Jun 30 11:26:10 2010
+++
/prettyfaces/trunk/impl-jsf2/src/main/java/com/ocpsoft/pretty/faces/el/resolver/ManagedBeanAnnotationResolver.java
Tue Nov 9 10:23:42 2010
@@ -3,18 +3,18 @@
import javax.faces.bean.ManagedBean;
import javax.servlet.ServletContext;
-import com.ocpsoft.pretty.faces.el.BeanNameResolver;
+import com.ocpsoft.pretty.faces.spi.ELBeanNameResolver;
/**
* <p>
- * Implementation of {@link BeanNameResolver} handling beans configured
via the
+ * Implementation of {@link ELBeanNameResolver} handling beans configured
via the
* JSF 2.0 ManagedBean annotation.
* </p>
*
* @author Christian Kaltepoth
*
*/
-public class ManagedBeanAnnotationResolver implements BeanNameResolver
+public class ManagedBeanAnnotationResolver implements ELBeanNameResolver
{
/*