Adding a custom HTTP header to all requests

2016-03-18 Thread l.pe...@senat.fr

Hi.

I am starting to use "JSON Web Tokens" ( https://jwt.io/ ).

I implemented a tomcat valve checking those tokens and generating new 
ones transparently when another valve (such as BasicAuthenticator) takes 
care of the initial authentication.
This stuff works and I can use it in a JS client app by setting the 
"Authorization" header with the token on every HTTP request.


Is there a way  I can do the same with JSF ?

Thanks in advance,

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: java.lang.IllegalStateException: Must be called before the start element is closed (attribute 'id')

2015-11-20 Thread l.pe...@senat.fr

On 19/11/2015 11:01, l.pe...@senat.fr wrote:

On 18/11/2015 17:53, l.pe...@senat.fr wrote:

On 17/11/2015 13:11, l.pe...@senat.fr wrote:

On 17/11/2015 01:21, Howard W. Smith, Jr. wrote:
On Mon, Nov 16, 2015 at 2:59 PM, l.pe...@senat.fr 
<l.pe...@senat.fr> wrote:


  java.lang.IllegalStateException: Must be called before the start 
element

is closed (attribute 'id')
 at
org.apache.myfaces.shared.renderkit.html.HtmlResponseWriterImpl.writeAttribute(HtmlResponseWriterImpl.java:816) 




Searched google and found the following:

http://myfaces.apache.org/shared11/myfaces-shared-core/xref/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.html#318 



Maybe, you can start there. Seems as though you id="..." on one of 
your

components may need to be fixed.

Thanks for the suggestion, but it is alas not that simple.


I think I found what causes the bug...

I mentioned that I use :

PrimeFaces 5.3.1
MyFaces 2.2.8
OpenWebBeans 1.6.2


I forgot to mention that I also use :

omnifaces 1.10


I also noticed that the bug happens when :
* an ajax request is triggered
* the session is expired (for some reason I have yet to found, but it 
is another problem)


The access to the ajax requested page is controlled by the container 
with a  declaration in the webapp web.xml file.


In that case

OmniPartialViewContext.java#startDocument performs a redirect
https://github.com/omnifaces/omnifaces/blob/master/src/main/java/org/omnifaces/context/OmniPartialViewContext.java#L275 



and so, an opened document with an active element is *not* the 
current sate.


When returning from this function, up to
org.apache.myfaces.context.servlet.PartialViewContextImpl.processPartialRendering#471 



there is just after, line 473 :

writer.writeAttribute("id", 
viewRoot.getContainerClientId(_facesContext),"id");


IMHO, MyFaces is right to expect to have an opened document at this 
point... So I will see with BalusC if we can imagine a patch to 
omnifaces.

The newer 1.1x version, the 1.11, is not different on this point.

For the record and people who might follow this thread...
I posted a question on this topic on stackoverflow : 
http://stackoverflow.com/questions/33786117/bug-with-omnifaces-1-10-when-omnipartialviewcontextstartdocument-performs-trans
This is fixed in omnifaces 2.2-SNAPSHOT and will be available in 
omnifaces 1.12.


https://github.com/omnifaces/omnifaces/issues/183#issuecomment-158347582

Ludovic



|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: java.lang.IllegalStateException: Must be called before the start element is closed (attribute 'id')

2015-11-19 Thread l.pe...@senat.fr

On 18/11/2015 17:53, l.pe...@senat.fr wrote:

On 17/11/2015 13:11, l.pe...@senat.fr wrote:

On 17/11/2015 01:21, Howard W. Smith, Jr. wrote:
On Mon, Nov 16, 2015 at 2:59 PM, l.pe...@senat.fr <l.pe...@senat.fr> 
wrote:


  java.lang.IllegalStateException: Must be called before the start 
element

is closed (attribute 'id')
 at
org.apache.myfaces.shared.renderkit.html.HtmlResponseWriterImpl.writeAttribute(HtmlResponseWriterImpl.java:816) 




Searched google and found the following:

http://myfaces.apache.org/shared11/myfaces-shared-core/xref/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.html#318 



Maybe, you can start there. Seems as though you id="..." on one of your
components may need to be fixed.

Thanks for the suggestion, but it is alas not that simple.


I think I found what causes the bug...

I mentioned that I use :

PrimeFaces 5.3.1
MyFaces 2.2.8
OpenWebBeans 1.6.2


I forgot to mention that I also use :

omnifaces 1.10


I also noticed that the bug happens when :
* an ajax request is triggered
* the session is expired (for some reason I have yet to found, but it 
is another problem)


The access to the ajax requested page is controlled by the container 
with a  declaration in the webapp web.xml file.


In that case

OmniPartialViewContext.java#startDocument performs a redirect
https://github.com/omnifaces/omnifaces/blob/master/src/main/java/org/omnifaces/context/OmniPartialViewContext.java#L275 



and so, an opened document with an active element is *not* the current 
sate.


When returning from this function, up to
org.apache.myfaces.context.servlet.PartialViewContextImpl.processPartialRendering#471 



there is just after, line 473 :

writer.writeAttribute("id", 
viewRoot.getContainerClientId(_facesContext),"id");


IMHO, MyFaces is right to expect to have an opened document at this 
point... So I will see with BalusC if we can imagine a patch to 
omnifaces.

The newer 1.1x version, the 1.11, is not different on this point.

For the record and people who might follow this thread...
I posted a question on this topic on stackoverflow : 
http://stackoverflow.com/questions/33786117/bug-with-omnifaces-1-10-when-omnipartialviewcontextstartdocument-performs-trans


Regards,

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: java.lang.IllegalStateException: Must be called before the start element is closed (attribute 'id')

2015-11-18 Thread l.pe...@senat.fr

On 17/11/2015 13:11, l.pe...@senat.fr wrote:

On 17/11/2015 01:21, Howard W. Smith, Jr. wrote:
On Mon, Nov 16, 2015 at 2:59 PM, l.pe...@senat.fr <l.pe...@senat.fr> 
wrote:


  java.lang.IllegalStateException: Must be called before the start 
element

is closed (attribute 'id')
 at
org.apache.myfaces.shared.renderkit.html.HtmlResponseWriterImpl.writeAttribute(HtmlResponseWriterImpl.java:816) 




Searched google and found the following:

http://myfaces.apache.org/shared11/myfaces-shared-core/xref/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.html#318 



Maybe, you can start there. Seems as though you id="..." on one of your
components may need to be fixed.

Thanks for the suggestion, but it is alas not that simple.


I think I found what causes the bug...

I mentioned that I use :

PrimeFaces 5.3.1
MyFaces 2.2.8
OpenWebBeans 1.6.2


I forgot to mention that I also use :

omnifaces 1.10


I also noticed that the bug happens when :
* an ajax request is triggered
* the session is expired (for some reason I have yet to found, but it is 
another problem)


The access to the ajax requested page is controlled by the container 
with a  declaration in the webapp web.xml file.


In that case

OmniPartialViewContext.java#startDocument performs a redirect
https://github.com/omnifaces/omnifaces/blob/master/src/main/java/org/omnifaces/context/OmniPartialViewContext.java#L275

and so, an opened document with an active element is *not* the current sate.

When returning from this function, up to
org.apache.myfaces.context.servlet.PartialViewContextImpl.processPartialRendering#471

there is just after, line 473 :

writer.writeAttribute("id", 
viewRoot.getContainerClientId(_facesContext),"id");


IMHO, MyFaces is right to expect to have an opened document at this 
point... So I will see with BalusC if we can imagine a patch to omnifaces.

The newer 1.1x version, the 1.11, is not different on this point.

Thanks,

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: java.lang.IllegalStateException: Must be called before the start element is closed (attribute 'id')

2015-11-17 Thread l.pe...@senat.fr

On 17/11/2015 01:21, Howard W. Smith, Jr. wrote:

On Mon, Nov 16, 2015 at 2:59 PM, l.pe...@senat.fr <l.pe...@senat.fr> wrote:


  java.lang.IllegalStateException: Must be called before the start element
is closed (attribute 'id')
 at
org.apache.myfaces.shared.renderkit.html.HtmlResponseWriterImpl.writeAttribute(HtmlResponseWriterImpl.java:816)


Searched google and found the following:

http://myfaces.apache.org/shared11/myfaces-shared-core/xref/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.html#318

Maybe, you can start there. Seems as though you id="..." on one of your
components may need to be fixed.

Thanks for the suggestion, but it is alas not that simple.

As far as I understand...
In response to an AJAX request, 
PartialViewContextImpl#processPartialRendering is called.


Lines 468 and following is :

String currentEncoding = writer.getCharacterEncoding();
writer.writePreamble("(currentEncoding == null ? "UTF-8" : currentEncoding) 
+"\"?>");

writer.startDocument();

writer.writeAttribute("id", 
viewRoot.getContainerClientId(_facesContext),"id");


The exception is triggered when the attribute is set. An element is 
opened (and, as far as I understand, not closed) by writer.startDocument();


If ones goes up in the stack, and take a look at 
org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1891) 
https://myfaces.apache.org/core22/myfaces-impl/xref/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.html#1891 
, one can read
lots of comments which makes me think that things are not simple and 
that there might be side effects in some complex cases.



I see that I forgot to indicate the versions I am using...

PrimeFaces 5.3.1
MyFaces 2.2.8
OpenWebBeans 1.6.2

All this running on Tomcat 8.0.22 (in dev) or 8.0.28 (in prod).

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



java.lang.IllegalStateException: Must be called before the start element is closed (attribute 'id')

2015-11-16 Thread l.pe...@senat.fr

Dear all,

I randomly get the following exception in one of my apps :

16-Nov-2015 16:36:35.980 SEVERE [http-apr-8444-exec-10] 
org.omnifaces.exceptionhandler.FullAjaxExceptionHandler.logException 
FullAjaxExceptionHandler: An exception occurred during rendering JSF 
ajax response. Error page '/error.xhtml' will be shown.
 java.lang.IllegalStateException: Must be called before the start 
element is closed (attribute 'id')
at 
org.apache.myfaces.shared.renderkit.html.HtmlResponseWriterImpl.writeAttribute(HtmlResponseWriterImpl.java:816)
at 
javax.faces.context.ResponseWriterWrapper.writeAttribute(ResponseWriterWrapper.java:109)
at 
org.apache.myfaces.context.PartialResponseWriterImpl.writeAttribute(PartialResponseWriterImpl.java:407)
at 
javax.faces.context.ResponseWriterWrapper.writeAttribute(ResponseWriterWrapper.java:109)
at 
javax.faces.context.ResponseWriterWrapper.writeAttribute(ResponseWriterWrapper.java:109)
at 
org.apache.myfaces.context.servlet.PartialViewContextImpl.processPartialRendering(PartialViewContextImpl.java:473)
at 
org.apache.myfaces.context.servlet.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:415)
at 
org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:60)
at 
javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:85)
at 
javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:516)
at 
javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:541)
at 
org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1891)
at 
org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:313)
at 
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:58)
at 
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:58)
at 
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:58)
at 
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:58)
at 
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:58)
at 
org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:116)
at 
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:267)
at 
org.apache.deltaspike.jsf.impl.listener.request.DeltaSpikeLifecycleWrapper.render(DeltaSpikeLifecycleWrapper.java:111)
at 
javax.faces.lifecycle.LifecycleWrapper.render(LifecycleWrapper.java:31)
at 
org.apache.deltaspike.jsf.impl.listener.request.JsfClientWindowAwareLifecycleWrapper.render(JsfClientWindowAwareLifecycleWrapper.java:160)
at 
org.apache.deltaspike.jsf.impl.listener.request.DeltaSpikeLifecycleWrapper.render(DeltaSpikeLifecycleWrapper.java:111)
at 
javax.faces.lifecycle.LifecycleWrapper.render(LifecycleWrapper.java:31)
at 
org.apache.deltaspike.jsf.impl.listener.request.JsfClientWindowAwareLifecycleWrapper.render(JsfClientWindowAwareLifecycleWrapper.java:160)

