This could be a path that components.xml could be heading down also? You could have a SeamConfig bean that could be generated from a XML document, looked up in JNDI etc that could then be injected wherever needed (or modified by extensions before taken into use)<br>
<br><div class="gmail_quote">On Fri, Feb 19, 2010 at 6:58 AM, Stuart Douglas <span dir="ltr">&lt;<a href="mailto:stuart@baileyroberts.com.au">stuart@baileyroberts.com.au</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
<br>
I have been thinking about the replacement for pages.xml. Even though JSF2 has made some aspects of pages.xml redundant, pages.xml is still important as it allows you to apply actions/security setting etc to a large number of pages at once using wildcards. With that said however it would be nice to move to a design that is more typesafe and extensible. I have come up with a preliminary idea of how this might work, I will explain with an example:<br>

<br>
@PageMetadata<br>
public @Interface SecurityConfig<br>
{<br>
   boolean loginRequired();<br>
   String restrict();<br>
}<br>
<br>
/**<br>
 * This bean will only be considered for injection when the context path is<br>
 * /app/restricted/*, and it is the most specific page available.<br>
 */<br>
@ViewId(&quot;/app/restricted/*&quot;)<br>
@SecurityConfig(loginRequired=true)<br>
public class RestrictedArea extends Page<br>
{<br>
<br>
}<br>
<br>
This may also be configured via XML using seam-xml.<br>
There is nothing special about the page class, it is an empty class<br>
that is provided solely to be configured with annotations:<br>
<br>
&lt;Page&gt;<br>
  &lt;ViewId&gt;/app/restricted/*&lt;/ViewId&gt;<br>
  &lt;SecurityConfig loginRequired=&quot;true&quot; /&gt;<br>
&lt;/Page&gt;<br>
<br>
The application can get access to this information in a number of ways:<br>
<br>
@Inject PageDataProvider&lt;SecurityConfig&gt; data;<br>
<br>
public void doStuff()<br>
{<br>
  //get the most specific result<br>
  SecurityConfig security = data.get();<br>
<br>
  //get all applicable results<br>
  List&lt;SecurityConfig&gt; secinfo = data.getAll();<br>
<br>
  //secinfo is ordered from most to least specific,<br>
  //secinfo.get(0) will be equal to data.get()<br>
<br>
}<br>
<br>
Alternatively the most specific result can be injected directly:<br>
<br>
@Inject SecurityConfig data;<br>
<br>
We could also support an event based approach:<br>
<br>
public void pageEvent(@Observes @Rendered(&quot;/secure/*&quot;) Page page, SecurityConfig config)<br>
{<br>
  //do stuff<br>
}<br>
<br>
Does this sound like a good approach? I am fairly sure all this can be implemented as a portable extension.<br>
<br>
_______________________________________________<br>
seam-dev mailing list<br>
<a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/seam-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/seam-dev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>---<br>Nik<br>