Before or after servlet filters have run?<br><br>-Clint<br><br><div class="gmail_quote">On Sat, May 30, 2009 at 4:08 PM, Gavin King <span dir="ltr">&lt;<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">The point is that the container would be required to fire it on *all*<br>
servlet requests.<br>
<div><div></div><div class="h5"><br>
On Sat, May 30, 2009 at 2:08 PM, Clint Popetz &lt;<a href="mailto:cpopetz@gmail.com">cpopetz@gmail.com</a>&gt; wrote:<br>
&gt; I presume this event is only being fired from the WebBeansPhaseListener and<br>
&gt; won&#39;t exist for non-faces requests?<br>
&gt;<br>
&gt; -Clint<br>
&gt;<br>
&gt; On Sat, May 30, 2009 at 3:41 PM, Gavin King &lt;<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Or we could say it is an event that is observable by Extensions:<br>
&gt;&gt;<br>
&gt;&gt;   void request(@Observes BeforeRestoreConversation brc) {<br>
&gt;&gt;       brc.setId( brc.getRequest().getParameter(&quot;specialcid&quot;) );<br>
&gt;&gt;   }<br>
&gt;&gt;<br>
&gt;&gt; where we define the following interface:<br>
&gt;&gt;<br>
&gt;&gt;   public interface BeforeRestoreConversation {<br>
&gt;&gt;      String getId();<br>
&gt;&gt;      void setId(String id);<br>
&gt;&gt;      ServletContext getContext();<br>
&gt;&gt;      HttpServletRequest getRequest();<br>
&gt;&gt;   }<br>
&gt;&gt;<br>
&gt;&gt; This seems to me like the better option, WDYT?<br>
&gt;&gt;<br>
&gt;&gt; On Sat, May 30, 2009 at 1:31 PM, Gavin King &lt;<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt; On Sat, May 30, 2009 at 12:43 PM, Gavin King &lt;<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a>&gt;<br>
&gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; Looking at the Conversation public API I don&#39;t see any programmatic<br>
&gt;&gt; &gt;&gt;&gt; way to restore a conversation.  Perhaps we should add such an API?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Ugh, I really didn&#39;t want to go there in this release, though it<br>
&gt;&gt; &gt;&gt; would, very clearly, be a very useful feature.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; If we were going to go there, the way I would do it is to say that the<br>
&gt;&gt; &gt;&gt; conversation context is defined for all servlet requests, but it is by<br>
&gt;&gt; &gt;&gt; default transient. The container would be required to call back to<br>
&gt;&gt; &gt;&gt; Extensions to obtain a conversation id.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Actually, upon reflection, I think we need to do this :-/<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Because even in JSF, we want a way to customize the mechanism for<br>
&gt;&gt; &gt; conversation propagation.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; So we could say that an Extension may optionally implement this<br>
&gt;&gt; &gt; interface:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;    public interface ConversationExtension {<br>
&gt;&gt; &gt;        String getConversationId(HttpServletRequest request,<br>
&gt;&gt; &gt; ServletContext context);<br>
&gt;&gt; &gt;    }<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; And say that before any Filter is called, the container calls all<br>
&gt;&gt; &gt; ConversationExtensions looking for a conversation id, and if it finds<br>
&gt;&gt; &gt; one, restores the conversation.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Alternatively, we could say that the conversation is only restored<br>
&gt;&gt; &gt; *after* all ServletFilters have been called, and say that the<br>
&gt;&gt; &gt; container looks in a specially-named request attribute, for example<br>
&gt;&gt; &gt; &quot;javax.contexts.spi.conversationId&quot;. Then we would not need a special<br>
&gt;&gt; &gt; interface, and any servlet filter could do conversation management.<br>
&gt;&gt; &gt; This seems more elegant, but means you don&#39;t get a conversation<br>
&gt;&gt; &gt; context in your filters.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; WDYT?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt; Gavin King<br>
&gt;&gt; &gt; <a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a><br>
&gt;&gt; &gt; <a href="http://in.relation.to/Bloggers/Gavin" target="_blank">http://in.relation.to/Bloggers/Gavin</a><br>
&gt;&gt; &gt; <a href="http://hibernate.org" target="_blank">http://hibernate.org</a><br>
&gt;&gt; &gt; <a href="http://seamframework.org" target="_blank">http://seamframework.org</a><br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Gavin King<br>
&gt;&gt; <a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a><br>
&gt;&gt; <a href="http://in.relation.to/Bloggers/Gavin" target="_blank">http://in.relation.to/Bloggers/Gavin</a><br>
&gt;&gt; <a href="http://hibernate.org" target="_blank">http://hibernate.org</a><br>
&gt;&gt; <a href="http://seamframework.org" target="_blank">http://seamframework.org</a><br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; webbeans-dev mailing list<br>
&gt;&gt; <a href="mailto:webbeans-dev@lists.jboss.org">webbeans-dev@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/webbeans-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/webbeans-dev</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Clint Popetz<br>
&gt; <a href="http://42lines.net" target="_blank">http://42lines.net</a><br>
&gt; Scalable Web Application Development<br>
&gt;<br>
<br>
<br>
<br>
</div></div>--<br>
<div><div></div><div class="h5">Gavin King<br>
<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a><br>
<a href="http://in.relation.to/Bloggers/Gavin" target="_blank">http://in.relation.to/Bloggers/Gavin</a><br>
<a href="http://hibernate.org" target="_blank">http://hibernate.org</a><br>
<a href="http://seamframework.org" target="_blank">http://seamframework.org</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Clint Popetz<br><a href="http://42lines.net">http://42lines.net</a><br>Scalable Web Application Development<br>