at javax.faces.webapp.FacesServlet.service(FacesServlet.java:200)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)
at 
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)
at 
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
at 
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
at 
org.apache.catalina.authenticator.FormAuthenticator.forwardToLoginPage(FormAuthenticator.java:384)
at 
org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:229)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:577)
at 
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at 

Re: c:forEach issue in JSF 2

2015-07-01 Thread l.pe...@senat.fr

On 01/07/2015 10:08, khush N wrote:

Hi,

Thanks for the quick reply!

Sorry, I do not have a sample project. But c:forEach aren't working on a
simplest of page for me :(

Did you put your code inside a h:form ?

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: c:forEach issue in JSF 2

2015-07-01 Thread l.pe...@senat.fr

On 01/07/2015 09:42, khush N wrote:
[...]
Can anyone please help me in understanding as to why the c:forEach tag 
is not working. I have huge code which is using forEach tag. With 
upgrade, I will have to remove every forEach if it is no more 
supported in JSF2 :( Thanks in advance! 

Do you have a test project I can clone ?

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: c:forEach issue in JSF 2

2015-07-01 Thread l.pe...@senat.fr

On 01/07/2015 10:01, khush N wrote:

Hi Thomas,

Thank you for the quick reply!

I am using JSF 2.2. As mentioned in my previous email, I have huge code
base which is using c:forEach tag. So, it would be really great if I can
figure out the real issue with c:forEach.

If there is not other way to make c:forEach work, I will have to switch to
ui:repeat.

ui:repeat is not an equivalent of c:forEach.

c:forEach is evaluated when building the component tree.
ui:repeat is evaluated after the component tree is build.

So, code such as :

p:dataTable ...
c:forEach ...
p:row
...
/p:row
/c:forEach
/p:dataTable

Will generate p:row  components according to your c:forEach, which will 
be taken in account by the p:dataTable component.

But this will not work with ui:repeat.

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: @WebFilter not called when forwarding to login page

2015-03-13 Thread l.pe...@senat.fr

On 12/03/2015 14:59, Romain Manni-Bucau wrote:

Can you share a project reproducing it?

I could not...
Well, I found a dirty workaround, so let's forget it.

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



@WebFilter not called when forwarding to login page

2015-03-12 Thread l.pe...@senat.fr

Dear all,

I have a legacy application which performs hibernate session attachement 
in a web filter.


It works, excepting, sometimes, on a redirect by the container to the 
login page.


In my web.xml, I have :

login-config
auth-methodFORM/auth-method
form-login-config
form-login-page/login.xhtml/form-login-page
form-error-page/login_failed.html/form-error-page
/form-login-config
/login-config


In login.xhtml, I use LogginBean to perform a programmatic login. This 
is where it just does not work sometimes.


My web filter is set up using

filter
filter-nameHibernateSessionConversationFilter/filter-name
filter-classfr.senat.faces.filters.HibernateSessionConversationFilter/filter-class
init-param
param-namelogin-page-timeout/param-name
param-value60/param-value
/init-param
/filter
filter-mapping
filter-nameHibernateSessionConversationFilter/filter-name
url-pattern*.xhtml/url-pattern
/filter-mapping

As you can see in the following stack trace, it is not called.

What should I do to get it called even in this case ?

Thanks in advance,

Ludovic

==

LoginBean.getRedirectPage:339
Hidden Source Calls
LoginBean$$OwbNormalScopeProxy0.getRedirectPage
GeneratedMethodAccessor373.invoke
DelegatingMethodAccessorImpl.invoke:43
Method.invoke:606
BeanELResolver.getValue:99
CompositeELResolver.getValue:67
FacesCompositeELResolver.getValue:179
AstValue.getValue:183
ValueExpressionImpl.getValue:184
ELText$ELTextVariable.writeText:219
ELText$ELTextComposite.writeText:131
TextInstruction.write:45
UIInstructions.encodeBegin:46
UILeaf.encodeAll:507
UIComponentBase.encodeAll:550
UIComponentBase.encodeAll:550
FaceletViewDeclarationLanguage.renderView:1891
ViewHandlerImpl.renderView:313
ViewHandlerWrapper.renderView:58
ViewHandlerWrapper.renderView:58
ViewHandlerWrapper.renderView:58
RenderResponseExecutor.execute:116
LifecycleImpl.render:267
DeltaSpikeLifecycleWrapper.render:111
LifecycleWrapper.render:31
FacesServlet.service:200
ApplicationFilterChain.internalDoFilter:303
ApplicationFilterChain.doFilter:208
Hidden Source Calls
WsFilter.doFilter:52
ApplicationFilterChain.internalDoFilter:241
ApplicationFilterChain.doFilter:208
ApplicationDispatcher.invoke:748
ApplicationDispatcher.processRequest:486
ApplicationDispatcher.doForward:411
ApplicationDispatcher.forward:338
FormAuthenticator.forwardToLoginPage:423
FormAuthenticator.authenticate:278
AuthenticatorBase.authenticate:683
AuthenticatorBase.invoke:473
StandardHostValve.invoke:170
ErrorReportValve.invoke:103
AccessLogValve.invoke:950
StandardEngineValve.invoke:116
CoyoteAdapter.service:421
AbstractHttp11Processor.process:1070
AbstractProtocol$AbstractConnectionHandler.process:611
JIoEndpoint$SocketProcessor.run:316
Hidden Source Calls
ThreadPoolExecutor.runWorker:1145
ThreadPoolExecutor$Worker.run:615
TaskThread$WrappingRunnable.run:61
Hidden Source Calls
Thread.run:745
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: Performance issue with component bindings and Ajax requests

2014-08-20 Thread l.pe...@senat.fr

On 20/08/2014 09:41, Marc Heinz wrote:

Thanks for the quick answer!

We tried disabling PSS but this actually broke several other things, so we
would prefer not to touch it right now.

Setting the flag org.apache.myfaces.REMOVING_COMPONENTS_BUILD however
seems to do the trick... (we though about using it before but we were
unsure about the possible implications).

I've created an issue as suggested:
https://issues.apache.org/jira/browse/MYFACES-3918

I will report any possible regression we find there, and I will test again
when a fix becomes available.
I am also interesting by this issue and ready to test a fix in the days 
to come.


Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



null Long values displayed as 0

2014-07-16 Thread l.pe...@senat.fr

Dear all,

I just finished to struggle with the display of nullable Long or Integer 
values. I am using Primefaces 5.0.1 / MyFaces 2.2.4 / OpenWebBeans 1.2.2 
/ Tomcat 7.0.39.


Those values are the result of the evaluation of EL expressions that I 
create with the following function :


public static ValueExpression createValueExpression(String 
expression, Class clazz) {

FacesContext fc = FacesContext.getCurrentInstance();
ELContext elContext = fc.getELContext();
FacesELContext felContext = (FacesELContext)fc.getELContext();
SenatFunctionMapper sfm = SenatFunctionMapper.getInstance();
felContext.setFunctionMapper(sfm);
ExpressionFactory expFactory = 
fc.getApplication().getExpressionFactory();

ValueExpression ret = null;
if(clazz==null) {
clazz = Object.class;
}
try {
ret = expFactory.createValueExpression(elContext, 
expression, clazz);

} catch (ELException ex) {
log.fatal(Erreur de compilation de l'expression EL : 
' + expression + ', ex);

}
return ret;
}

Until now, I created those value expressions with the real expected 
class as the third parameter of ExpressionFactory#createValueExpression. 
The name of this parameter is expectedType, so it seems logical to me 
to provide the best information I had. So, I provided 
java.lang.Integer.class or java.lang.Long.class, etc.


But when I do that, null values are displayed as 0, either with 
h:inputText (standard MyFaces control) or p:inputText (PrimeFaces version).


The reason being that

org.apache.el.ValueExpressionImpl#getValue

is implemented the following way

@Override
public Object getValue(ELContext context) throws 
PropertyNotFoundException,

ELException {
EvaluationContext ctx = new EvaluationContext(context, 
this.fnMapper,

this.varMapper);
Object value = this.getNode().getValue(ctx);
if (this.expectedType != null) {
return ELSupport.coerceToType(value, this.expectedType);
}
return value;
}

and that ELSupport.coerceToType of a Long or Integer null value is 
defined as... 0


As those type are numeric, coerceToType calls coerceToNumber, which 
starts with :


public static final Number coerceToNumber(final Object obj,
final Class? type) throws ELException {
if (obj == null || .equals(obj)) {
return coerceToNumber(ZERO, type);
}
...
}

thus, the ZERO value.

For the time being, I solved my «problem» by passing a null third 
parameter to ExpressionFactory#createValueExpression. It works. It has 
no apparent drawbacks. But I don't get the logic of it. Should'nt 
ELSupport#coerceToNumber handles this differently ?


Thanks in advance for your explanations,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: null Long values displayed as 0

2014-07-16 Thread l.pe...@senat.fr

On 16/07/2014 19:15, titou10 titou10 wrote:

Maybe you could try to add property
org.apache.el.parser.COERCE_TO_ZERO=false to your JVM
Denis/MTL

No, COERCE_TO_ZERO is useful in the opposite way, when submitting the value.
BTW, I already use it.

Thx anyway.

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: FlowScope beans are being added to the FlowScope.

2014-07-04 Thread l.pe...@senat.fr

On 04/07/2014 06:52, Paul Spencer wrote:

MyFaces 2.2.3   2.2.4
jetty-maven-plugin:8.1.15.v20140411

FlowScope beans are being added to the FlowScope.  I suspect this is related to 
the message below.
  
   org.apache.myfaces.util.ExternalSpecifications isCDIAvailable

   INFO: MyFaces CDI support disabled

What dependencies are need to enable CDI?
I use DeltaSpike 1.0.0 with MyFaces 2.2.4 and OpenWebBeans 1.2.2 on 
tomcat 7 (7.0.39).


Apart from the fact that this stack performs well and has some nice 
extras, such as vdl.createComponent, the main advantage I see in using 
it is that people from those projects work together with those 
components. So it is easier to get support.


I also use PrimeFaces and OmniFaces, but it seems to me that their 
development is less tightly coupled (especially for omnifaces, as it 
seems to me that BalusC is glassfish/weld oriented).


I can send you my pom.xml if this can help you.

Best regards,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: NPE when view pooling / CACHE_EL_EXPRESSIONS == alwaysRecompile

2014-06-19 Thread l.pe...@senat.fr

On 19/06/2014 17:22, Leonardo Uribe wrote:

Hi

I have checked the problem in deep and I was not able to reproduce the
problem. The reason is view pooling algorithm saves UIViewRoot state
fully (markInitialState is set to false, and the state is used later
to clone the views), and that also includes the binding table for
tags, so this table should be always saved and restored correctly.
Really it is not a problem if you set EL cache mode to strict, because
if you are using view pool in that view, enable or disable EL cache
will have minimal effect.

It should be some additional not seen element that is making it fail,
or in other words, it should be a combination between different
things, but it is impossible to understand it without an example.

Thank your for investigating the problem.

I agree with you : it is a combination of several things. Unhappily, I 
could not prepare a short example reproducing the problem without 
publishing significant portions of a codebase I am not allowed to 
publish (yet).


 Thanks again,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: Tag component instantiation and EL strict or alwaysRecompile modes

2014-06-10 Thread l.pe...@senat.fr

On 05/06/2014 07:27, Leonardo Uribe wrote:

Hi

Use the standard vdl.createComponent(...) included since JSF 2.2. It has
the necessary code to do the trick properly. Please note in Myfaces this
method has been extend to support facelet tags too. It should work with the
view pool.

Thank you Leonardo.

I updated my code to use this method and it perfectly works. I could 
remove those naughty introspections, and that is always a long term bless.


Best regards,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



NPE when view pooling / CACHE_EL_EXPRESSIONS == alwaysRecompile

2014-06-10 Thread l.pe...@senat.fr
(republished here following the advice of Gerhard Petracek on 
us...@deltaspike.apache.org)


Dear all,

I have the following NPE when view pooling is activated and 
CACHE_EL_EXPRESSIONS is set to alwaysRecompile :


java.lang.NullPointerException at 
org.apache.myfaces.view.facelets.el.FaceletStateValueExpression.getValue(FaceletStateValueExpression.java:107) 
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:68) at 
org.apache.el.parser.AstValue.getValue(AstValue.java:161) at 
org.apache.el.parser.AstEmpty.getValue(AstEmpty.java:47) at 
org.apache.el.parser.AstNot.getValue(AstNot.java:44) at 
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:185) 
at 
org.apache.myfaces.view.facelets.el.ContextAwareTagValueExpression.getValue(ContextAwareTagValueExpression.java:96) 
at 
javax.faces.component._DeltaStateHelper.eval(_DeltaStateHelper.java:377) 
at 
javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1211) 
at 
javax.faces.component.UIComponentBase._isPhaseExecutable(UIComponentBase.java:2440) 
at 
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1386) 
at 
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1401) 
at 
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1401) 
at 
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1401) 
at 
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1401) 
at javax.faces.component.UIForm.processDecodes(UIForm.java:154) at 
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1401) 
at 
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1401) 
at 
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1401) 
at 
javax.faces.component.UIViewRoot._processDecodesDefault(UIViewRoot.java:1687) 
at javax.faces.component.UIViewRoot.access$500(UIViewRoot.java:77) at 
javax.faces.component.UIViewRoot$ApplyRequestValuesPhaseProcessor.process(UIViewRoot.java:1778) 
at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1653) at 
javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:869) at 
org.apache.myfaces.lifecycle.ApplyRequestValuesExecutor.execute(ApplyRequestValuesExecutor.java:42) 
at 
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:196) 
at 
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:143) 
at 
org.apache.deltaspike.jsf.impl.listener.request.DeltaSpikeLifecycleWrapper.execute(DeltaSpikeLifecycleWrapper.java:89) 
at 
javax.faces.lifecycle.LifecycleWrapper.execute(LifecycleWrapper.java:46) 
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198) at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) 
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
at 
fr.senat.faces.filters.HibernateNoCacheFilter.doFilter(HibernateNoCacheFilter.java:123) 
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
at 
fr.senat.faces.filters.HibernateSessionConversationFilter.doFilter(HibernateSessionConversationFilter.java:128) 
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
at 
fr.senat.faces.filters.HibernateUserFromPrincipalFilter.doFilter(HibernateUserFromPrincipalFilter.java:43) 
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
at 
fr.senat.faces.filters.SessionCreationTrackingFilter.doFilter(SessionCreationTrackingFilter.java:48) 
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) 
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) 
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581) 
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) 
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) 
at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947) at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) 
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) 
at 
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009) 
at 

