<div dir="ltr">Hi,<div><br></div><div style>Sounds generally good to me.</div><div style><br></div><div style>If i remember correctly, we once also thought about actually having two validation interceptors (one for parameter, one for return value validation), in order to ensure that parameter as well as return value validation happens "late" (to avoid surprises due to other interceptors modifying the values).</div>
<div style><br></div><div style>This option is off the table? If so, I think doing parameter validation late and thus return value validation early as suggested seems like the right option, since I'd expect parameter validation to be the more common use case.</div>
<div style><br></div><div style>--Gunnar</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/2/5 Emmanuel Bernard <span dir="ltr"><<a href="mailto:emmanuel@hibernate.org" target="_blank">emmanuel@hibernate.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Hello group,</div><div><br></div><div>I have been coordinating with the platform spec to give CDI interceptors for method validation a late priority. We had to build both the notion of priority and the notion of constructor interceptors.</div>
<div><br></div><div>Quickly read through this email which capture the result of the priority discussions. IMO the agreed proposal is good. </div><div><br></div><div>Emmanuel<br><br>Begin forwarded message:<br><br></div><blockquote type="cite">
<div><b>From:</b> Linda DeMichiel <<a href="mailto:linda.demichiel@oracle.com" target="_blank">linda.demichiel@oracle.com</a>><br><b>Date:</b> 5 février 2013 03:48:30 UTC+01:00<br><b>To:</b> Emmanuel Bernard <<a href="mailto:emmanuel.bernard@jboss.com" target="_blank">emmanuel.bernard@jboss.com</a>><br>
<b>Cc:</b> Bill Shannon <<a href="mailto:bill.shannon@oracle.com" target="_blank">bill.shannon@oracle.com</a>>, Marina Vatkina <<a href="mailto:marina.vatkina@oracle.com" target="_blank">marina.vatkina@oracle.com</a>><br>
<b>Subject:</b> <b>Fwd: [jsr342-experts] Re: Priority of interceptors</b><br><br></div></blockquote><blockquote type="cite"><div><span>Hi Emmanuel,</span><br><span></span><br><span>Setting the priority for Bean Validation to PLATFORM_AFTER+800 is</span><br>
<span>fine with me as well. This belongs in the Bean Validation spec, so</span><br><span>please proceed with that.</span><br><span></span><br><span>thanks,</span><br><span></span><br><span>-Linda</span><br><span></span><br>
<span></span><br><span>-------- Original Message --------</span><br><span>Subject: [jsr342-experts] Re: Priority of interceptors</span><br><span>Date: Mon, 04 Feb 2013 14:26:15 -0800</span><br><span>From: Bill Shannon <<a href="mailto:bill.shannon@oracle.com" target="_blank">bill.shannon@oracle.com</a>></span><br>
<span>Reply-To: <a href="mailto:jsr342-experts@javaee-spec.java.net" target="_blank">jsr342-experts@javaee-spec.java.net</a></span><br><span>To: <a href="mailto:jsr342-experts@javaee-spec.java.net" target="_blank">jsr342-experts@javaee-spec.java.net</a></span><br>
<span>CC: Emmanuel Bernard <<a href="mailto:ebernard@redhat.com" target="_blank">ebernard@redhat.com</a>>, Paul Parkinson <<a href="mailto:paul.parkinson@oracle.com" target="_blank">paul.parkinson@oracle.com</a>>, Marina Vatkina <<a href="mailto:marina.vatkina@oracle.com" target="_blank">marina.vatkina@oracle.com</a>></span><br>
<span></span><br><span>Linda DeMichiel wrote on 02/04/13 11:53:</span><br><blockquote type="cite"><span>Feedback and questions regarding interceptor priority from</span><br></blockquote><blockquote type="cite"><span>the Bean Validation spec lead. Please weigh in as appropriate</span><br>
</blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>thanks,</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>-Linda</span><br>
</blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>On 2/4/2013 11:10 AM, Emmanuel Bernard wrote:</span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span>(Linda, can you forward to the jsr342 list, I don't think I have write</span><br>
</blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>access).</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><span>Thanks for this work.</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">
<span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>## Question</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite"><span>The spec claims:</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite"><span>An interceptor bound to a component using interceptor binding, may be enabled</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">
<blockquote type="cite"><span>for the entire applica- tion by applying the Priority annotation, along with</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">
<span>a priority value, on the interceptor class.</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">
<span>Does that mean that without @Priority, the interceptor is not enabled</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>for the entire application?</span><br></blockquote></blockquote>
<span></span><br><span>Unless you enable it in beans.xml.</span><br><span></span><br><blockquote type="cite"><blockquote type="cite"><span>And to clarify my doubts, you still enforce</span><br></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><span>that the binding annotation must be present for the interceptor to be</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>applied on a given method or class, correct?</span><br>
</blockquote></blockquote><span></span><br><span>I believe that's still a requirement.</span><br><span></span><br><blockquote type="cite"><blockquote type="cite"><span>## Proposal</span><br></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Have you guys considered adding a END_OF_PLATFORM_AFTER = 5000 so that</span><br></blockquote></blockquote>
<blockquote type="cite"><blockquote type="cite"><span>if for some reasons, people want to go after Java EE platform elements,</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>they can do so.</span><br>
</blockquote></blockquote><span></span><br><span>I suppose we could consider it.</span><br><span></span><br><blockquote type="cite"><blockquote type="cite"><span>BTW, I think the spec should clarify that negative priority are accepted</span><br>
</blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>and that signed number ordering happen.</span><br></blockquote></blockquote><span></span><br><span>We already decided to reserve negative numbers for a future use.</span><br>
<span></span><br><blockquote type="cite"><blockquote type="cite"><span>## Bean Validation priority</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote>
<blockquote type="cite"><blockquote type="cite"><span>If we go with that route (allocating 1000 to the platform_after</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>section), I'm tempted to place Bean Validation priority to</span><br>
</blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>PLATFORM_AFTER+800.</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote>
<blockquote type="cite"><blockquote type="cite"><span>Why? Well:</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">
<span>1. it makes for a beautiful symmetry with JTA :)</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>2. and it reflects our opinion that BV should happen relatively late</span><br>
</blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>just like JTA should happen relatively early, but still offer an open</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">
<span>door to override these propositions.</span><br></blockquote></blockquote><span></span><br><span>Seems fine to me.</span><br><span></span><br><blockquote type="cite"><blockquote type="cite"><span>Emmanuel</span><br></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>On Thu 2013-01-31 11:22, Linda DeMichiel wrote:</span><br></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>The revisions to the Interceptor spec to accommodate the improved</span><br>
</blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>managed bean alignment are nearly complete. You can download the</span><br></blockquote></blockquote></blockquote>
<blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>current draft of the spec from the <a href="http://interceptor-spec.java.net" target="_blank">interceptor-spec.java.net</a> project</span><br></blockquote>
</blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>at <a href="http://java.net/projects/interceptors-spec/downloads" target="_blank">http://java.net/projects/interceptors-spec/downloads</a></span><br>
</blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">
<span>One of the issues that we still need to resolve, however, is the</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>assignment of priorities to the new transactional interceptors being</span><br>
</blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>defined by JTA and the Bean Validation interceptors that handle</span><br></blockquote></blockquote></blockquote>
<blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>method validation.</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br>
</blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>Section 5.5 of the Interceptors spec defines the following Priority</span><br></blockquote></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>values (see the spec for the details):</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">
<blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>Interceptor.Priority.PLATFORM_BEFORE = 0</span><br></blockquote>
</blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>Interceptor.Priority.LIBRARY_BEFORE = 1000</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">
<blockquote type="cite"><span>Interceptor.Priority.APPLICATION = 2000</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>Interceptor.Priority.LIBRARY_AFTER = 3000</span><br>
</blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>Interceptor.Priority.PLATFORM_AFTER = 4000</span><br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>In our earlier discussions, we concluded that transactional</span><br>
</blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>interceptors needed to come relatively early in the interceptor chain.</span><br></blockquote></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>To put a stake in the ground, we propose that we define these to have</span><br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite"><span>a priority of Interceptor.Priority.PLATFORM_BEFORE+200.</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">
<span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>Validation interceptors, however, should come relatively late,</span><br></blockquote></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>since they will ensure that the parameters that reach the method</span><br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite"><span>(which might have been modified by other interceptors) are valid.</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">
<span>Again, to put a stake in the ground, we'll propose a priority of</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>Interceptor.Priority.PLATFORM_AFTER+1000.</span><br>
</blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">
<span>Comments please!</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite"><span>Emmanuel, Paul, could you please consult with your expert groups</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">
<span>for further input as well...</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite"><span>thanks,</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>-Linda</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br>
</blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">
<span></span><br></blockquote></blockquote></blockquote><span></span><br></div></blockquote></div><br>_______________________________________________<br>
beanvalidation-dev mailing list<br>
<a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br></blockquote></div><br></div>