4 Replies Latest reply on Mar 24, 2009 9:48 AM by thorgull

    Converters in version 2.1.1

    thorgull

      This topic is about this patch JBSEAM-2402
      This patch force the use of the BypassInterceptors annotation on component annoted with Converter or Validator


      First, I think this patch disable a major feature of Seam : Injecting things in Converter and Validators. This is a step back to plain-old-JSF.


      Second, The commiters of that patch fix a Component called filmConverter in the examples, because the example does not deploy anymore after the patch.
      But with that fix, the component will surely deploy but will certainly not work. because the filmConverter rely on interceptor to inject an EntityManager.
      (see revision 9423 in FishEye)


      Finally, There is no way to disable that new feature. This mean that old application are stuck to the version prior 2.1.1.CR1 or 2.0.3.CR2 of Seam...
      (I think a change like this one should not have bean 'backported'.)
      There should be a parameter in configuration or in web context, like allowNonStrictConverter or so.

        • 1. Re: Converters in version 2.1.1
          norman

          I don't recall what the issue was, but according to the JIRA there was a reason we couldn't easily support that behavior.  You should contact the person who did the work to find out the issues.  Perhaps you'll be able to contribute a solution to the problem and restore this behavior.

          • 2. Re: Converters in version 2.1.1

            I think it works like this (I'm not really really sure though): The instantiation of a converter is done from JSF and not Seam. Seam has some set with all @Converter where it tries to match requests from JSF.


            Since C/V aren't intercepted, it's better to force the programmer to get deployment error than getting an error that might be hard to debug. The same thoughts are behind the make sure C/V implement Validator/Converter interface bug. It helps the developer.


            If injection could be solved to work with C/V, file a patch so we could add it. This would be quite nice.


            Regarding the filmConverter, it doesn't look to be used anywhere and it probably never worked...


            Cheers

            • 3. Re: Converters in version 2.1.1
              thorgull

              This JIRA entry is classified as New Feature not as Bug


              The initial comment was Although it may be possible to make them work with injection its not trivial, so much better to force the user of programmatic lookup


              Have a nice day.

              • 4. Re: Converters in version 2.1.1
                thorgull

                Hi,
                Thank you for this quick response.


                What you said sounds pretty odd to me, because with Seam 2.0.1.GA injection in Converter actually work... in many of our applications.
                We only encouter probleme with Scope of converters.


                When you said that filmConverter is used nowhere, I can agree, because the annotation is @org.jboss.seam.annotations.faces.Converter(forClass=Film.class) and this mean that the converter will be used for any value of type Film if no converter is specified explicitly. And if you look in the file /examples/ui/view/selectItems.xhtml you'l find this



                <s:decorate template="decorateField.xhtml">
                     <ui:define name="label">Favourite Film</ui:define>
                     <ui:define name="description">Film uses <code>@Converter(forClass="...")</code> - there is no converter specified in the facelet</ui:define>
                     <h:selectOneListbox value="#{person.favouriteFilm}">
                          <s:selectItems value="#{films.resultList}" var="film"
                               label="#{film.name} directed by #{film.director}" noSelectionLabel="Please Select..."/>
                     </h:selectOneListbox>
                </s:decorate>




                The #{person.favouriteFilm} value binding is of type Film and then the filmConvert should be used.


                Also note the comment of the Field "Film uses <code>"@Converter(forClass \= "...")"</code> - there is no converter specified in the facelet"




                Maybe there is another change in Seam 2.1 that make this not working anymore, I our application with Seam 2.1 but without the JBSEAM-2402 correction to see what append. If the patch is truely needed, I think an explanation of 'why' will un-frustrate some user.


                Cheers.