Re: Read Server Ip and Port inside JSF

2014-06-05 Thread l.pe...@senat.fr

On 05/06/2014 14:59, Georg Füchsle wrote:

Hallo,

my Application is deployed inside a Firewall and/or behind a Load-Balancer.

My application provies a web-app and an web-service. At some time i have to
call my own web-service from the web-app. In this case I have to use the
internal URL of my server.

At another time I have to give the public URL of my web-app to an interface
to other apps or services. In that caes i have to use the external URL of
my web-app. ( That is the URL of the firewall
or the load balancer)

For example:

The App is deployed internal on the Server with the name webserver1. So the
internal URL would be:

http://webserver1:8080/myapp/

But from outside the office I have to call the Url of the Firewall/Load
balancer:

http::// www.mycompany.com/myapp/



I found a way to read the current URL from the request:

HttpServletRequest request = (HttpServletRequest)
FacesContext.getCurrentInstance().getExternalContext().getRequest();
URL reconstructedURL;
reconstructedURL = new URL(request.getScheme(), request.getServerName(),
request.getServerPort(), );

But the result is the internal URL, when the User is using the internal URL
and the external URL, when the user is using the external URL.


Is there a possibility to read  the internal server-name and port in any
case?
This is not exactly your question, but I have a similar problem when I 
have to get the real source address of a forwarded request.


I use this function in this case :

public static String getRemoteAddr(HttpServletRequest req) {
String forwardedFor = req.getHeader(X-Forwarded-For);
if(StringUtils.isNotBlank(forwardedFor)) {
return forwardedFor.split(\\s*,\\s*, 2)[0]; // liste 
d'adresses de la forme : client, proxy1, proxy2, etc.

}
return req.getRemoteAddr();
}

I guess, but do not have a requyest to your server at hand to check it, 
that there must be a header in your request that you can analyse in a 
similar way to get what you are looking for.
With forwardedFor.split(\\s*,\\s*, 2)[1] , I guess that you would have 
your public address.


Hope this helps.

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: Read Server Ip and Port inside JSF

2014-06-05 Thread l.pe...@senat.fr

On 05/06/2014 18:31, Georg Füchsle wrote:

Hallo Ludovic,

thanks for Your answer. But it didn't work for me. In my example the header:
String forwardedFor = req.getHeader(X-Forwarded-For)
was null.

I also found this link:
http://stackoverflow.com/questions/3867197/get-the-server-port-number-from-tomcat-with-out-a-request
But also there I didnt find an answer. Maybe I will make a configuration
for the internal URL and use this. The administrators will damn me.
Did you try to inspect the request with a tool such as Firebug ? I would 
be very suprised that you have no header where to find what you want.
If not, your admins should really setup the proxies so that they add 
such a header.


Best regards,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Tag component instantiation and EL strict or alwaysRecompile modes

2014-06-04 Thread l.pe...@senat.fr

Dear all,

I am doing something dirty in my code. I dynamically instantiate and add 
tag components to my component tree, according to some information that 
I have at runtime.


My instantiation method looks like :

public static UIComponent instantiateTagComponent(Location loc, 
String namespace, String localPrefix, String componentName, 
TagComponentParam params[]) {
final String ERROR_MESSAGE = Erreur lors de l'instanciation 
d'un tag component;

FacesContext ctx = FacesContext.getCurrentInstance();
AbstractFaceletContext fctx = (AbstractFaceletContext) 
ctx.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);

fctx.pushPageContext(new PageContextImpl());

FaceletViewDeclarationLanguage vdl = new 
FaceletViewDeclarationLanguage(ctx);


UIPanel panel = (UIPanel) ctx.getApplication().createComponent( 
UIPanel.COMPONENT_TYPE );


try {
Method createCompiler = 
FaceletViewDeclarationLanguage.class.getDeclaredMethod(createCompiler,FacesContext.class);
Method createFaceletFactory = 
FaceletViewDeclarationLanguage.class.getDeclaredMethod(createFaceletFactory,FacesContext.class,org.apache.myfaces.view.facelets.compiler.Compiler.class);

createCompiler.setAccessible(true);
createFaceletFactory.setAccessible(true);
org.apache.myfaces.view.facelets.compiler.Compiler compiler 
= (org.apache.myfaces.view.facelets.compiler.Compiler) 
createCompiler.invoke(vdl, ctx);
FaceletFactory ff = (FaceletFactory) 
createFaceletFactory.invoke(vdl, ctx, compiler);

TagLibrary tl = compiler.createTagLibrary();
TagConfig tc = new JSFUtilsTagUnit(tl, namespace, 
localPrefix, componentName,params,loc);
TagHandler th = tl.createTagHandler(namespace, 
componentName, tc);
Field declaredField = 
FaceletCompositionContext.class.getDeclaredField(FACELET_COMPOSITION_CONTEXT_KEY);

declaredField.setAccessible(true);
FaceletCompositionContextImpl faceletCompositionContextImpl 
= new FaceletCompositionContextImpl(ff,ctx);
Class? dfcClass = 
Class.forName(org.apache.myfaces.view.facelets.impl.DefaultFaceletContext);

Field fMCTX = dfcClass.getDeclaredField(_mctx);
fMCTX.setAccessible(true);
fMCTX.set(fctx, faceletCompositionContextImpl);
FacesContext.getCurrentInstance().getAttributes().put((String)declaredField.get(null),faceletCompositionContextImpl);
FaceletCompositionContext mctx = 
(FaceletCompositionContext) 
FaceletCompositionContext.getCurrentInstance(fctx);

mctx.startComponentUniqueIdSection();
th.apply( fctx, panel );
} catch (IOException ex) {
log.error(ERROR_MESSAGE, ex);
} catch (InvocationTargetException ex) {
log.error(ERROR_MESSAGE, ex);
} catch (NoSuchMethodException ex) {
log.error(ERROR_MESSAGE, ex);
} catch (NoSuchFieldException ex) {
log.error(ERROR_MESSAGE, ex);
} catch (SecurityException ex) {
log.error(ERROR_MESSAGE, ex);
} catch (ClassNotFoundException ex) {
log.error(ERROR_MESSAGE, ex);
} catch (IllegalArgumentException ex) {
log.error(ERROR_MESSAGE, ex);
} catch (IllegalAccessException ex) {
log.error(ERROR_MESSAGE, ex);
}
finally {
fctx.popPageContext();
}
return panel;
}

This is dirty, but this perfectly works for quite some time now, at 
least until I stick to


context-param
param-nameorg.apache.myfaces.CACHE_EL_EXPRESSIONS/param-name
param-valuestrict/param-value
/context-param


if I change it to alwaysRecompile, the state is not properly restored 
and I end with and NPE like :


04/06/2014 12:29:41 ERROR [http-bio-8443-exec-56] - Exception occur!
java.lang.NullPointerException
at 
org.apache.myfaces.view.facelets.el.FaceletStateValueExpression.getValue(FaceletStateValueExpression.java:107)

at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:68)
at 
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:185)
at 
org.apache.myfaces.view.facelets.el.ContextAwareTagValueExpression.getValue(ContextAwareTagValueExpression.java:96)
at 
javax.faces.component._DeltaStateHelper.eval(_DeltaStateHelper.java:360)

at javax.faces.component.UIParameter.getValue(UIParameter.java:85)
at 
org.apache.myfaces.shared.renderkit.html.HtmlLinkRendererBase.addChildParametersToHref(HtmlLinkRendererBase.java:762)
at 
org.apache.myfaces.shared.renderkit.html.HtmlLinkRendererBase.renderOutputLinkStart(HtmlLinkRendererBase.java:861)
at 
org.apache.myfaces.shared.renderkit.html.HtmlLinkRendererBase.encodeBegin(HtmlLinkRendererBase.java:144)
at 
javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:596)
at 

Re: @FlowScoped, @Named and @ManagedBean

2014-02-13 Thread l.pe...@senat.fr

On 13/02/2014 19:01, Leonardo Uribe wrote:

Hi

