Return-Path: X-Original-To: apmail-myfaces-users-archive@www.apache.org Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 16D14EF5C for ; Wed, 5 Dec 2012 03:48:41 +0000 (UTC) Received: (qmail 85262 invoked by uid 500); 5 Dec 2012 03:48:40 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 84917 invoked by uid 500); 5 Dec 2012 03:48:39 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 84859 invoked by uid 99); 5 Dec 2012 03:48:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Dec 2012 03:48:38 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gturner@unzane.com designates 184.105.220.20 as permitted sender) Received: from [184.105.220.20] (HELO azathoth.unzane.com) (184.105.220.20) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Dec 2012 03:48:32 +0000 Received: from zoth-ommog.unzane.com (zoth-ommog.unzane.com [IPv6:2001:470:e861::8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "zoth-ommog.unzane.com", Issuer "CAcert Class 3 Root" (verified OK)) by mail.unzane.com (Postfix) with ESMTPS id B0171240076 for ; Tue, 4 Dec 2012 19:48:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=unzane.com; s=mail; t=1354679291; bh=LExEwY0wkwKyqRoz/R58OenGS8dfd2qEHBoGsopG1Fw=; h=From:To:Subject:In-Reply-To:References:Date:From; b=JkBImhAcuAcDQZhwtf09nigY4SN7Oi0+2XkB+EYlYWZa2uPPztBGmYav6ECjAA168 KLb63DGC4XeUSB06ReuzebqED66c0LhU1YmLQptmyzUcK62EWQUR/prfN+WZbVT8Sz 1ag6a5wsMKqtF1q00ge4k5UzPQNC4RODR301ARQE= Received: by zoth-ommog.unzane.com (Postfix, from userid 1000) id 06DFE11B0072; Tue, 4 Dec 2012 19:48:11 -0800 (PST) From: Gerald Turner To: "MyFaces Discussion" Subject: Re: Bug EXTVAL-130? In-Reply-To: (Gerhard Petracek's message of "Tue, 4 Dec 2012 23:03:22 +0100") References: <87a9ttfvwp.fsf@zoth-ommog.unzane.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Face: "W];.?_H%>pNFRH&Q,:krZ>##I-,/Amy=($Mfy{aW5KR1F{kbD:ElXd{pLW'5L!2rhI/$|7 R\LU=FijzO8vUv.t0^YwT~!AK[bX6d]?j4!s=-m&E~B]=zGdY4c MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Virus-Checked: Checked by ClamAV on apache.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Gerhard, thanks for the response! Gerhard Petracek writes: > @codi + seam > yes - that's possible. > it depends on what you are using from both. > e.g. in case of the jsf-module of codi + seam-faces you have to veto > one of the producers for the FacesContext. Exactly, jsf/faces modules from both. Is vetoing done with ClassDeactivator and writing a service-loader file? > @ "No CreationalContext registered for EL evaluation, it is likely > that the the expression factory has not been wrapped by the CDI > BeanManager, which must be done to use the ELResolver from CDI": > > ... sounds like an as7 issue. it occurs during the rendering process > (see e.g. UIComponentBase#encodeBegin) -> as7 has to ensure that all > parts of cdi and jsf are up and running. I spent some time digging around the issue going on a tip from JIRA issue EXTVAL-140 (thanks Igor Guimaraes) - looks like it's a Weld bug. Weld ELResolver#getValue implementation will fail unless it's nested in a stack evaluating a Weld ValueExpression or MethodExpression. OTOH, ValueExpression#getValue works every time. Even stranger is that when I revert the project from CODI to Seam3, Weld ELResolver#getValue will return nulls instead of throwing an exception. Attached is a dummy RENDER_RESPONSE PhaseListener that exhibits the bug (all the "tryELResolver" tests fail while all the "tryValueExpression" tests succeed). I'll work on reporting this to Weld. Is there any chance a work-around could be added to ExtVal 2.0.7-SNAPSHOT? (i.e. using a ValueExpression instead of ELResolver for BV startup) > @enabling injection via @Advanced: > the only known (and already fixed) issue is [1]. Is there a public maven repository where I can link 1.0.6-SNAPSHOT? > just fyi (since you wrote "JSR-303 cross-field validation"). > annotations like @DateIs were introduced before the bv-spec. was > released and don't use the bv-api at all (that's the reason why they > are in a different validation module). > you would need e.g. [2] to use the bv-api with a thin layer to allow > bv based cross-field validation. I was wrong about my original statement that cross-field validation wasn't working (whereas @DateIs was working)=E2=80=A6 they're both working. I had this question on the mailing list in March and you pointed me at the extension then too. I didn't have to use the extension you wrote. I'm using the following ExtVal-BV annotation on the fields of a CDI bean that I want cross-validation: @BeanValidation(modelValidation=3D@ModelValidation(isActive=3Dtrue)) =E2=80=A6this has been working great - am I missing something? =2D- Gerald Turner Email: gturner@unzane.com JID: gturner@unzane.com GPG: 0xFA8CD6D5 21D9 B2E8 7FE7 F19E 5F7D 4D0C 3FA0 810F FA8C D6D5 --=-=-= Content-Type: text/x-java Content-Disposition: inline; filename=TestPhaseListener.java package net.concentric.icrwebtool.util; import java.util.logging.Level; import java.util.logging.Logger; import javax.el.ELContext; import javax.el.ELResolver; import javax.el.ExpressionFactory; import javax.el.ValueExpression; import javax.enterprise.context.Dependent; import javax.enterprise.context.RequestScoped; import javax.enterprise.inject.Produces; import javax.faces.application.Application; import javax.faces.context.FacesContext; import javax.faces.event.PhaseEvent; import javax.faces.event.PhaseId; import javax.faces.event.PhaseListener; import javax.inject.Named; @SuppressWarnings("serial") public class TestPhaseListener implements PhaseListener { private final static Logger log = Logger.getLogger(TestPhaseListener.class.getName()); @Override public void beforePhase(PhaseEvent event) { tryTests("Before " + event.getPhaseId()); } @Override public void afterPhase(PhaseEvent event) { tryTests("After " + event.getPhaseId()); } @Override public PhaseId getPhaseId() { return PhaseId.RENDER_RESPONSE; } @Named("testRequestScoped") @Produces @RequestScoped @SuppressWarnings("unused") private TestObject getTestRequestScoped() { TestObject object = new TestObject(); object.setMessage("Hello RequestScoped!"); return object; } @Named("testDependent") @Produces @Dependent @SuppressWarnings("unused") private TestObject getTestDependent() { TestObject object = new TestObject(); object.setMessage("Hello Dependent!"); return object; } private void tryTests(String label) { log.info("tryTests: " + label); tryELResolver(label, "testRequestScoped"); tryValueExpression(label, "testRequestScoped"); tryELResolver(label, "testDependent"); tryValueExpression(label, "testDependent"); tryELResolver(label, "contextAwareValidatorFactory"); tryValueExpression(label, "contextAwareValidatorFactory"); } private void tryELResolver(String label, String name) { try { FacesContext facesContext = FacesContext.getCurrentInstance(); ELResolver resolver = facesContext.getApplication().getELResolver(); ELContext elContext = facesContext.getELContext(); Object object = resolver.getValue(elContext, null, "contextAwareValidatorFactory"); log.info("tryELResolver: " + label + ": Resolved " + name + ": " + object); } catch (Throwable e) { log.log(Level.WARNING, "tryELResolver: " + label + ": Failed to resolve " + name + ": " + e.getMessage()); } } private void tryValueExpression(String label, String name) { try { FacesContext facesContext = FacesContext.getCurrentInstance(); ELContext elContext = facesContext.getELContext(); Application application = facesContext.getApplication(); ExpressionFactory expressionFactory = application.getExpressionFactory(); ValueExpression valueExpression = expressionFactory.createValueExpression(elContext, name, Object.class); Object object = valueExpression.getValue(elContext); log.info("tryValueExpression: " + label + ": Resolved " + name + ": " + object); } catch (Throwable e) { log.log(Level.WARNING, "tryValueExpression: " + label + ": Failed to resolve " + name + ": " + e.getMessage()); } } } --=-=-= Content-Type: text/x-java Content-Disposition: inline; filename=TestObject.java package net.concentric.icrwebtool.util; import java.io.Serializable; import java.util.logging.Logger; import javax.annotation.PostConstruct; @SuppressWarnings("serial") public class TestObject implements Serializable { private final static Logger log = Logger.getLogger(TestObject.class.getName()); private String message; public String getMessage() { return message; } public void setMessage(String message) { log.finest("setMessage: Message set to " + message + " on " + this); this.message = message; } @PostConstruct @SuppressWarnings("unused") private void postConstruct() { log.finest("postConstruct: Constructed " + this); } } --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAlC+w/kACgkQP6CBD/qM1tWjkwCdEj/KpCTo7zQkxlCFUsWS+wzm yu4An1X+9IKaJp4M0eCyMbdUywZ7beUG =syqc -----END PGP SIGNATURE----- --==-=-=--