Thanks for the example. It helps to clarify the problem. The
definition of the flow has a problem:

 @Produces
 @FlowDefinition
 public Flow defineFlow(@FlowBuilderParameter FlowBuilder flowBuilder) {
 String flowId = flux;
 flowBuilder.id(, flowId);
 flowBuilder.viewNode(flowId,
 / + flowId + / + flowId + .xhtml).
 markAsStartNode();
/*flowBuilder.returnNode(returnFromFlux).
 fromOutcome(#{flowScopedBean.return});*/

 return flowBuilder.getFlow();
 }

In this part:

flowBuilder.viewNode(flowId,
 / + flowId + / + flowId + .xhtml).
 markAsStartNode();

you are using the flow id as a viewNodeId. That confuses the
navigation algorithm because the spec says that an outcome can be a
flowId, and in that sense a flowId is a global identifier that cannot
be reused. The fix is just set another id:

 flowBuilder.viewNode(start,
 / + flowId + / + flowId + .xhtml).
 markAsStartNode();

The example only requires some small changes in FlowScopedBean and that's it.
ok for this one, I will try it tomorrow. And can you tell me what was 
wrong with XML file (or the empty XML file) ?


Thank you,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: @FlowScoped, @Named and @ManagedBean

2014-02-12 Thread l.pe...@senat.fr

On 12/02/2014 00:42, Thomas Andraschko wrote:

Can't you just switch to DS?
I gave a look to «migrate codi 1.x to deltaspike 0.5» by someone who 
seems to know a bit on this topic, posts on this mailing list and is 
also known a Gerhard Petracek :-)


http://os890.blogspot.fr/2013/10/migrate-codi-1x-to-deltaspike-05.html

And so I try to apply the dependenc changes from
https://raw.github.com/os890/tomee_mf_stack_001/master/pom.xml

to

https://raw.github.com/os890/tomee_mf_stack_001/codi2ds/pom.xml

I was however stopped at build time by the lack of
- @ProjectStageActivated
- @Advanced

I can easily live without @ProjectStageActivated (used to activate a 
phase listener in debug, something which help me a lot when I started to 
pla with JSF but that I do not need anymore) and I am now trying to 
figure how not to use @Advanced.


I am using this annotation to make converters and validators eligible 
injection targets. I think I can also retrieve beans by EL-expressions, 
with simple code such as


public class MyHelperClass {
public static T T findBean(String name) {
if ((name == null) || name.isEmpty()) {
return null;
}
return evaluateExpression(#{ + name + });
}

@SuppressWarnings(unchecked)
public static T T evaluateExpression(String expr) {
if ((expr == null) || expr.isEmpty()) {
return null;
}
FacesContext fc = FacesContext.getCurrentInstance();
return (T) fc.getApplication().evaluateExpressionGet(fc,
expr, Object.class);
}
}

MyHelperClass.findBean(toto);

I will try that and keep you posted.

Thanks,

Ludovic


|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


Re: @FlowScoped, @Named and @ManagedBean

2014-02-12 Thread l.pe...@senat.fr

On 12/02/2014 10:22, Gerhard Petracek wrote:

hi ludovic,

@ProjectStageActivated is called @Exclude in deltaspike and you can just
drop @Advanced.


ok, thank you.

I still had the same situation with deltaspike (0.5 + your 
os890-cdi-ext-jsf2-module-api and os890-cdi-ext-jsf2-module-impl or 
0.6-SNAPSHOT).


So, I digged the clientwindow topic... I read in 
https://weblogs.java.net/blog/edburns/archive/2013/10/07/jsf-22-clientwindow-links-and-open-new-tab


that

« Because the Faces Flows feature entirely depends 
on|ClientWindow|, the usage of Faces Flows will automatically 
enable|ClientWindow|if it is not enabled already»


However, it is not in my case.

So I explicitly enabled this with adding

  context-param
param-namejavax.faces.CLIENT_WINDOW_MODE/param-name
   param-valueurl/param-value
 /context-param

in web.xml.


It there some other required config that I should check ?

Thanks in avdance,

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


Re: @FlowScoped, @Named and @ManagedBean

2014-02-12 Thread l.pe...@senat.fr

On 12/02/2014 10:37, l.pe...@senat.fr wrote:

On 12/02/2014 10:22, Gerhard Petracek wrote:

hi ludovic,

@ProjectStageActivated is called @Exclude in deltaspike and you can just
drop @Advanced.


ok, thank you.

I still had the same situation with deltaspike (0.5 + your 
os890-cdi-ext-jsf2-module-api and os890-cdi-ext-jsf2-module-impl or 
0.6-SNAPSHOT).


So, I digged the clientwindow topic... I read in 
https://weblogs.java.net/blog/edburns/archive/2013/10/07/jsf-22-clientwindow-links-and-open-new-tab


that

« Because the Faces Flows feature entirely depends 
on|ClientWindow|, the usage of Faces Flows will automatically 
enable|ClientWindow|if it is not enabled already»


However, it is not in my case.

So I explicitly enabled this with adding

  context-param
param-namejavax.faces.CLIENT_WINDOW_MODE/param-name
   param-valueurl/param-value
 /context-param

in web.xml.


It there some other required config that I should check ?

ok, so with:
* deltaspike 0.6-SNAPSHOT
* org.os890.cdi.ext.scope.modules:os890-cdi-ext-jsf2-module-{api,impl} 
:1.0.5_0.5_01}

* javax.faces.CLIENT_WINDOW_MODE = url

... it is starting to work.

In fact, I could trigger flow transitions only using a h:link for now.

So neither
* p:menuitem value=Let's test outcome=flow1 /  in a PF p:menubar
* p:commandButton value=Let's test 2 action=flow1 /
* h:commandButton value=Let's test 3 action=flow1 /
* h:commandButton value=Let's test 4 action=/flow1 /
* h:commandButton value=Let's test 5 action=/flow1/flow1 /
* a direct transition to /flow1/flow1.xhtml (by typing the URL in the 
brower url bar)


work.

But
* h:link outcome=flow1Test 6/h:link
* h:link outcome=/flow1/flow1.xhtmlTest 7/h:link

do work.

By  working, I mean that the FlowHandler.FLOW_ID_REQUEST_PARAM_NAME 
(jffi) is defined, a transition is detected and FlowHandlerImpl 
processes it.


I found only one place defining it in myfaces 2.2 impl source, 
myfaces-impl-2.2.0/org/apache/myfaces/shared/renderkit/html/util/OutcomeTargetUtils.java:145 
, in

OutcomeTargetUtils.getOutcomeTargetHref .


Either I missed something big, either it does not fit my requirements.

When I read «Java EE 7 tutorial - 16.3 Using Faces Flows» 
http://docs.oracle.com/javaee/7/tutorial/doc/jsf-configure003.htm


syntaxes such as

h:commandButton value=Exit Flow action=returnFromCheckoutFlow/

seemed supported.

Moreover, I state that it works because I see a flow transition taking 
place. But I could not figure how to make it finally work (without ).


When I try to use an empty flow1-flow.xml, or to use a flow1-flow.xml 
such as


?xml version=1.0 encoding=UTF-8?
faces-config
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns='http://xmlns.jcp.org/xml/ns/javaee'
xsi:schemaLocation='http://xmlns.jcp.org/xml/ns/javaee 
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd'

version='2.2' 
flow-definition id=flow1
display-nameTest display name/display-name
descriptionTest description/description
flow-return id=success
from-outcome/accueil.xhtml/from-outcome
/flow-return
flow-return id=error
from-outcome/versions.xhtml/from-outcome
/flow-return
/flow-definition
/faces-config

(dummy test returns...)

there is a problem at the outcome computation step.

When I use a configuration class such as

public class Flow1 implements Serializable {

@Produces
@FlowDefinition
public Flow defineFlow(@FlowBuilderParameter FlowBuilder flowBuilder) {
String flowId = flow1;
flowBuilder.id(, flowId);
flowBuilder.viewNode(flowId,
/ + flowId + / + flowId + .xhtml).
markAsStartNode();
return flowBuilder.getFlow();
}
}

there is a first transition from no flow (being on /accueil.xhtml) to 
flow1 (going to /flow1/flow1.xhtml). flow1 is correctly stacked at 
this step.


But then, another transition from /flow1/flow1.xhtml to 
/flow1/flow1.xhtml is immediatly triggered by an automatically generated 
(I think) navigation case.  During this transition, flow1 is popped from 
stack and a null pointer exception occurs.


Any help welcomed... I would be glad to have a look at simple test cases 
using MyFaces 2.2.


But I might switch back to good old @ViewAccessScoped for the time being 
- spent some days on this Faces Flows stuff already.


Thanks for the help and work anyway. It is quite normal to me to have 
this kind of troubleshooting on new stuff...


Best regards,

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


Re: @FlowScoped, @Named and @ManagedBean

2014-02-12 Thread l.pe...@senat.fr

On 12/02/2014 15:13, Gerhard Petracek wrote:

hi ludovic,

the add-on is for: codi 1.0.5 - deltaspike 0.5 (that's the reason for:
1.0.5_0.5_01)
please don't use it with 0.6 (currently only @ViewAccessScoped is missing
in ds)
ok, I will do that as I do not need clientwindow support as long as I do 
not use Faces Flows


And I will keep an eye on 
https://issues.apache.org/jira/browse/DELTASPIKE-487 ;-)


Thx,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: @FlowScoped, @Named and @ManagedBean

2014-02-11 Thread l.pe...@senat.fr

On 11/02/2014 03:30, Leonardo Uribe wrote:

Hi

Thank you for your quick reply.
2014-02-10 11:56 GMT-05:00 l.pe...@senat.fr l.pe...@senat.fr:

Dear all,

I am starting to really use JSF 2.2. I am trying to use Faces Flows. I am
starting with a very simple flow, whose name is flow1.

So, under src/main/webapp, I have a flow1 directory containing

flow1-flow.xml
flow1.xhtml
flow1b.xhtml

flow1-flow.xml contains :

?xml version=1.0 encoding=UTF-8?
faces-config
 xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
 xmlns='http://xmlns.jcp.org/xml/ns/javaee'
 xsi:schemaLocation='http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd'
 version='2.2' 
 flow-definition id=flow1
 flow-return id=returnFromFlow1
 from-outcome/accueil/from-outcome
 /flow-return
 /flow-definition
/faces-config


With such a simple config, using conventions would be a better choice than
configuration, but I plan to add more things to it... :-)

I use a @FlowScoped bean declared this way :

@Named
@FlowScoped(flow1)
public class MinintFileContext implements Serializable {

 
}

and it does not work. I have the following exception :

javax.servlet.ServletException: javax.servlet.ServletException:
javax.el.ELException: javax.enterprise.context.ContextNotActiveException:
WebBeans context with scope type annotation @FlowScoped does not exist
within current thread


To make it work, I have to use @ManagedBean instead of @Named.

My first question is : I do not understand why... In my (obviously wrong)
understanding, @Named was a super-set of CDI-managed beans, including
@ManagedBean-s.



@FlowScoped annotation is for CDI only, so it will not work for JSF
managed beans. In your case, I believe the bean is instantiated but it
is not stored in any context, so once is created is discarded, giving
the impression that the bean is working but it is not.

In MyFaces it is possible to create a custom flow scope annotation for
other containers that works just like @FlowScoped, implementing
org.apache.myfaces.spi.FacesFlowProvider SPI interface. You are
already in CDI, so you don't need to bother about that.

I have seen @Named annotation working with Spring, so it is not
something specific for CDI, but @FlowScoped depends of CDI API.
I am using CODI 1.0.5 (I heavily use its @ViewAccessScoped annotation) 
with OpenWebBeans 1.2.1.


So, I thought  was ok on the CDI side...

...but after reading your mail, it seems to me that this CDI 
implementation was provided before JSF 2.2 release, and so that it must 
not include proper @FacesFlow support.


Should I switch to another implementation, like DeltaSpike ?

I must have misunderstood your mail from Sep 26 2013 ( 
http://myfaces.10567.n7.nabble.com/JSF-2-2-status-amp-snapshot-usage-td115852.html 
) inviting us to try Faces Flows in MyFaces 2.2.


Thanks again,

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


Re: @FlowScoped, @Named and @ManagedBean

2014-02-11 Thread l.pe...@senat.fr

On 11/02/2014 10:28, l.pe...@senat.fr wrote:

On 11/02/2014 03:30, Leonardo Uribe wrote:


[...]

@FlowScoped annotation is for CDI only, so it will not work for JSF
managed beans. In your case, I believe the bean is instantiated but it
is not stored in any context, so once is created is discarded, giving
the impression that the bean is working but it is not.

In MyFaces it is possible to create a custom flow scope annotation for
other containers that works just like @FlowScoped, implementing
org.apache.myfaces.spi.FacesFlowProvider SPI interface. You are
already in CDI, so you don't need to bother about that.

I have seen @Named annotation working with Spring, so it is not
something specific for CDI, but @FlowScoped depends of CDI API.
I am using CODI 1.0.5 (I heavily use its @ViewAccessScoped annotation) 
with OpenWebBeans 1.2.1.


So, I thought  was ok on the CDI side...

...but after reading your mail, it seems to me that this CDI 
implementation was provided before JSF 2.2 release, and so that it 
must not include proper @FacesFlow support.


Should I switch to another implementation, like DeltaSpike ?

I must have misunderstood your mail from Sep 26 2013 ( 
http://myfaces.10567.n7.nabble.com/JSF-2-2-status-amp-snapshot-usage-td115852.html 
) inviting us to try Faces Flows in MyFaces 2.2.

After some debugging, I found that :
* beans are discovered and processed ok by 
org.apache.myfaces.flow.cdi.FlowScopeCDIExtension

* -flow.xml is detected and processed with no errors ;
* if I use an empty -flow.xml file, an exception is raised line 716 of 
org.apache.myfaces.config.DefaultFacesConfigurationProvider (on 
facesConfig.getFacesFlowDefinitions().add(flow); )
* if I add a breakpoint in 
org.apache.myfaces.flow.FlowHandlerImpl#clientWindowTransition, I can see :

** my flow registered in _flowMapById (with flow1 key)
** my flow registered in _flowMapByDocumentId (with an empty key)
** that _facesFlowProvider is null

All suggestions welcomed !

Best regards,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: @FlowScoped, @Named and @ManagedBean

2014-02-11 Thread l.pe...@senat.fr

On 11/02/2014 14:51, l.pe...@senat.fr wrote:

On 11/02/2014 10:28, l.pe...@senat.fr wrote:

On 11/02/2014 03:30, Leonardo Uribe wrote:


[...]

@FlowScoped annotation is for CDI only, so it will not work for JSF
managed beans. In your case, I believe the bean is instantiated but it
is not stored in any context, so once is created is discarded, giving
the impression that the bean is working but it is not.

In MyFaces it is possible to create a custom flow scope annotation for
other containers that works just like @FlowScoped, implementing
org.apache.myfaces.spi.FacesFlowProvider SPI interface. You are
already in CDI, so you don't need to bother about that.

I have seen @Named annotation working with Spring, so it is not
something specific for CDI, but @FlowScoped depends of CDI API.
I am using CODI 1.0.5 (I heavily use its @ViewAccessScoped 
annotation) with OpenWebBeans 1.2.1.


So, I thought  was ok on the CDI side...

...but after reading your mail, it seems to me that this CDI 
implementation was provided before JSF 2.2 release, and so that it 
must not include proper @FacesFlow support.


Should I switch to another implementation, like DeltaSpike ?

I must have misunderstood your mail from Sep 26 2013 ( 
http://myfaces.10567.n7.nabble.com/JSF-2-2-status-amp-snapshot-usage-td115852.html 
) inviting us to try Faces Flows in MyFaces 2.2.

After some debugging, I found that :
* beans are discovered and processed ok by 
org.apache.myfaces.flow.cdi.FlowScopeCDIExtension

* -flow.xml is detected and processed with no errors ;
* if I use an empty -flow.xml file, an exception is raised line 716 of 
org.apache.myfaces.config.DefaultFacesConfigurationProvider (on 
facesConfig.getFacesFlowDefinitions().add(flow); )
* if I add a breakpoint in 
org.apache.myfaces.flow.FlowHandlerImpl#clientWindowTransition, I can 
see :

** my flow registered in _flowMapById (with flow1 key)
** my flow registered in _flowMapByDocumentId (with an empty key)
** that _facesFlowProvider is null


ok, I think I got it. And, as I feared, it seems to be CODI related.

In JSF2.2, a call to

//JSF 2.2: attach window
_lifecycle.attachWindow(facesContext);

has been added line 193 of javax.faces.webapp.FacesServlet

When you use CODI, _lifecycle is an instance of

org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper

This wrapper has been designed for JSF 2.0 and 2.1. So, it does not wrap 
the call to attachWindow. And Lifecycle#attachWindow, which does 
nothing, is called.


Later, when JSf tries to find my @FlowScoped bean, it fails in

org.apache.myfaces.flow.FlowHandlerImpl#getCurrentFlow , because client 
windos is null


(line 165 and following) :
ClientWindow clientWindow = 
context.getExternalContext().getClientWindow();

if (clientWindow == null)
{
return null;
}

So, I guess that I have to write a custom PhaseListener to solve this 
little glitch.


If you have a better solution, I will gladly take it.

Best regards,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



@FlowScoped, @Named and @ManagedBean

2014-02-10 Thread l.pe...@senat.fr

Dear all,

I am starting to really use JSF 2.2. I am trying to use Faces Flows. I 
am starting with a very simple flow, whose name is flow1.


So, under src/main/webapp, I have a flow1 directory containing

flow1-flow.xml
flow1.xhtml
flow1b.xhtml

flow1-flow.xml contains :

?xml version=1.0 encoding=UTF-8?
faces-config
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns='http://xmlns.jcp.org/xml/ns/javaee'
xsi:schemaLocation='http://xmlns.jcp.org/xml/ns/javaee 
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd'

version='2.2' 
flow-definition id=flow1
flow-return id=returnFromFlow1
from-outcome/accueil/from-outcome
/flow-return
/flow-definition
/faces-config


With such a simple config, using conventions would be a better choice 
than configuration, but I plan to add more things to it... :-)


I use a @FlowScoped bean declared this way :

@Named
@FlowScoped(flow1)
public class MinintFileContext implements Serializable {


}

and it does not work. I have the following exception :

javax.servlet.ServletException: javax.servlet.ServletException: 
javax.el.ELException: 
javax.enterprise.context.ContextNotActiveException: WebBeans context 
with scope type annotation @FlowScoped does not exist within current thread



To make it work, I have to use @ManagedBean instead of @Named.

My first question is : I do not understand why... In my (obviously 
wrong) understanding, @Named was a super-set of CDI-managed beans, 
including @ManagedBean-s.


Another question...

I am using PrimeFaces p:menubar . I noticed that I can not use /flow1 
as the outcome of a menuitem


Ex : p:menuitem value=Blah blah blah outcome=/flow1 /

I have to use

p:menuitem value=Blah blah blah outcome=/flow1/flow1 /

Why ? This might be a PF-specific question.


Finally, I am failing to use the flow-return configuration.

I tried

p:commandButton value=Terminer action=returnFromFlow1/

and

h:commandButton value=Terminer action=returnFromFlow1/

But it just does not work.

So, I tried to change the config to

flow-return id=returnFromFlow1
from-outcome#{minintFileContext.returnValue}/from-outcome
/flow-return

and added a

public String getReturnValue() {
return /accueil;
}

method to he MinintFileContext bean, but it does not work better.

Any idea ?

Thanks in advance



I have the following JSF-related or generic dependencies (I mean that I 
remove in-house dependencies from the following tree) :
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ 
faces-dependencies ---

[INFO] fr.senat:faces-dependencies:jar:4.0.0-SNAPSHOT
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] +- org.apache.tomcat:tomcat-catalina:jar:7.0.47:provided
[INFO] |  +- org.apache.tomcat:tomcat-servlet-api:jar:7.0.47:provided
[INFO] |  +- org.apache.tomcat:tomcat-juli:jar:7.0.47:provided
[INFO] |  +- org.apache.tomcat:tomcat-annotations-api:jar:7.0.47:provided
[INFO] |  +- org.apache.tomcat:tomcat-api:jar:7.0.47:provided
[INFO] |  \- org.apache.tomcat:tomcat-util:jar:7.0.47:provided
[INFO] +- org.apache.myfaces.core:myfaces-api:jar:2.2.0:compile
[INFO] +- org.apache.myfaces.core:myfaces-impl:jar:2.2.0:compile
[INFO] |  +- commons-collections:commons-collections:jar:3.2:compile
[INFO] |  +- commons-codec:commons-codec:jar:1.3:compile
[INFO] |  +- commons-beanutils:commons-beanutils:jar:1.8.3:compile
[INFO] |  |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] |  \- commons-digester:commons-digester:jar:1.8:compile
[INFO] +- 
org.apache.myfaces.extensions.cdi.modules:myfaces-extcdi-jsf20-module-api:jar:1.0.5:compile
[INFO] |  \- 
org.apache.myfaces.extensions.cdi.core:myfaces-extcdi-core-api:jar:1.0.5:compile
[INFO] +- 
org.apache.myfaces.extensions.cdi.modules:myfaces-extcdi-jsf20-module-impl:jar:1.0.5:runtime
[INFO] +- 
org.apache.myfaces.extensions.cdi.modules:myfaces-extcdi-jpa1-module-api:jar:1.0.5:compile
[INFO] +- 
org.apache.myfaces.extensions.cdi.modules:myfaces-extcdi-jpa1-module-impl:jar:1.0.5:runtime
[INFO] |  \- 
org.apache.myfaces.extensions.cdi.core:myfaces-extcdi-core-impl:jar:1.0.5:runtime
[INFO] +- 
org.apache.myfaces.extensions.cdi.modules:myfaces-extcdi-bv1-module-api:jar:1.0.5:compile
[INFO] +- 
org.apache.myfaces.extensions.cdi.modules:myfaces-extcdi-bv1-module-impl:jar:1.0.5:runtime
[INFO] +- 
org.apache.myfaces.extensions.cdi.modules:myfaces-extcdi-scripting-module-api:jar:1.0.5:compile
[INFO] +- 
org.apache.myfaces.extensions.cdi.modules:myfaces-extcdi-scripting-module-impl:jar:1.0.5:runtime
[INFO] +- 
org.apache.myfaces.extensions.cdi.modules:myfaces-extcdi-message-module-api:jar:1.0.5:compile
[INFO] +- 
org.apache.myfaces.extensions.cdi.modules:myfaces-extcdi-message-module-impl:jar:1.0.5:runtime
[INFO] +- 
org.apache.geronimo.specs:geronimo-atinject_1.0_spec:jar:1.0:compile

[INFO] +- 

Re: JSF / MyFaces 2.2

2014-01-20 Thread l.pe...@senat.fr

On 18/01/2014 09:14, Michael Kurz wrote:
You can have a look at my blog http://jsflive.wordpress.com/. I wrote 
some articles about JSF 2.2 features.

Thank you, that is exactly the kind of articles I am looking for.

Best regards,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



JSF / MyFaces 2.2

2014-01-16 Thread l.pe...@senat.fr

Dear all,

what documents do you suggest to read to get an idea of what's new in 
JSF 2.2 and in our favourite JSF implementation, MyFaces ?


Best regards,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Logging

2013-07-31 Thread l.pe...@senat.fr

Dear all,

this is certainl a very simple question for most of you but...

... how do you configure myfaces logging ?

I usually use log4j for my apps.

I tried do create a commons-logging.properties file containing

org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger

I also tried lines such as :

org.apache.myfaces.renderkit.html.HtmlResponseWriterImpl.level = FINEST
org.apache.myfaces.renderkit.html.HtmlResponseWriterImpl.handlers = 
java.util.logging.ConsoleHandler


...but still do not get all logging output.

Thanks in advance,

Ludovic
(using MyFaces 2.1.12, OWB 1.1.6, CODI 1.05 on Tomcat 7.0.32)

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: Unwrap CC ValueExpression?

2013-05-13 Thread l.pe...@senat.fr

On 13/05/2013 14:35, Thomas Andraschko wrote:

Hi Christian,

i don't understand your solution exactly.
Whats the difference?
It would still store the #{cc.attrs.xxx} expression and #{cc} cant be
evaluated without #pushComponentToEL(cc).
Also #createView should be avoided for such a request IMO because of
performance.

I use the following dirty/kludgy code for such needs :

public static String getMappedValueExpression(ValueExpression 
valueExpression) {
ContextAwareTagValueExpression ctxAware = 
(ContextAwareTagValueExpression)valueExpression;

if(ctxAware != null) {
return 
getMappedValueExpression((WrappedValueExpression)ctxAware.getWrapped());

}
return valueExpression.getExpressionString();
}

public static String 
getMappedValueExpression(WrappedValueExpression wrappedExpression) {
String exprString = 
wrappedExpression.getExpressionString().replace(#{, ).replace(}, );

String ret = exprString;
try {

Field valueExpression = 
WrappedValueExpression.class.getDeclaredField(valueExpression);

valueExpression.setAccessible(true);
ValueExpressionImpl vei = (ValueExpressionImpl) 
valueExpression.get(wrappedExpression);
Field varMapper = 
ValueExpressionImpl.class.getDeclaredField(varMapper);

varMapper.setAccessible(true);
VariableMapperImpl vmi = (VariableMapperImpl) 
varMapper.get(vei);

if(vmi != null) {
String[] components = exprString.split(\\.);
components[0] = 
vmi.resolveVariable(components[0]).getExpressionString().replace(#{, 
).replace(}, );

ret = ;
for(int i = 0 ; i  components.length ; i++) {
if(i != 0) {
ret += .;
}
ret += components[i];
}
}
} catch (Exception ex) {
logger.error(Exception lors du mapping de l'expression 
EL  + exprString, ex);

} finally {
return ret;
}
}

I will gladly adopt a better solution but this one works for me. :-)

Regards,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



How to programmatically instantiate a composite component or a tag component ?

2013-04-04 Thread l.pe...@senat.fr

Dear all,

how can I programatically instantiate a composite component or a tag 
component from a custom component ?


I proceed this way to instantiate a composite component, but I do not 
really like it as I use reflection to hijack 
FaceletViewDeclarationLanguage methods...


public UIComponent instantiateComposite(String namespace, String 
componentName) {

FacesContext ctx = FacesContext.getCurrentInstance();
Resource resource = 
ctx.getApplication().getResourceHandler().createResource( componentName 
+ .xhtml, namespace );

UIComponent cc = ctx.getApplication().createComponent( ctx, resource );
UIPanel panel = (UIPanel) ctx.getApplication().createComponent( 
UIPanel.COMPONENT_TYPE );


// set the facelet's parent
cc.getFacets().put( UIComponent.COMPOSITE_FACET_NAME, panel );

FaceletFactory ff = (DefaultFaceletFactory) 
DefaultFaceletFactory.getInstance();

if(ff == null) {
FaceletViewDeclarationLanguage vdl = new 
FaceletViewDeclarationLanguage(ctx);


Method createCompiler = null;
Method createFaceletFactory = null;
try {
createCompiler = 
FaceletViewDeclarationLanguage.class.getDeclaredMethod(createCompiler,FacesContext.class);
createFaceletFactory = 
FaceletViewDeclarationLanguage.class.getDeclaredMethod(createFaceletFactory,FacesContext.class,org.apache.myfaces.view.facelets.compiler.Compiler.class);

createCompiler.setAccessible(true);
createFaceletFactory.setAccessible(true);
org.apache.myfaces.view.facelets.compiler.Compiler compiler 
= (org.apache.myfaces.view.facelets.compiler.Compiler) 
createCompiler.invoke(vdl, ctx);
ff = (FaceletFactory) createFaceletFactory.invoke(vdl, ctx, 
compiler);

} catch (IllegalAccessException ex) {
Logger.getLogger(SenatDataTableEntryDetail.class.getName()).log(Level.SEVERE, 
null, ex);

} catch (IllegalArgumentException ex) {
Logger.getLogger(SenatDataTableEntryDetail.class.getName()).log(Level.SEVERE, 
null, ex);

} catch (InvocationTargetException ex) {
Logger.getLogger(SenatDataTableEntryDetail.class.getName()).log(Level.SEVERE, 
null, ex);

} catch (NoSuchMethodException ex) {
Logger.getLogger(SenatDataTableEntryDetail.class.getName()).log(Level.SEVERE, 
null, ex);

} catch (SecurityException ex) {
Logger.getLogger(SenatDataTableEntryDetail.class.getName()).log(Level.SEVERE, 
null, ex);

}
}

try {
Facelet facelet = ff.getFacelet(resource.getURL());
facelet.apply( ctx, panel );
} catch ( IOException e ) {
e.printStackTrace();
}
return cc;
}

How can I do the same stuff in a cleanier way ?

And how can I instantiate a tag component  I mean a component declared 
the following way :


tag
descriptionblah blah/description
tag-namemyWonderfulTag/tag-name
sourcetags/mwl/myWonderfulTag.xhtml/source
!-- attributes --
/tag

in a taglib.

Thanks in advance,

Ludovic
PS : question also asked on stackoverflow : 
http://stackoverflow.com/questions/15813582/how-to-programmatically-instantiate-a-composite-component-or-a-tag-component



|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


Re: EL expressions as custom component attributes

2013-03-07 Thread l.pe...@senat.fr

On 06/03/2013 20:02, Leonardo Uribe wrote:

Hi

There are good reasons to avoid use VariableMapper. This class is used
when the EL expressions are built to store some values required to
resolve the expression later, making the expression not cacheable,
because the content of VariableMapper could change at any time and in
that way, it is not possible to reuse the same expression.

The wrappers used for EL expressions are there to ensure proper
context initialization. For example, when the EL expression is
evaluated, the reference for the composite component must be pushed on
to the stack.

This process is done by facelets, so create a value expression like
#{cc} programatically will not have the same effect as if it is
created by facelets compiler (if it is located inside composite
component .xhtml file).

If you need some kind of global context in your pages, the best way is
write a custom EL resolver. Other option is write an specific facelets
function, and pass the reference to the composite component to
retrieve the specified context and finally resolve it properly. For
example:

#{utils:context(cc).selected.attribute1}

Really I don't know what you are trying to do, but I hope these ideas
could help.

Thank you for this reply.

My application manages collections of tens of types.

It is some kind of CRUD + collections management.

As I do not like to copy paste code over and over, I wrote a lib that 
analyses those types
to decide how they should be displayed or edited. It uses custom 
annotations and information
provided by hibernate (all those type are hibernate objects). I call 
this information a mapping.


For collections that should be displayed as a datatable, I use this 
mapping to dynamically instantiate columns

So, I have code like :

 p:dataTable ... var=elutit
c:forEach items=#{mapper.mappings} var=curProp
my:displayColumn mapper=#{mapper} bean=elutit
mappingDesc=#{curProp}/
/c:forEach
/p:dataTable

my:displayColumn is a custom class extending Column that will use the 
mapping and the bean to correctly display a property as a column.
To ensure dynamic update, the values and parameters of the display 
controls added as children of this custom column are set as 
ValueExpression-s.


In this datatable example I have no problem, as the bean name (here 
elutit) is local to the control. Value expression will be for example 
#{elutit.property1}


For generic editions, I have controls that derives from layouting 
controls such as panels. As I like PrimeFaces, I most often use a 
control derivating from PanelGrid. This control takes various parameters 
as attributes : the mapper, the bean, etc. Similar to the dataTable, it 
adds edition controls as children, setting their values with 
ValueExpression-s.



The bean to display is specified as an attribute of this custom control, 
with an EL expression : #{myBean}.
I need to get a hand on an EL expression that can reference myBean in 
the ValueExpressions I generate for display controls.
I use this EL Expression as a parameter of my generated ValueExpressions 
In some cases, a property value will not be just #{myBean.property1} but 
#{my:customFunction(myBean)}, with #{my:customFunction(inst)} 
specified in mapping configuration and inst replaced by the right EL 
expression.


Following your advice, I took a look at custom EL resolvers. It is 
definitely a good solution for mapping absolute names.
I did not see how it can help me in my case of a custom control used 
inside a tag file.


In this case, you can have the top level variable A specified as 
parameter B to the tag component, using it as parameter C of the custom 
component.
I need a way to get track of these successive mappings. Ideally, I would 
be able to instantiate my ValueExpressions with the exact same context, 
and so the same variable mappings.



Thanks again for your attention, I hope my English makes sense...

Best regards,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



EL expressions as custom component attributes

2013-03-06 Thread l.pe...@senat.fr
I do not succeed in passing EL expressions as attributes of a custom 
component used in a tag file.


I could not find a clear doc on how to do that with EL 2.2.

My use case is the following :

1. a tag file taking attribute context as a parameter
2. inside the tag file, using a home made custom component taking
   bean as a parameter

Context is an instance of an in-house class hierarchy. Bean is most 
often in this case #{context.selected}.


If I use my tag file the following way in a top level f:view :

|my:tag  context=#{adminContext}/|

And inside my:tag definition :

|my:custom  bean=#{context.selected}/|

In my custom component, I have tried accessors like

|public  ValueExpression  getBean()  {
return  (ValueExpression)  getStateHelper().eval(PropertyKeys.bean);
}

public  void  setBean(ValueExpression  param)  {
getStateHelper().put(PropertyKeys.bean,  param);
}|

and attribute declaration of custom component in taglib like :

|attribute
descriptionNom du bean à afficher/description
namebean/name
requiredtrue/required
deferred-value
typejava.lang.Object/type
/deferred-value
/attribute|

and attribute declaration of the tag file like :

|attribute
namecontext/name
deferred-value
typejava.lang.Object/type
/deferred-value
requiredtrue/required
/attribute|

I always get a cast to ValueExpression exception when calling getBean().

In a method of the custom component called by encodeBegin, I noticed 
that I can access the attribute using getValueExpression(bean).


It returns an instance of ContextAwareTagValueExpressionUEL. Its 
_wrapped attribute points to an instance of WrappedValueExpression, 
encapsulating a ValueExpressionImpl whose value (expr) is 
#{context.selected}. This instance of ValueExpressionImpl also has a 
VariableMapper handling the translation of context to adminContext. 
Its expected type is javax.el.ValueExpression. This must cause my 
exception...


How can I make it works ?

Thanks in advance.

I am using MyFaces 2.1.9, CODI 1.0.5, OpenWebBeans 1.1.6, Tomcat 7.0.32.

(question also asked on 
http://stackoverflow.com/questions/15229708/el-expressions-as-custom-component-attributes 




|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


Re: EL expressions as custom component attributes

2013-03-06 Thread l.pe...@senat.fr

Well,

reading my message again, I found that I still does not properly explain 
my problem.


It is not really to pass a bean using an EL expression.

To do that, you just declare getBean/setBean as returning/taking as 
parameter an Object, and that's done.


My custom component generates itself some custom EL.

So, I need to grab the ValueExpression used to pass this bean.

I found that I can do so using getValueExpression(bean) in my custom 
component method.
However, I found no clean way (I mean, other than reflection) to get a 
hand on the wrapper VariableMapper, to perform mappings before reusing 
the expression or to specify to use this mapper when evaluating my 
custom expressions.


In my example, my custom component generated EL expressions such as 
#{context.selected.attribute1} . Without proper VariableMapper, 
evaluation just fails as context is not defined.


Thanks in advance for your patience.

Ludovic
On 06/03/2013 10:22, l.pe...@senat.fr wrote:


I do not succeed in passing EL expressions as attributes of a custom 
component used in a tag file.


I could not find a clear doc on how to do that with EL 2.2.

My use case is the following :

 1. a tag file taking attribute context as a parameter
 2. inside the tag file, using a home made custom component taking
bean as a parameter

Context is an instance of an in-house class hierarchy. Bean is most 
often in this case #{context.selected}.


If I use my tag file the following way in a top level f:view :

|my:tag  context=#{adminContext}/|

And inside my:tag definition :

|my:custom  bean=#{context.selected}/|

In my custom component, I have tried accessors like

|public  ValueExpression  getBean()  {
 return  (ValueExpress
ion)  getStateHelper().eval(PropertyKeys.bean);
}

public  void  setBean
span class=pun style=margin: 0px; padding: 0px; border: 0px; font-size: 14px; 
vertical-align: baseline; background-color: transparent; color: rgb(0, 0, 0); background-position: 
initial initial; background-repeat: initial initial;(ValueExpression  param)  {
 getStateHelper().put(P
ropertyKeys.bean,  param
span class=pun style=margin: 0px; padding: 0px; border: 0px; font-size: 14px; 
vertical-align: baseline; background-color: transparent; color: rgb(0, 0, 0); background-position: 
initial initial; background-repeat: initial initial;);
}|

and attribute declaration of custom component in taglib like :

|attribute
 descriptionNom du bean à afficher/description
 namebean/name
 requiredtrue/required
 deferred-value
 typejava.lang.Object/type
 /deferred-value
/attribute|

and attribute declaration of the tag file like :

|attribute
 namecontext/name
 deferred-value
 typejava.lang.Object/type
 /deferred-value
 requiredtrue/required
/attribute|

I always get a cast to ValueExpression exception when calling getBean().

In a method of the custom component called by encodeBegin, I noticed 
that I can access the attribute using getValueExpression(bean).


It returns an instance of ContextAwareTagValueExpressionUEL. Its 
_wrapped attribute points to an instance of WrappedValueExpression, 
encapsulating a ValueExpressionImpl whose value (expr) is 
#{context.selected}. This instance of ValueExpressionImpl also has a 
VariableMapper handling the translation of context to 
adminContext. Its expected type is javax.el.ValueExpression. This 
must cause my exception...


How can I make it works ?

Thanks in advance.

I am using MyFaces 2.1.9, CODI 1.0.5, OpenWebBeans 1.1.6, Tomcat 7.0.32.

(question also asked on 
http://stackoverflow.com/questions/15229708/el-expressions-as-custom-component-attributes 






|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


Re: Add 'Stateless JSF' to MyFaces Core? Is it really necessary?

2013-02-22 Thread l.pe...@senat.fr

On 22/02/2013 14:19, Howard W. Smith, Jr. wrote:

Fair enough. Definitely not a concern of mine; seems not to be a real
concern to MyFaces Dev/users as well. :)


Dear all,

maybe a stupid question...

So, a f:view transient=true can be used to design a nice login form 
leveraging JSF power ?


Best regards,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: Problem converting custom components from mojarra to myfaces

2013-02-14 Thread l.pe...@senat.fr
On 14/02/2013 12:27, Karl Kild�n wrote:
 Hello!


 We have decided to upgrade to myfaces. Problem: We have about 30 or so in
 house components and a lot of things stopped working. Here's a concrete
 problem we would really appreciate some help with:

 we use onDoubleClick on our datatable and our js function receives:

 tr#tableRow:inbox:supplierInvoicesTable:0:0.odd  -- Mojarra
 tr#tableRow:inbox:supplierInvoicesTable:0.odd-- Myfaces

 Now the number is the row, no Idea why mojarra puts another number in there
 but our code is adapted to it. Any idea why there's a difference? We of
 course needs our own components to a) work and b) be vendor independent.

 Obviously a mistake to never test it with myfaces during development.
 Further autogenerated ids, I sadly suspect that people have hardcoded in
 generated ids in the components from mojarra - I assume those will break as
 well?
Dear Karl,

are our in house components :
* facelet tag files ;
* composite components ;
* real custom components ?

BalusC explains those types in his reply to this question :
http://stackoverflow.com/questions/6822000/when-to-use-uiinclude-tag-files-composite-components-and-or-custom-componen

Best regards,

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


EventHandler.Listener

2013-01-31 Thread l.pe...@senat.fr

Dear all,

I noticed that the constructor of the EventHandler.Listener taking two 
parameters is private :


   private Listener(MethodExpression methodExpOneArg, 
MethodExpression methodExpZeroArg)

{
this.methodExpOneArg = methodExpOneArg;
this.methodExpZeroArg = methodExpZeroArg;
}


(line 261 and following in file 
org/apache/myfaces/view/facelets/tag/jsf/core/EventHandler.java)


Is it possible to make it public in a future release ? I had to create 
such a simple listener, which is basically a copy of 
EventHandler.Listener and adds no value at all...


Best regards,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: Jsf Hibernate problem in SelectOneList event

2013-01-31 Thread l.pe...@senat.fr

On 31/01/2013 16:05, Giri Prasad wrote:


I recently had a problem with jsf+hibernate, with another control from the 
selectOneXXX family (see 
http://forum.primefaces.org/viewtopic.php?f=3t=27919#p88162 and later)

My problem was that I was comparing real objects and hibernate proxy 
objects. The standard java equals function just fails in this case. I do not see how you fetch your 
objects, but this might be the case.

Your problem might also be simplier. I am also a bit surprised that you return 
a list of SelectItem as value for your f:selectItems.

Let say that you have a Student type.
You will then have a

 ListStudent getStudentList()

method and a custom Converter to propertly manage the String - Object mapping.

Your selectedItem property should in this case also be of Student type.



Thanks for sharing your thoughts.

I tried the backing bean to use String objects and ListString for the list box, since the studentId is a 
varchar(xx) type in the backend db. The same problem exists, even now. That is, when only an entry is selected 
from the list and the Details button pressed, the list empties in the jsf page, the jsf page is refresed, 
and the Detail1 function for the Detail button is not being called. This function (Detail1) 
is called when the list is empty or when no entry is selected from the list and the when the Detail 
button is pressed.

Everything works correctly when Jpa is used for data access in the backing 
bean. Why is there the problem in the hibernate-jsf interaction?
Can you share an archive of a simple, ideally buildable with maven, 
subset of your project ?


Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: Jsf Hibernate problem in SelectOneList event

2013-01-30 Thread l.pe...@senat.fr

On 30/01/2013 14:05, Giri Prasad wrote:

Hello All,

  I have a very simple jsf page and a backing bean for this jsf, which is 
implemented in hibernate using Netbeans.

  Select button does properly populate the list box. Details button does 
display the debug message in glassfish log, when no entry in list box is chosen.

  After I press Select, choose a entry from the list, pressing Detail 
button, is not executing the backing bean function 'studDet()'. On this situation, the 
screen just refreshes, the list goes empty, and the backing bean function is not executed.

  The same backing bean function ['studDet()']  is executed when nothing is 
selected from the list. Apparently the logic when implemented via jpa seems to 
work just perfectly correctly.

Can any one provide your insights, as why this problem is occuring. Thanks in 
advance.
I recently had a problem with jsf+hibernate, with another control from 
the selectOneXXX family (see 
http://forum.primefaces.org/viewtopic.php?f=3t=27919#p88162 and later)


My problem was that I was comparing real objects and hibernate proxy 
objects. The standard java equals function just fails in this case. I do 
not see how you fetch your objects, but this might be the case.


Your problem might also be simplier. I am also a bit surprised that you 
return a list of SelectItem as value for your f:selectItems.


Let say that you have a Student type.
You will then have a

ListStudent getStudentList()

method and a custom Converter to propertly manage the String - Object 
mapping.


Your selectedItem property should in this case also be of Student type.


Hope this helps,

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


Re: Can start in debug, but not in release

2012-11-21 Thread l.pe...@senat.fr

On 20/11/2012 20:16, Gerhard Petracek wrote:

hi ludovic,

to get rid of
   ... no
org.apache.myfaces.extensions.cdi.core.api.provider.BeanManagerProvider in
place! ...
you have to ensure that all config-files and owb jar-files you are using
are packaged correctly.

you can compare your war-file e.g. with a war-file of a generated demo
generate it e.g. with #4 of:
mvn archetype:generate -DarchetypeCatalog=
http://people.apache.org/~gpetracek/myfaces/

regards,
gerhard

Dear Gerhard,

thank you for this quick reply.

I, in fact, copied my dependencies from a pom.xml generation using your 
artifact. So, they are pretty much the same, excepted on the following 
point. I define MyFaces/OWB/PrimeFaces/other-JSF-related-stuff in a 
helper package, which I add as a dependency to my project.


So, in the mvn dependency:tree of my project,

[INFO] +- 
org.apache.geronimo.specs:geronimo-servlet_2.5_spec:jar:1.2:provided

[INFO] +- org.apache.geronimo.specs:geronimo-el_1.0_spec:jar:1.0.2:provided

is not listed.

But, as far as I understand, it should not be a problem. And it does not 
seem to be, as adding them in my top level pom.xml does not help.


Thanks again,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: Can start in debug, but not in release

2012-11-21 Thread l.pe...@senat.fr

On 21/11/2012 10:24, Gerhard Petracek wrote:

hi ludovic,

then we would need a link to a package example which illustrates the issue.

Dear Gerhard,

while preparing this package, I constated that Mark was right and that 
the problem was a combination of

an hibernate init failure combined with a deficient logging configuration.

So, everthing works fine and the bug was not OWB/MyFaces/CODI related.

Thank you again to both of you.

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Setting CODI project stage

2012-10-08 Thread l.pe...@senat.fr

Hi.

How can I configure the CODI project stage ? I crawled the doc but found 
nothing. In the 
org/apache/myfaces/extensions/cdi/core/api/projectstage/ProjectStage.java source 
file, I found the following doc :


53  * pThe following resolution mechanism is used to determine the 
current ProjectStage:

54  * ul
55  *  liTODO specify!/li
56  * /ul
57  * /p

I tried to define javax.faces.PROJECT_STAGE=Development as a system 
property, as found on stackoverflow.com, but this does not seem to work.


Thanks in advance for your help.

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


Re: Setting CODI project stage

2012-10-08 Thread l.pe...@senat.fr

On 08/10/2012 14:55, Mark Struberg wrote:

Hi Ludovic!

I'm using -Dfaces.PROJECT_STAGE=Development which works perfectly.

In production we have set it via JNDI in tomcats conf/context.xml:

 Environment name=jsf/ProjectStage value=SystemTest
   type=java.lang.String override=false/

LieGrue,
strub

Thank you, this does the job. :-)

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: Passing method parameters to nested composite component

2012-07-24 Thread l.pe...@senat.fr

On 24/07/2012 10:32, Leonardo Uribe wrote:

Hi

I tried the following example:

 h:form id=mainForm
   test:ajaxPanel2
onRowEditListener=#{ajaxListenerBean.ajaxRender}
value=#{ajaxListenerBean.value}/
 /h:form

ajaxPanel2.xhtml

 cc:interface
 cc:attribute name=onRowEditListener  required=false
method-signature=void
listener(javax.faces.event.AjaxBehaviorEvent)/
 cc:attribute name=value/
 /cc:interface
 cc:implementation
   test:ajaxContent onRowEditListener=#{cc.attrs.onRowEditListener}
 h:outputText value=#{cc.attrs.value} /
   /test:ajaxContent
 /cc:implementation

ajaxContent.xhtml

 cc:interface
 cc:attribute  name=onRowEditListener  required=false
method-signature=void
listener(javax.faces.event.AjaxBehaviorEvent)/
 /cc:interface
 cc:implementation
   h:commandButton value=Press me
 f:ajax render=content listener=#{cc.attrs.onRowEditListener} /
   /h:commandButton
   h:panelGroup id=content layout=block
 cc:insertChildren/
   /h:panelGroup
 /cc:implementation

@ManagedBean
@RequestScoped
public class AjaxListenerBean
{
 private String value;
 /*... getter and setter ..*/
 public void ajaxRender(AjaxBehaviorEvent evt)
 {
 value = Double.toString(Math.random());
 System.out.println(value =+value);
 }
}

Works without problem. I'm using jetty maven plugin 8.1.3.v20120416 ,
which uses glassfish EL.

There is no evidence so far that there is a bug in MyFaces. That part
has been tested intensively. I think it is a bug in tomcat EL
implementation or maybe something related to openwebbeans
EL10ValueExpression.

I just tried your example. It works.
Maybe the problem is primefaces related. I will ask on PrimeFaces forum.

Thanks,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: Passing method parameters to nested composite component

2012-07-24 Thread l.pe...@senat.fr

On 23/07/2012 20:23, Rafael Pestano wrote:

Hi Ludovic,

i've had similar problem with closeListener of primefaces dialog inside 
composite components, my workaround was as follows:

Dear Rafael,

thank you very much for this workaround.

I spent a great deal of time trying to find the real problem. However, 
there are so many complex software layers involved that it is well 
beyond my possibilities.


Thanks again to you and all the others who helped me.

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Passing method parameters to nested composite component

2012-07-23 Thread l.pe...@senat.fr

Dear all,

I am experiencing what I think is a bug with Tomcat 6.0.33 / MyFaces
2.1.7 (I am also using CODI, but do not think this has an impact).
I posted a question on stackoverflow but had no answer yet :
http://stackoverflow.com/questions/11566496/passing-method-parameter-to-nested-composite-component-fails


I have a first component wose composite:interface looks like :

|composite:interface
composite:attribute  name=onRowEditListener  required=false  
method-signature=void listener(org.primefaces.event.RowEditEvent)/
/composite:interface

|

It uses another composite component component which has a similar interface.

The first level component is used this way :

|mynamespace:compo1onRowEditListener=#{bean.method}/
|

The nested one is used this way :

|mynamespace:compo2onRowEditListener=#{cc.attrs.onRowEditListener}/
|

If I insert in both controls, I got :

 * in the first level control, an output like
   org.apache.el.MethodExpressionImpl@358f0647, which looks good to me
 * in the second (nested) level control, an output like
   org.apache.myfaces.view.facelets.el.LocationValueExpression@ff381f45 .

Raised exception looks like :


|19/07/2012  19:39:02  fr.senat.faces.exceptions.DetailedExceptionHandler  
INFO[DetailedExceptionHandler.java:40]  [http-8080-7]  -  Stack  trace:  
javax.faces.FacesException:  Exception  while  calling broadcast on component:  
{Component-Path  :  [Class:  javax.faces.component.UIViewRoot,ViewId:  
/editSenateur.xhtml][Class: javax.faces.component.html.HtmlBody,Id: 
j_id_5][Class: org.primefaces.component.layout.Layout,Id: j_id_6][Class: 
org.primefaces.component.layout.LayoutUnit,Id: j_id_v][Class: 
org.primefaces.component.outputpanel.OutputPanel,Id: detailCommissions][Class: 
javax.faces.component.html.HtmlForm,Id: j_id_x][Class: 
org.primefaces.component.tabview.TabView,Id: tabFonctionsInternes][Class: 
org.primefaces.component.tabview.Tab,Id: fonctionsCommissions][Class: 
javax.faces.component.UINamingContainer,Id: j_id_10][Class: 
javax.faces.component.UIPanel,Id: j_idj_id_10__f_cc_facet][Class: 
org.primefaces.component.outputpanel.OutputPanel,Id: 
panelTabViewCommissions][Class: org.primefaces.component.tabview.TabView,Id: 
tabViewCommissions][Class: org.primefaces.component.tabview.Tab,Id: 
commissionTab][Class: org.primefaces.component.panelgrid.PanelGrid,Id: 
j_id_15][Class: org.primefaces.component.row.Row,Id: j_id_1b][Class: 
org.primefaces.component.column.Column,Id: j_id_1c][Class: 
javax.faces.component.UINamingContainer,Id: j_id_1d][Class: 
javax.faces.component.UIPanel,Id: j_idj_id_1d__f_cc_facet][Class: 
org.primefaces.component.datatable.DataTable,Id: sheetFonctions]} created from: 
/resources/sen/fonctionsCommission.xhtml at line27  and  column162
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:430)
at javax.faces.component.UIData.broadcast(UIData.java:1610)
at javax.faces.component.UIData.broadcast(UIData.java:1596)
at javax.faces.component.UIData.broadcast(UIData.java:1596)
at javax.faces.component.UIData.broadcast(UIData.java:1596)
at javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:1023)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:286)
at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1360)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
at 
org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:38)
at 
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170)
at 
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at 
org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper.execute(CodiLifecycleWrapper.java:95)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:357)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
fr.senat.faces.filters.HibernateSessionConversationFilter.doFilter(HibernateSessionConversationFilter.java:76)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at 

Re: Passing method parameters to nested composite component

2012-07-23 Thread l.pe...@senat.fr

On 23/07/2012 15:49, Leonardo Uribe wrote:

Hi

The stack trace shows it is a Tomcat EL bug. MyFaces is passing the
params properly. I would suggest to use another EL implementation to
see if it works, but first it is necessary to see if the listener
defines the parameter correctly or not. You can use the alternate
syntax with target attribute, instead a cc EL expression, to see if
there is a problem there.

Thank you for your quick reply.

What do you mean by alternate syntax ? I tried to add a targets 
attribute to the composite attributes declarations, but it has no effect.


I will try with another el implementation, but I think that I will not 
be able to get such a configuration on our production servers...


Best regards,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: Passing method parameters to nested composite component

2012-07-23 Thread l.pe...@senat.fr

On 23/07/2012 17:53, Leonardo Uribe wrote:

Hi

Look the javadoc for composite:attribute targets property. It says
something like this:

Well, I did that and the bug still occurs.

I am trying to use jboss-el to avoid it...

Thx.

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: Passing method parameters to nested composite component

2012-07-23 Thread l.pe...@senat.fr

On 23/07/2012 18:22, l.pe...@senat.fr wrote:

On 23/07/2012 17:53, Leonardo Uribe wrote:

Hi

Look the javadoc for composite:attribute targets property. It says
something like this:

Well, I did that and the bug still occurs.

I am trying to use jboss-el to avoid it...
I finally used glashfish el 2.2 implementation, following standard 
procedure (remove original el-api.jar file, copy api and impl jar file 
in server lib dir, modify web.xml...) and I still have the very same bug.


So, maybe it is not an el implementation bug ?

Best regards,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: Passing method parameters to nested composite component

2012-07-23 Thread l.pe...@senat.fr

On 23/07/2012 18:46, l.pe...@senat.fr wrote:

On 23/07/2012 18:22, l.pe...@senat.fr wrote:

On 23/07/2012 17:53, Leonardo Uribe wrote:

Hi

Look the javadoc for composite:attribute targets property. It says
something like this:

Well, I did that and the bug still occurs.

I am trying to use jboss-el to avoid it...
I finally used glashfish el 2.2 implementation, following standard 
procedure (remove original el-api.jar file, copy api and impl jar file 
in server lib dir, modify web.xml...) and I still have the very same bug.


So, maybe it is not an el implementation bug ?

Dear all,

while tracing the faulty call, I noticed that the wrapped EL 
expression is


ContextAwareTagMethodExpression
ValueExpressionMethodExpression
LocationValueExpression
ContextAwareTagValueExpression
EL10ValueExpression

I wondered whether the problem was not with this EL10ValueExpression...

I am using openwebbeans-el10 module, following (good) advices on this 
list : http://www.mail-archive.com/users@myfaces.apache.org/msg58648.html


Don't you think that this el10 configuration is part of the problem ?

Thx again,

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


Re: Passing method parameters to nested composite component

2012-07-23 Thread l.pe...@senat.fr

On 23/07/2012 19:39, Leonardo Uribe wrote:

Hi

Thinking more about it, check if both composite components define the
attribute with method-signature. In theory, if there is a bug, it
should be possible to reproduce it excluding primefaces and using
actionListener or valueChangeListener instead. But first try the
syntax using targets instead the cc EL expression.
I immediatly tried targets when you pointed it (on both declarations). 
It did not help.

Both composite components declare the attribute with method-signature.

The value is used by the inner control in an ajax declaration of a 
primefaces p:datatable :


p:ajax event=rowEdit update=#{cc.attrs.onRowEdit}
listener=#{cc.attrs.onRowEditListener} /

I do not see how to use actionListener or valueChangeListener there.

I tried (dirty) using cc.parent.attrs.onRowEditListener instead, and it 
did not help.


h:outputText of cc.parent.attrs.onRowEditListener seems correct :

org.apache.el.MethodExpressionImpl@358f0647

Thx,

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


el expression parameter of a composite component

2012-06-14 Thread l.pe...@senat.fr

Dear all,

I am experiencing a strange behaviour with a composite component.

It seems to me that attributes values specified as el expressions are 
computed only once, and very early, when the composite component 
declaration specifies a componentType.


I published an example on 
http://stackoverflow.com/questions/11020297/updatable-composite-component .


What is our opinion on this problem ? Is it a myfaces specific bug ?

I am using :
* Tomcat 6.0.33 (with unmodified el lib) ; ;
* MyFaces 2.1.7
* CODI 1.0.5
* OWB 1.1.3

Thanks in advance.

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: el expression parameter of a composite component

2012-06-14 Thread l.pe...@senat.fr

On 14/06/2012 12:40, Leonardo Uribe wrote:

Hi

I have checked the problem and what you need to do is implement your
properties into your component class using StateHelper methods,
otherwise the properties will not be saved and restored.

Take a look at:

http://svn.apache.org/repos/asf/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIOutput.java

There, you'll see how to do it. But I think in your case there is no
need to implement augmentedSen property into the component at all, and
instead use the stored ValueExpression to find the right bean. If
augementedSen is an attached object of the composite component,
similar to converters or validators or behaviors, it has sense to
implement it into the component class.

Thanks a lot for your answer.

I will take a closer look at it in July, as it is seems to be the right 
things to do.


Being in a hurry, I had to quickly and dirtily retrive the parameter 
bean by name in the backend bean for now... :-|


Thanks again.

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|