You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Xavier Dury <ka...@hotmail.com> on 2013/09/12 12:49:24 UTC

RE: Using EL expressions in an ObjectFactory

Hi,

I implemented a simple ExpressionFactory @ https://github.com/kalgon/expression-factory.

I would love to see this ExpressionFactory next to org.apache.naming.factory.BeanFactory in tomcat.

Regards,

Xavier

----------------------------------------
> From: kalgon@hotmail.com
> To: users@tomcat.apache.org
> Subject: RE: Using EL expressions in an ObjectFactory
> Date: Fri, 30 Aug 2013 09:41:09 +0200
>
> Hi,
>
> I don't think you understood me. The point here is not about the ${catalina.base}, it's about the whole expression "CacheManager.newInstance(URI('file:${catalina.base}/conf/ehcache.xml').toURL())".
>
> The ${catalina.base} will of course be expanded and give something like:
>
> "CacheManager.newInstance(URI('file:/home/tomcat/conf/ehcache.xml').toURL())"
>
> And then, this expression can be evaluated through EL and give a real CacheManager instance.
>
> I could have written this that way:
>
> "CacheManager.newInstance(URI('file:'+System.getProperty('catalina.base')+'/conf/ehcache.xml').toURL())"
>
> The important thing here is that the whole expression parameter could be given to an ELProcessor instead of having specialized ObjectFactory for each case (I would of course use a specific ObjectFactory if there's one, like BasicDataSourceFactory... but for exotic and rare cases where no ObjectFactory exist, a generic EL-based one could be helpful).
>
> Xavier
>
> ----------------------------------------
>> Date: Thu, 29 Aug 2013 14:53:31 -0400
>> From: chris@christopherschultz.net
>> To: users@tomcat.apache.org
>> Subject: Re: Using EL expressions in an ObjectFactory
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>> Xavier,
>>
>> On 8/29/13 3:06 AM, Xavier Dury wrote:
>>> Could it be possible for the tomcat team to include a
>>> javax.naming.spi.ObjectFactory which would use EL3.0 expressions?
>>>
>>> It would be great if you want to have resource-ref which are not of
>>> the usual types.
>>>
>>> I always wanted to have an ObjectFactory for URLs but having one
>>> for each type is too much work... so now, that we have a more
>>> powerful EL engine, maybe it would a great opportunity to use it.
>>>
>>> <Resource name="/url/SomeService" type="java.net.URL"
>>> factory="org.apache.tomcat.jndi.ELObjectFactory"
>>> importClass="java.net.URI"
>>> expression="URI('http://some.service.url').toURL()" />
>>>
>>> <Resource name="/cache/CacheManager"
>>> type="net.sf.ehcache.CacheManager"
>>> factory="org.apache.tomcat.jndi.ELObjectFactory"
>>> importClass="net.sf.ehcache.CacheManager,java.net.URI"
>>> importStatic="net.sf.ehcache.CacheManager.newInstance"
>>> expression="CacheManager.newInstance(URI('file:${catalina.base}/conf/ehcache.xml').toURL())"
>>
>> What's
>>>
>> wrong with just using $catalina.base within your context.xml?
>> It will expand appropriately already... no EL needed.
>>
>> - -chris
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.14 (Darwin)
>> Comment: GPGTools - http://gpgtools.org
>> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>>
>> iQIcBAEBCAAGBQJSH5irAAoJEBzwKT+lPKRYRoYP/03+hC07yLehUBQHuaIghRTB
>> 6NWcWrzcZ3bCy/uFtQDLH12am7sbE2zQ+VO6HPlOJaRJul8UQLCdZlTXmQuquz+G
>> 8SGoGb4BWqPcluMrhbO+8v7f4aMPN7NenxBRpzNvWlQPtOo2h7+9cmz2bwh+XikU
>> 5J8IGE2e7wb8dAQBu6DJtFsQi+fAhOGaiLfBtorwDLYrpJ4nN0tr28LSFrX9VKtD
>> d0Fwga1zzHrBiGFzNAoUUujuGaPYCfbGugNJogWQO0dvHKQMmAM9GGLStnJbyy4U
>> vehGGU4lRq6mhkD0KCUJ/zVxM1fuFxK+Q4hRah97Mw7r8jHgqyQEqdfGV9EjUZh4
>> GVg0Y5W308ZTZfiutb7N++GTFrYq9qohHmI8pQyJ2jQLPtIo7gZv9KKBgFHUggpM
>> 2lg4ZL6/3wjALScRsQ5/NKUpg4s0NIb25LPOKViCW1fHF2euUcEH/lkkelgGMgFP
>> 2BXVszGOhQghePXFg6hkpAa4zhF0HRJQj8T5a1kJIBnf4QW3mm/g2Xv19EVNyiOs
>> ZrkC6dSXZXnJZ0aYxusxRNKvSplTGm6ywuftxy17H89Mblib8qb0G+5MNwRJwceF
>> tOkvHoMEY20dbhRZpQDL79a5dVL7YLc4M8hXBR1JQkmo1RyslHU/Y/+782OSs5+w
>> ZFM1iRO6JYbxLrGdwQ3n
>> =9lxu
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 		 	   		  
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Using EL expressions in an ObjectFactory

Posted by Xavier Dury <ka...@hotmail.com>.
Hi,

I updated the github project to use tomcat-jasper-el:8.0.0-RC3 (found here [1]).

Now the maven project compiles and passes all tests out of the box (without resorting to build tomcat aside).


[1] https://repository.apache.org/content/repositories/orgapachetomcat-080/


----------------------------------------
> From: kalgon@hotmail.com
> To: users@tomcat.apache.org
> Subject: RE: Using EL expressions in an ObjectFactory
> Date: Mon, 16 Sep 2013 16:34:20 +0200
>
> I found the problem:
>
> I was using javax.el:javax.el-api:3.0.0 as EL api jar... now, if I use the el-api provided by tomcat, everything works fine.
>
> Xavier
>
> ----------------------------------------
>> Subject: Re: Using EL expressions in an ObjectFactory
>> From: dmikusa@gopivotal.com
>> Date: Mon, 16 Sep 2013 10:05:14 -0400
>> To: users@tomcat.apache.org
>>
>> On Sep 16, 2013, at 9:43 AM, Xavier Dury <ka...@hotmail.com> wrote:
>>
>>> I built tomcat from trunk (rev 1523639) and I'm having the same issue I had with glassfish EL implementation when using overloaded methods:
>>>
>>> javax.el.ELException: Cannot convert ./ of type class java.lang.String to class java.net.URI
>>> at org.apache.el.lang.ELSupport.coerceToType(ELSupport.java:482)
>>> at org.apache.el.ExpressionFactoryImpl.coerceToType(ExpressionFactoryImpl.java:48)
>>> at javax.el.ELContext.convertToType(ELContext.java:473)
>>> at org.apache.el.lang.EvaluationContext.convertToType(EvaluationContext.java:155)
>>> at javax.el.ELUtil.invokeConstructor(ELUtil.java:261)
>>> at javax.el.StaticFieldELResolver.invoke(StaticFieldELResolver.java:203)
>>> at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
>>> at org.apache.el.parser.AstFunction.getValue(AstFunction.java:138)
>>> at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188)
>>> at javax.el.ELProcessor.getValue(ELProcessor.java:129)
>>> at javax.el.ELProcessor.eval(ELProcessor.java:115)
>>> at org.apache.naming.factory.ExpressionFactoryTest.elImplementationShouldWork(ExpressionFactoryTest.java:43)
>>>
>>> So I guess it's normal behaviour, isn't it?
>>
>> No. Your example works fine for me, rev# 1523651.
>>
>> public class ElFileTest {
>> @Test
>> public void testElAndFile() throws IOException {
>> ELProcessor proc = new ELProcessor();
>> proc.getELManager().importClass("java.io.File");
>> File f = (File) proc.eval("File('./')");
>> Assert.assertEquals(new File("./").getCanonicalPath(), f.getCanonicalPath());
>> }
>> }
>>
>> Dan
>>
>>>
>>> I don't think EL spec does mandate implementations to make their best effort to find a suitable method when invoking overloaded methods.
>>>
>>> Xavier
>>>
>>> ----------------------------------------
>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>> From: dmikusa@gopivotal.com
>>>> Date: Mon, 16 Sep 2013 07:48:33 -0400
>>>> To: users@tomcat.apache.org
>>>>
>>>> On Sep 16, 2013, at 3:03 AM, Xavier Dury <ka...@hotmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I switched to org.apache.tomcat:tomcat-jasper-el:8.0.0-RC1 as javax.el 3.0 implementation and tested with the following code:
>>>>>
>>>>> ELProcessor processor = new ELProcessor();
>>>>> processor.getELManager().importClass("java.io.File");
>>>>> processor.eval("File('./')");
>>>>>
>>>>> but I get the following error:
>>>>>
>>>>> javax.el.ELException: Function ':File' not found
>>>>> at org.apache.el.parser.AstFunction.getValue(AstFunction.java:136)
>>>>> at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188)
>>>>> at javax.el.ELProcessor.getValue(ELProcessor.java:129)
>>>>> at javax.el.ELProcessor.eval(ELProcessor.java:115)
>>>>> at org.apache.naming.factory.ExpressionFactoryTest.elImplementationShouldWork(ExpressionFactoryTest.java:43)
>>>>>
>>>>> Are methods importClass, importStatic and importPackage on ELManager already implemented in apache EL?
>>>>
>>>> Sorry, I don't think I was clear enough in my last response. This does not work with Tomcat 8.0.0-RC1, but has been fixed (see the bug I referenced earlier). You'll need to either build and use Tomcat trunk or wait until the next RC release is available.
>>>>
>>>> Dan
>>>>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Xavier
>>>>>
>>>>> ----------------------------------------
>>>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>>>> From: dmikusa@gopivotal.com
>>>>>> Date: Fri, 13 Sep 2013 15:38:29 -0400
>>>>>> To: users@tomcat.apache.org
>>>>>>
>>>>>> On Sep 13, 2013, at 3:27 AM, Xavier Dury <ka...@hotmail.com> wrote:
>>>>>>
>>>>>>> When I try the following:
>>>>>>>
>>>>>>> ELProcessor processor = new ELProcessor();
>>>>>>> processor.getELManager().importClass("java.io.File");
>>>>>>> processor.eval("File('./')");
>>>>>>>
>>>>>>> I get javax.el.ELException: java.lang.IllegalArgumentException: Cannot convert ./ of type class java.lang.String to class java.net.URI.
>>>>>>>
>>>>>>> I'm using glassfish javax.el 3.0 implementation for my tests. Maybe the problem comes from this specific implementation.
>>>>>>
>>>>>> Yes, that would be the problem. I've noticed the same behavior w/GlassFish's EL 3.0 implementation. Try building Tomcat trunk and using it's implementation or using the next Tomcat 8 RC when it's available. Neither should have that problem.
>>>>>>
>>>>>> Dan
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> ----------------------------------------
>>>>>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>>>>>> From: dmikusa@gopivotal.com
>>>>>>>> Date: Thu, 12 Sep 2013 17:10:21 -0400
>>>>>>>> To: users@tomcat.apache.org
>>>>>>>>
>>>>>>>> On Sep 12, 2013, at 7:58 AM, Xavier Dury <ka...@hotmail.com> wrote:
>>>>>>>>
>>>>>>>>> Ok,
>>>>>>>>>
>>>>>>>>> I fixed the styling and the documentation. If anything else must be changed, don't hesitate.
>>>>>>>>
>>>>>>>> In your docs, you state the following remark...
>>>>>>>>
>>>>>>>> "Try to avoid overloaded methods/constructors as much as possible in EL 3.0 expression as the ELProcessor will use the first one it will find by reflection."
>>>>>>>>
>>>>>>>> Can you clarify what you mean by this? There was a problem in RC-1 that sounds similar, but it's been fixed.
>>>>>>>>
>>>>>>>> https://issues.apache.org/bugzilla/show_bug.cgi?id=55483
>>>>>>>>
>>>>>>>> Is this a problem in trunk? Point being, if you're seeing an issue with EL 3.0, we should try to fix it.
>>>>>>>>
>>>>>>>> Dan
>>>>>>>>
>>>>>>>>
>>>>>>>>> ----------------------------------------
>>>>>>>>>> Date: Thu, 12 Sep 2013 12:01:26 +0100
>>>>>>>>>> From: markt@apache.org
>>>>>>>>>> To: users@tomcat.apache.org
>>>>>>>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>>>>>>>>
>>>>>>>>>> On 12/09/2013 11:49, Xavier Dury wrote:
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> I implemented a simple ExpressionFactory @
>>>>>>>>>>> https://github.com/kalgon/expression-factory.
>>>>>>>>>>>
>>>>>>>>>>> I would love to see this ExpressionFactory next to
>>>>>>>>>>> org.apache.naming.factory.BeanFactory in tomcat.
>>>>>>>>>>
>>>>>>>>>> No objections in principle.
>>>>>>>>>>
>>>>>>>>>> Haven't looked at the new code in detail. A few initial observations:
>>>>>>>>>> - I'm assuming this is a contribution as per section 5 of the Apache
>>>>>>>>>> License, version 2.0
>>>>>>>>>> - There is no documentation
>>>>>>>>>> - Tomcat code standards use 4 spaces for indents, not tabs
>>>>>>>>>> - Some @Override markers look to be missing
>>>>>>>>>>
>>>>>>>>>> Mark
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 		 	   		  
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Using EL expressions in an ObjectFactory

Posted by Xavier Dury <ka...@hotmail.com>.
I found the problem:

I was using javax.el:javax.el-api:3.0.0 as EL api jar... now, if I use the el-api provided by tomcat, everything works fine.

Xavier

----------------------------------------
> Subject: Re: Using EL expressions in an ObjectFactory
> From: dmikusa@gopivotal.com
> Date: Mon, 16 Sep 2013 10:05:14 -0400
> To: users@tomcat.apache.org
>
> On Sep 16, 2013, at 9:43 AM, Xavier Dury <ka...@hotmail.com> wrote:
>
>> I built tomcat from trunk (rev 1523639) and I'm having the same issue I had with glassfish EL implementation when using overloaded methods:
>>
>> javax.el.ELException: Cannot convert ./ of type class java.lang.String to class java.net.URI
>> at org.apache.el.lang.ELSupport.coerceToType(ELSupport.java:482)
>> at org.apache.el.ExpressionFactoryImpl.coerceToType(ExpressionFactoryImpl.java:48)
>> at javax.el.ELContext.convertToType(ELContext.java:473)
>> at org.apache.el.lang.EvaluationContext.convertToType(EvaluationContext.java:155)
>> at javax.el.ELUtil.invokeConstructor(ELUtil.java:261)
>> at javax.el.StaticFieldELResolver.invoke(StaticFieldELResolver.java:203)
>> at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
>> at org.apache.el.parser.AstFunction.getValue(AstFunction.java:138)
>> at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188)
>> at javax.el.ELProcessor.getValue(ELProcessor.java:129)
>> at javax.el.ELProcessor.eval(ELProcessor.java:115)
>> at org.apache.naming.factory.ExpressionFactoryTest.elImplementationShouldWork(ExpressionFactoryTest.java:43)
>>
>> So I guess it's normal behaviour, isn't it?
>
> No. Your example works fine for me, rev# 1523651.
>
> public class ElFileTest {
> @Test
> public void testElAndFile() throws IOException {
> ELProcessor proc = new ELProcessor();
> proc.getELManager().importClass("java.io.File");
> File f = (File) proc.eval("File('./')");
> Assert.assertEquals(new File("./").getCanonicalPath(), f.getCanonicalPath());
> }
> }
>
> Dan
>
>>
>> I don't think EL spec does mandate implementations to make their best effort to find a suitable method when invoking overloaded methods.
>>
>> Xavier
>>
>> ----------------------------------------
>>> Subject: Re: Using EL expressions in an ObjectFactory
>>> From: dmikusa@gopivotal.com
>>> Date: Mon, 16 Sep 2013 07:48:33 -0400
>>> To: users@tomcat.apache.org
>>>
>>> On Sep 16, 2013, at 3:03 AM, Xavier Dury <ka...@hotmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I switched to org.apache.tomcat:tomcat-jasper-el:8.0.0-RC1 as javax.el 3.0 implementation and tested with the following code:
>>>>
>>>> ELProcessor processor = new ELProcessor();
>>>> processor.getELManager().importClass("java.io.File");
>>>> processor.eval("File('./')");
>>>>
>>>> but I get the following error:
>>>>
>>>> javax.el.ELException: Function ':File' not found
>>>> at org.apache.el.parser.AstFunction.getValue(AstFunction.java:136)
>>>> at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188)
>>>> at javax.el.ELProcessor.getValue(ELProcessor.java:129)
>>>> at javax.el.ELProcessor.eval(ELProcessor.java:115)
>>>> at org.apache.naming.factory.ExpressionFactoryTest.elImplementationShouldWork(ExpressionFactoryTest.java:43)
>>>>
>>>> Are methods importClass, importStatic and importPackage on ELManager already implemented in apache EL?
>>>
>>> Sorry, I don't think I was clear enough in my last response. This does not work with Tomcat 8.0.0-RC1, but has been fixed (see the bug I referenced earlier). You'll need to either build and use Tomcat trunk or wait until the next RC release is available.
>>>
>>> Dan
>>>
>>>>
>>>> Regards,
>>>>
>>>> Xavier
>>>>
>>>> ----------------------------------------
>>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>>> From: dmikusa@gopivotal.com
>>>>> Date: Fri, 13 Sep 2013 15:38:29 -0400
>>>>> To: users@tomcat.apache.org
>>>>>
>>>>> On Sep 13, 2013, at 3:27 AM, Xavier Dury <ka...@hotmail.com> wrote:
>>>>>
>>>>>> When I try the following:
>>>>>>
>>>>>> ELProcessor processor = new ELProcessor();
>>>>>> processor.getELManager().importClass("java.io.File");
>>>>>> processor.eval("File('./')");
>>>>>>
>>>>>> I get javax.el.ELException: java.lang.IllegalArgumentException: Cannot convert ./ of type class java.lang.String to class java.net.URI.
>>>>>>
>>>>>> I'm using glassfish javax.el 3.0 implementation for my tests. Maybe the problem comes from this specific implementation.
>>>>>
>>>>> Yes, that would be the problem. I've noticed the same behavior w/GlassFish's EL 3.0 implementation. Try building Tomcat trunk and using it's implementation or using the next Tomcat 8 RC when it's available. Neither should have that problem.
>>>>>
>>>>> Dan
>>>>>
>>>>>
>>>>>>
>>>>>> ----------------------------------------
>>>>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>>>>> From: dmikusa@gopivotal.com
>>>>>>> Date: Thu, 12 Sep 2013 17:10:21 -0400
>>>>>>> To: users@tomcat.apache.org
>>>>>>>
>>>>>>> On Sep 12, 2013, at 7:58 AM, Xavier Dury <ka...@hotmail.com> wrote:
>>>>>>>
>>>>>>>> Ok,
>>>>>>>>
>>>>>>>> I fixed the styling and the documentation. If anything else must be changed, don't hesitate.
>>>>>>>
>>>>>>> In your docs, you state the following remark...
>>>>>>>
>>>>>>> "Try to avoid overloaded methods/constructors as much as possible in EL 3.0 expression as the ELProcessor will use the first one it will find by reflection."
>>>>>>>
>>>>>>> Can you clarify what you mean by this? There was a problem in RC-1 that sounds similar, but it's been fixed.
>>>>>>>
>>>>>>> https://issues.apache.org/bugzilla/show_bug.cgi?id=55483
>>>>>>>
>>>>>>> Is this a problem in trunk? Point being, if you're seeing an issue with EL 3.0, we should try to fix it.
>>>>>>>
>>>>>>> Dan
>>>>>>>
>>>>>>>
>>>>>>>> ----------------------------------------
>>>>>>>>> Date: Thu, 12 Sep 2013 12:01:26 +0100
>>>>>>>>> From: markt@apache.org
>>>>>>>>> To: users@tomcat.apache.org
>>>>>>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>>>>>>>
>>>>>>>>> On 12/09/2013 11:49, Xavier Dury wrote:
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I implemented a simple ExpressionFactory @
>>>>>>>>>> https://github.com/kalgon/expression-factory.
>>>>>>>>>>
>>>>>>>>>> I would love to see this ExpressionFactory next to
>>>>>>>>>> org.apache.naming.factory.BeanFactory in tomcat.
>>>>>>>>>
>>>>>>>>> No objections in principle.
>>>>>>>>>
>>>>>>>>> Haven't looked at the new code in detail. A few initial observations:
>>>>>>>>> - I'm assuming this is a contribution as per section 5 of the Apache
>>>>>>>>> License, version 2.0
>>>>>>>>> - There is no documentation
>>>>>>>>> - Tomcat code standards use 4 spaces for indents, not tabs
>>>>>>>>> - Some @Override markers look to be missing
>>>>>>>>>
>>>>>>>>> Mark
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 		 	   		  
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Using EL expressions in an ObjectFactory

Posted by Daniel Mikusa <dm...@gopivotal.com>.
On Sep 16, 2013, at 9:43 AM, Xavier Dury <ka...@hotmail.com> wrote:

> I built tomcat from trunk (rev 1523639) and I'm having the same issue I had with glassfish EL implementation when using overloaded methods:
> 
> javax.el.ELException: Cannot convert ./ of type class java.lang.String to class java.net.URI
> 	at org.apache.el.lang.ELSupport.coerceToType(ELSupport.java:482)
> 	at org.apache.el.ExpressionFactoryImpl.coerceToType(ExpressionFactoryImpl.java:48)
> 	at javax.el.ELContext.convertToType(ELContext.java:473)
> 	at org.apache.el.lang.EvaluationContext.convertToType(EvaluationContext.java:155)
> 	at javax.el.ELUtil.invokeConstructor(ELUtil.java:261)
> 	at javax.el.StaticFieldELResolver.invoke(StaticFieldELResolver.java:203)
> 	at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
> 	at org.apache.el.parser.AstFunction.getValue(AstFunction.java:138)
> 	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188)
> 	at javax.el.ELProcessor.getValue(ELProcessor.java:129)
> 	at javax.el.ELProcessor.eval(ELProcessor.java:115)
> 	at org.apache.naming.factory.ExpressionFactoryTest.elImplementationShouldWork(ExpressionFactoryTest.java:43)
> 
> So I guess it's normal behaviour, isn't it?

No.  Your example works fine for me,  rev# 1523651.

public class ElFileTest {
	@Test
	public void testElAndFile() throws IOException {
		ELProcessor proc = new ELProcessor();
		proc.getELManager().importClass("java.io.File");
		File f = (File) proc.eval("File('./')");
		Assert.assertEquals(new File("./").getCanonicalPath(), f.getCanonicalPath());
	}
}

Dan

> 
> I don't think EL spec does mandate implementations to make their best effort to find a suitable method when invoking overloaded methods.
> 
> Xavier
> 
> ----------------------------------------
>> Subject: Re: Using EL expressions in an ObjectFactory
>> From: dmikusa@gopivotal.com
>> Date: Mon, 16 Sep 2013 07:48:33 -0400
>> To: users@tomcat.apache.org
>> 
>> On Sep 16, 2013, at 3:03 AM, Xavier Dury <ka...@hotmail.com> wrote:
>> 
>>> Hi,
>>> 
>>> I switched to org.apache.tomcat:tomcat-jasper-el:8.0.0-RC1 as javax.el 3.0 implementation and tested with the following code:
>>> 
>>> ELProcessor processor = new ELProcessor();
>>> processor.getELManager().importClass("java.io.File");
>>> processor.eval("File('./')");
>>> 
>>> but I get the following error:
>>> 
>>> javax.el.ELException: Function ':File' not found
>>> at org.apache.el.parser.AstFunction.getValue(AstFunction.java:136)
>>> at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188)
>>> at javax.el.ELProcessor.getValue(ELProcessor.java:129)
>>> at javax.el.ELProcessor.eval(ELProcessor.java:115)
>>> at org.apache.naming.factory.ExpressionFactoryTest.elImplementationShouldWork(ExpressionFactoryTest.java:43)
>>> 
>>> Are methods importClass, importStatic and importPackage on ELManager already implemented in apache EL?
>> 
>> Sorry, I don't think I was clear enough in my last response. This does not work with Tomcat 8.0.0-RC1, but has been fixed (see the bug I referenced earlier). You'll need to either build and use Tomcat trunk or wait until the next RC release is available.
>> 
>> Dan
>> 
>>> 
>>> Regards,
>>> 
>>> Xavier
>>> 
>>> ----------------------------------------
>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>> From: dmikusa@gopivotal.com
>>>> Date: Fri, 13 Sep 2013 15:38:29 -0400
>>>> To: users@tomcat.apache.org
>>>> 
>>>> On Sep 13, 2013, at 3:27 AM, Xavier Dury <ka...@hotmail.com> wrote:
>>>> 
>>>>> When I try the following:
>>>>> 
>>>>> ELProcessor processor = new ELProcessor();
>>>>> processor.getELManager().importClass("java.io.File");
>>>>> processor.eval("File('./')");
>>>>> 
>>>>> I get javax.el.ELException: java.lang.IllegalArgumentException: Cannot convert ./ of type class java.lang.String to class java.net.URI.
>>>>> 
>>>>> I'm using glassfish javax.el 3.0 implementation for my tests. Maybe the problem comes from this specific implementation.
>>>> 
>>>> Yes, that would be the problem. I've noticed the same behavior w/GlassFish's EL 3.0 implementation. Try building Tomcat trunk and using it's implementation or using the next Tomcat 8 RC when it's available. Neither should have that problem.
>>>> 
>>>> Dan
>>>> 
>>>> 
>>>>> 
>>>>> ----------------------------------------
>>>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>>>> From: dmikusa@gopivotal.com
>>>>>> Date: Thu, 12 Sep 2013 17:10:21 -0400
>>>>>> To: users@tomcat.apache.org
>>>>>> 
>>>>>> On Sep 12, 2013, at 7:58 AM, Xavier Dury <ka...@hotmail.com> wrote:
>>>>>> 
>>>>>>> Ok,
>>>>>>> 
>>>>>>> I fixed the styling and the documentation. If anything else must be changed, don't hesitate.
>>>>>> 
>>>>>> In your docs, you state the following remark...
>>>>>> 
>>>>>> "Try to avoid overloaded methods/constructors as much as possible in EL 3.0 expression as the ELProcessor will use the first one it will find by reflection."
>>>>>> 
>>>>>> Can you clarify what you mean by this? There was a problem in RC-1 that sounds similar, but it's been fixed.
>>>>>> 
>>>>>> https://issues.apache.org/bugzilla/show_bug.cgi?id=55483
>>>>>> 
>>>>>> Is this a problem in trunk? Point being, if you're seeing an issue with EL 3.0, we should try to fix it.
>>>>>> 
>>>>>> Dan
>>>>>> 
>>>>>> 
>>>>>>> ----------------------------------------
>>>>>>>> Date: Thu, 12 Sep 2013 12:01:26 +0100
>>>>>>>> From: markt@apache.org
>>>>>>>> To: users@tomcat.apache.org
>>>>>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>>>>>> 
>>>>>>>> On 12/09/2013 11:49, Xavier Dury wrote:
>>>>>>>>> Hi,
>>>>>>>>> 
>>>>>>>>> I implemented a simple ExpressionFactory @
>>>>>>>>> https://github.com/kalgon/expression-factory.
>>>>>>>>> 
>>>>>>>>> I would love to see this ExpressionFactory next to
>>>>>>>>> org.apache.naming.factory.BeanFactory in tomcat.
>>>>>>>> 
>>>>>>>> No objections in principle.
>>>>>>>> 
>>>>>>>> Haven't looked at the new code in detail. A few initial observations:
>>>>>>>> - I'm assuming this is a contribution as per section 5 of the Apache
>>>>>>>> License, version 2.0
>>>>>>>> - There is no documentation
>>>>>>>> - Tomcat code standards use 4 spaces for indents, not tabs
>>>>>>>> - Some @Override markers look to be missing
>>>>>>>> 
>>>>>>>> Mark
>>>>>>>> 
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 		 	   		  
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Using EL expressions in an ObjectFactory

Posted by Mark Thomas <ma...@apache.org>.
On 16/09/2013 14:43, Xavier Dury wrote:
> I built tomcat from trunk (rev 1523639) and I'm having the same issue I had with glassfish EL implementation when using overloaded methods:
> 
> javax.el.ELException: Cannot convert ./ of type class java.lang.String to class java.net.URI
> 	at org.apache.el.lang.ELSupport.coerceToType(ELSupport.java:482)
> 	at org.apache.el.ExpressionFactoryImpl.coerceToType(ExpressionFactoryImpl.java:48)
> 	at javax.el.ELContext.convertToType(ELContext.java:473)
> 	at org.apache.el.lang.EvaluationContext.convertToType(EvaluationContext.java:155)
> 	at javax.el.ELUtil.invokeConstructor(ELUtil.java:261)
> 	at javax.el.StaticFieldELResolver.invoke(StaticFieldELResolver.java:203)
> 	at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
> 	at org.apache.el.parser.AstFunction.getValue(AstFunction.java:138)
> 	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188)
> 	at javax.el.ELProcessor.getValue(ELProcessor.java:129)
> 	at javax.el.ELProcessor.eval(ELProcessor.java:115)
> 	at org.apache.naming.factory.ExpressionFactoryTest.elImplementationShouldWork(ExpressionFactoryTest.java:43)
> 
> So I guess it's normal behaviour, isn't it?
> 
> I don't think EL spec does mandate implementations to make their best effort to find a suitable method when invoking overloaded methods.

My intention with the Tomcat EL implementation is to replicate, as far
as possible, the matching process that the Java compiler uses.

If you open a bug and include a test case along the lines of this
one[1], I'll take a look.

Mark

[1]
http://svn.apache.org/viewvc/tomcat/trunk/test/javax/el/TestUtil.java?view=annotate

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Using EL expressions in an ObjectFactory

Posted by Xavier Dury <ka...@hotmail.com>.
I built tomcat from trunk (rev 1523639) and I'm having the same issue I had with glassfish EL implementation when using overloaded methods:

javax.el.ELException: Cannot convert ./ of type class java.lang.String to class java.net.URI
	at org.apache.el.lang.ELSupport.coerceToType(ELSupport.java:482)
	at org.apache.el.ExpressionFactoryImpl.coerceToType(ExpressionFactoryImpl.java:48)
	at javax.el.ELContext.convertToType(ELContext.java:473)
	at org.apache.el.lang.EvaluationContext.convertToType(EvaluationContext.java:155)
	at javax.el.ELUtil.invokeConstructor(ELUtil.java:261)
	at javax.el.StaticFieldELResolver.invoke(StaticFieldELResolver.java:203)
	at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
	at org.apache.el.parser.AstFunction.getValue(AstFunction.java:138)
	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188)
	at javax.el.ELProcessor.getValue(ELProcessor.java:129)
	at javax.el.ELProcessor.eval(ELProcessor.java:115)
	at org.apache.naming.factory.ExpressionFactoryTest.elImplementationShouldWork(ExpressionFactoryTest.java:43)

So I guess it's normal behaviour, isn't it?

I don't think EL spec does mandate implementations to make their best effort to find a suitable method when invoking overloaded methods.

Xavier

----------------------------------------
> Subject: Re: Using EL expressions in an ObjectFactory
> From: dmikusa@gopivotal.com
> Date: Mon, 16 Sep 2013 07:48:33 -0400
> To: users@tomcat.apache.org
>
> On Sep 16, 2013, at 3:03 AM, Xavier Dury <ka...@hotmail.com> wrote:
>
>> Hi,
>>
>> I switched to org.apache.tomcat:tomcat-jasper-el:8.0.0-RC1 as javax.el 3.0 implementation and tested with the following code:
>>
>> ELProcessor processor = new ELProcessor();
>> processor.getELManager().importClass("java.io.File");
>> processor.eval("File('./')");
>>
>> but I get the following error:
>>
>> javax.el.ELException: Function ':File' not found
>> at org.apache.el.parser.AstFunction.getValue(AstFunction.java:136)
>> at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188)
>> at javax.el.ELProcessor.getValue(ELProcessor.java:129)
>> at javax.el.ELProcessor.eval(ELProcessor.java:115)
>> at org.apache.naming.factory.ExpressionFactoryTest.elImplementationShouldWork(ExpressionFactoryTest.java:43)
>>
>> Are methods importClass, importStatic and importPackage on ELManager already implemented in apache EL?
>
> Sorry, I don't think I was clear enough in my last response. This does not work with Tomcat 8.0.0-RC1, but has been fixed (see the bug I referenced earlier). You'll need to either build and use Tomcat trunk or wait until the next RC release is available.
>
> Dan
>
>>
>> Regards,
>>
>> Xavier
>>
>> ----------------------------------------
>>> Subject: Re: Using EL expressions in an ObjectFactory
>>> From: dmikusa@gopivotal.com
>>> Date: Fri, 13 Sep 2013 15:38:29 -0400
>>> To: users@tomcat.apache.org
>>>
>>> On Sep 13, 2013, at 3:27 AM, Xavier Dury <ka...@hotmail.com> wrote:
>>>
>>>> When I try the following:
>>>>
>>>> ELProcessor processor = new ELProcessor();
>>>> processor.getELManager().importClass("java.io.File");
>>>> processor.eval("File('./')");
>>>>
>>>> I get javax.el.ELException: java.lang.IllegalArgumentException: Cannot convert ./ of type class java.lang.String to class java.net.URI.
>>>>
>>>> I'm using glassfish javax.el 3.0 implementation for my tests. Maybe the problem comes from this specific implementation.
>>>
>>> Yes, that would be the problem. I've noticed the same behavior w/GlassFish's EL 3.0 implementation. Try building Tomcat trunk and using it's implementation or using the next Tomcat 8 RC when it's available. Neither should have that problem.
>>>
>>> Dan
>>>
>>>
>>>>
>>>> ----------------------------------------
>>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>>> From: dmikusa@gopivotal.com
>>>>> Date: Thu, 12 Sep 2013 17:10:21 -0400
>>>>> To: users@tomcat.apache.org
>>>>>
>>>>> On Sep 12, 2013, at 7:58 AM, Xavier Dury <ka...@hotmail.com> wrote:
>>>>>
>>>>>> Ok,
>>>>>>
>>>>>> I fixed the styling and the documentation. If anything else must be changed, don't hesitate.
>>>>>
>>>>> In your docs, you state the following remark...
>>>>>
>>>>> "Try to avoid overloaded methods/constructors as much as possible in EL 3.0 expression as the ELProcessor will use the first one it will find by reflection."
>>>>>
>>>>> Can you clarify what you mean by this? There was a problem in RC-1 that sounds similar, but it's been fixed.
>>>>>
>>>>> https://issues.apache.org/bugzilla/show_bug.cgi?id=55483
>>>>>
>>>>> Is this a problem in trunk? Point being, if you're seeing an issue with EL 3.0, we should try to fix it.
>>>>>
>>>>> Dan
>>>>>
>>>>>
>>>>>> ----------------------------------------
>>>>>>> Date: Thu, 12 Sep 2013 12:01:26 +0100
>>>>>>> From: markt@apache.org
>>>>>>> To: users@tomcat.apache.org
>>>>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>>>>>
>>>>>>> On 12/09/2013 11:49, Xavier Dury wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I implemented a simple ExpressionFactory @
>>>>>>>> https://github.com/kalgon/expression-factory.
>>>>>>>>
>>>>>>>> I would love to see this ExpressionFactory next to
>>>>>>>> org.apache.naming.factory.BeanFactory in tomcat.
>>>>>>>
>>>>>>> No objections in principle.
>>>>>>>
>>>>>>> Haven't looked at the new code in detail. A few initial observations:
>>>>>>> - I'm assuming this is a contribution as per section 5 of the Apache
>>>>>>> License, version 2.0
>>>>>>> - There is no documentation
>>>>>>> - Tomcat code standards use 4 spaces for indents, not tabs
>>>>>>> - Some @Override markers look to be missing
>>>>>>>
>>>>>>> Mark
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 		 	   		  
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Using EL expressions in an ObjectFactory

Posted by Daniel Mikusa <dm...@gopivotal.com>.
On Sep 16, 2013, at 3:03 AM, Xavier Dury <ka...@hotmail.com> wrote:

> Hi,
> 
> I switched to org.apache.tomcat:tomcat-jasper-el:8.0.0-RC1 as javax.el 3.0 implementation and tested with the following code:
> 
> ELProcessor processor = new ELProcessor();
> processor.getELManager().importClass("java.io.File");
> processor.eval("File('./')");
> 
> but I get the following error:
> 
> javax.el.ELException: Function ':File' not found
> 	at org.apache.el.parser.AstFunction.getValue(AstFunction.java:136)
> 	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188)
> 	at javax.el.ELProcessor.getValue(ELProcessor.java:129)
> 	at javax.el.ELProcessor.eval(ELProcessor.java:115)
> 	at org.apache.naming.factory.ExpressionFactoryTest.elImplementationShouldWork(ExpressionFactoryTest.java:43)
> 
> Are methods importClass, importStatic and importPackage on ELManager already implemented in apache EL?

Sorry, I don't think I was clear enough in my last response.  This does not work with Tomcat 8.0.0-RC1, but has been fixed (see the bug I referenced earlier).  You'll need to either build and use Tomcat trunk or wait until the next RC release is available.

Dan

> 
> Regards,
> 
> Xavier
> 
> ----------------------------------------
>> Subject: Re: Using EL expressions in an ObjectFactory
>> From: dmikusa@gopivotal.com
>> Date: Fri, 13 Sep 2013 15:38:29 -0400
>> To: users@tomcat.apache.org
>> 
>> On Sep 13, 2013, at 3:27 AM, Xavier Dury <ka...@hotmail.com> wrote:
>> 
>>> When I try the following:
>>> 
>>> ELProcessor processor = new ELProcessor();
>>> processor.getELManager().importClass("java.io.File");
>>> processor.eval("File('./')");
>>> 
>>> I get javax.el.ELException: java.lang.IllegalArgumentException: Cannot convert ./ of type class java.lang.String to class java.net.URI.
>>> 
>>> I'm using glassfish javax.el 3.0 implementation for my tests. Maybe the problem comes from this specific implementation.
>> 
>> Yes, that would be the problem. I've noticed the same behavior w/GlassFish's EL 3.0 implementation. Try building Tomcat trunk and using it's implementation or using the next Tomcat 8 RC when it's available. Neither should have that problem.
>> 
>> Dan
>> 
>> 
>>> 
>>> ----------------------------------------
>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>> From: dmikusa@gopivotal.com
>>>> Date: Thu, 12 Sep 2013 17:10:21 -0400
>>>> To: users@tomcat.apache.org
>>>> 
>>>> On Sep 12, 2013, at 7:58 AM, Xavier Dury <ka...@hotmail.com> wrote:
>>>> 
>>>>> Ok,
>>>>> 
>>>>> I fixed the styling and the documentation. If anything else must be changed, don't hesitate.
>>>> 
>>>> In your docs, you state the following remark...
>>>> 
>>>> "Try to avoid overloaded methods/constructors as much as possible in EL 3.0 expression as the ELProcessor will use the first one it will find by reflection."
>>>> 
>>>> Can you clarify what you mean by this? There was a problem in RC-1 that sounds similar, but it's been fixed.
>>>> 
>>>> https://issues.apache.org/bugzilla/show_bug.cgi?id=55483
>>>> 
>>>> Is this a problem in trunk? Point being, if you're seeing an issue with EL 3.0, we should try to fix it.
>>>> 
>>>> Dan
>>>> 
>>>> 
>>>>> ----------------------------------------
>>>>>> Date: Thu, 12 Sep 2013 12:01:26 +0100
>>>>>> From: markt@apache.org
>>>>>> To: users@tomcat.apache.org
>>>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>>>> 
>>>>>> On 12/09/2013 11:49, Xavier Dury wrote:
>>>>>>> Hi,
>>>>>>> 
>>>>>>> I implemented a simple ExpressionFactory @
>>>>>>> https://github.com/kalgon/expression-factory.
>>>>>>> 
>>>>>>> I would love to see this ExpressionFactory next to
>>>>>>> org.apache.naming.factory.BeanFactory in tomcat.
>>>>>> 
>>>>>> No objections in principle.
>>>>>> 
>>>>>> Haven't looked at the new code in detail. A few initial observations:
>>>>>> - I'm assuming this is a contribution as per section 5 of the Apache
>>>>>> License, version 2.0
>>>>>> - There is no documentation
>>>>>> - Tomcat code standards use 4 spaces for indents, not tabs
>>>>>> - Some @Override markers look to be missing
>>>>>> 
>>>>>> Mark
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 		 	   		  
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Using EL expressions in an ObjectFactory

Posted by Xavier Dury <ka...@hotmail.com>.
Hi,

I switched to org.apache.tomcat:tomcat-jasper-el:8.0.0-RC1 as javax.el 3.0 implementation and tested with the following code:

ELProcessor processor = new ELProcessor();
processor.getELManager().importClass("java.io.File");
processor.eval("File('./')");

but I get the following error:

javax.el.ELException: Function ':File' not found
	at org.apache.el.parser.AstFunction.getValue(AstFunction.java:136)
	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188)
	at javax.el.ELProcessor.getValue(ELProcessor.java:129)
	at javax.el.ELProcessor.eval(ELProcessor.java:115)
	at org.apache.naming.factory.ExpressionFactoryTest.elImplementationShouldWork(ExpressionFactoryTest.java:43)

Are methods importClass, importStatic and importPackage on ELManager already implemented in apache EL?

Regards,

Xavier

----------------------------------------
> Subject: Re: Using EL expressions in an ObjectFactory
> From: dmikusa@gopivotal.com
> Date: Fri, 13 Sep 2013 15:38:29 -0400
> To: users@tomcat.apache.org
>
> On Sep 13, 2013, at 3:27 AM, Xavier Dury <ka...@hotmail.com> wrote:
>
>> When I try the following:
>>
>> ELProcessor processor = new ELProcessor();
>> processor.getELManager().importClass("java.io.File");
>> processor.eval("File('./')");
>>
>> I get javax.el.ELException: java.lang.IllegalArgumentException: Cannot convert ./ of type class java.lang.String to class java.net.URI.
>>
>> I'm using glassfish javax.el 3.0 implementation for my tests. Maybe the problem comes from this specific implementation.
>
> Yes, that would be the problem. I've noticed the same behavior w/GlassFish's EL 3.0 implementation. Try building Tomcat trunk and using it's implementation or using the next Tomcat 8 RC when it's available. Neither should have that problem.
>
> Dan
>
>
>>
>> ----------------------------------------
>>> Subject: Re: Using EL expressions in an ObjectFactory
>>> From: dmikusa@gopivotal.com
>>> Date: Thu, 12 Sep 2013 17:10:21 -0400
>>> To: users@tomcat.apache.org
>>>
>>> On Sep 12, 2013, at 7:58 AM, Xavier Dury <ka...@hotmail.com> wrote:
>>>
>>>> Ok,
>>>>
>>>> I fixed the styling and the documentation. If anything else must be changed, don't hesitate.
>>>
>>> In your docs, you state the following remark...
>>>
>>> "Try to avoid overloaded methods/constructors as much as possible in EL 3.0 expression as the ELProcessor will use the first one it will find by reflection."
>>>
>>> Can you clarify what you mean by this? There was a problem in RC-1 that sounds similar, but it's been fixed.
>>>
>>> https://issues.apache.org/bugzilla/show_bug.cgi?id=55483
>>>
>>> Is this a problem in trunk? Point being, if you're seeing an issue with EL 3.0, we should try to fix it.
>>>
>>> Dan
>>>
>>>
>>>> ----------------------------------------
>>>>> Date: Thu, 12 Sep 2013 12:01:26 +0100
>>>>> From: markt@apache.org
>>>>> To: users@tomcat.apache.org
>>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>>>
>>>>> On 12/09/2013 11:49, Xavier Dury wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I implemented a simple ExpressionFactory @
>>>>>> https://github.com/kalgon/expression-factory.
>>>>>>
>>>>>> I would love to see this ExpressionFactory next to
>>>>>> org.apache.naming.factory.BeanFactory in tomcat.
>>>>>
>>>>> No objections in principle.
>>>>>
>>>>> Haven't looked at the new code in detail. A few initial observations:
>>>>> - I'm assuming this is a contribution as per section 5 of the Apache
>>>>> License, version 2.0
>>>>> - There is no documentation
>>>>> - Tomcat code standards use 4 spaces for indents, not tabs
>>>>> - Some @Override markers look to be missing
>>>>>
>>>>> Mark
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 		 	   		  
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Using EL expressions in an ObjectFactory

Posted by Daniel Mikusa <dm...@gopivotal.com>.
On Sep 13, 2013, at 3:27 AM, Xavier Dury <ka...@hotmail.com> wrote:

> When I try the following:
> 
> ELProcessor processor = new ELProcessor();
> processor.getELManager().importClass("java.io.File");
> processor.eval("File('./')");
> 
> I get javax.el.ELException: java.lang.IllegalArgumentException: Cannot convert ./ of type class java.lang.String to class java.net.URI.
> 
> I'm using glassfish javax.el 3.0 implementation for my tests. Maybe the problem comes from this specific implementation.

Yes, that would be the problem.  I've noticed the same behavior w/GlassFish's EL 3.0 implementation.  Try building Tomcat trunk and using it's implementation or using the next Tomcat 8 RC when it's available.  Neither should have that problem.

Dan


> 
> ----------------------------------------
>> Subject: Re: Using EL expressions in an ObjectFactory
>> From: dmikusa@gopivotal.com
>> Date: Thu, 12 Sep 2013 17:10:21 -0400
>> To: users@tomcat.apache.org
>> 
>> On Sep 12, 2013, at 7:58 AM, Xavier Dury <ka...@hotmail.com> wrote:
>> 
>>> Ok,
>>> 
>>> I fixed the styling and the documentation. If anything else must be changed, don't hesitate.
>> 
>> In your docs, you state the following remark...
>> 
>> "Try to avoid overloaded methods/constructors as much as possible in EL 3.0 expression as the ELProcessor will use the first one it will find by reflection."
>> 
>> Can you clarify what you mean by this? There was a problem in RC-1 that sounds similar, but it's been fixed.
>> 
>> https://issues.apache.org/bugzilla/show_bug.cgi?id=55483
>> 
>> Is this a problem in trunk? Point being, if you're seeing an issue with EL 3.0, we should try to fix it.
>> 
>> Dan
>> 
>> 
>>> ----------------------------------------
>>>> Date: Thu, 12 Sep 2013 12:01:26 +0100
>>>> From: markt@apache.org
>>>> To: users@tomcat.apache.org
>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>> 
>>>> On 12/09/2013 11:49, Xavier Dury wrote:
>>>>> Hi,
>>>>> 
>>>>> I implemented a simple ExpressionFactory @
>>>>> https://github.com/kalgon/expression-factory.
>>>>> 
>>>>> I would love to see this ExpressionFactory next to
>>>>> org.apache.naming.factory.BeanFactory in tomcat.
>>>> 
>>>> No objections in principle.
>>>> 
>>>> Haven't looked at the new code in detail. A few initial observations:
>>>> - I'm assuming this is a contribution as per section 5 of the Apache
>>>> License, version 2.0
>>>> - There is no documentation
>>>> - Tomcat code standards use 4 spaces for indents, not tabs
>>>> - Some @Override markers look to be missing
>>>> 
>>>> Mark
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 		 	   		  
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Using EL expressions in an ObjectFactory

Posted by Xavier Dury <ka...@hotmail.com>.
When I try the following:

ELProcessor processor = new ELProcessor();
processor.getELManager().importClass("java.io.File");
processor.eval("File('./')");

I get javax.el.ELException: java.lang.IllegalArgumentException: Cannot convert ./ of type class java.lang.String to class java.net.URI.

I'm using glassfish javax.el 3.0 implementation for my tests. Maybe the problem comes from this specific implementation.

Xavier

----------------------------------------
> Subject: Re: Using EL expressions in an ObjectFactory
> From: dmikusa@gopivotal.com
> Date: Thu, 12 Sep 2013 17:10:21 -0400
> To: users@tomcat.apache.org
>
> On Sep 12, 2013, at 7:58 AM, Xavier Dury <ka...@hotmail.com> wrote:
>
>> Ok,
>>
>> I fixed the styling and the documentation. If anything else must be changed, don't hesitate.
>
> In your docs, you state the following remark...
>
> "Try to avoid overloaded methods/constructors as much as possible in EL 3.0 expression as the ELProcessor will use the first one it will find by reflection."
>
> Can you clarify what you mean by this? There was a problem in RC-1 that sounds similar, but it's been fixed.
>
> https://issues.apache.org/bugzilla/show_bug.cgi?id=55483
>
> Is this a problem in trunk? Point being, if you're seeing an issue with EL 3.0, we should try to fix it.
>
> Dan
>
>
>> ----------------------------------------
>>> Date: Thu, 12 Sep 2013 12:01:26 +0100
>>> From: markt@apache.org
>>> To: users@tomcat.apache.org
>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>
>>> On 12/09/2013 11:49, Xavier Dury wrote:
>>>> Hi,
>>>>
>>>> I implemented a simple ExpressionFactory @
>>>> https://github.com/kalgon/expression-factory.
>>>>
>>>> I would love to see this ExpressionFactory next to
>>>> org.apache.naming.factory.BeanFactory in tomcat.
>>>
>>> No objections in principle.
>>>
>>> Haven't looked at the new code in detail. A few initial observations:
>>> - I'm assuming this is a contribution as per section 5 of the Apache
>>> License, version 2.0
>>> - There is no documentation
>>> - Tomcat code standards use 4 spaces for indents, not tabs
>>> - Some @Override markers look to be missing
>>>
>>> Mark
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 		 	   		  
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Using EL expressions in an ObjectFactory

Posted by Daniel Mikusa <dm...@gopivotal.com>.
On Sep 12, 2013, at 7:58 AM, Xavier Dury <ka...@hotmail.com> wrote:

> Ok,
> 
> I fixed the styling and the documentation. If anything else must be changed, don't hesitate.

In your docs, you state the following remark...

"Try to avoid overloaded methods/constructors as much as possible in EL 3.0 expression as the ELProcessor will use the first one it will find by reflection."

Can you clarify what you mean by this?  There was a problem in RC-1 that sounds similar, but it's been fixed.  

  https://issues.apache.org/bugzilla/show_bug.cgi?id=55483

Is this a problem in trunk?  Point being, if you're seeing an issue with EL 3.0, we should try to fix it.

Dan


> ----------------------------------------
>> Date: Thu, 12 Sep 2013 12:01:26 +0100
>> From: markt@apache.org
>> To: users@tomcat.apache.org
>> Subject: Re: Using EL expressions in an ObjectFactory
>> 
>> On 12/09/2013 11:49, Xavier Dury wrote:
>>> Hi,
>>> 
>>> I implemented a simple ExpressionFactory @
>>> https://github.com/kalgon/expression-factory.
>>> 
>>> I would love to see this ExpressionFactory next to
>>> org.apache.naming.factory.BeanFactory in tomcat.
>> 
>> No objections in principle.
>> 
>> Haven't looked at the new code in detail. A few initial observations:
>> - I'm assuming this is a contribution as per section 5 of the Apache
>> License, version 2.0
>> - There is no documentation
>> - Tomcat code standards use 4 spaces for indents, not tabs
>> - Some @Override markers look to be missing
>> 
>> Mark
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 		 	   		  
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Using EL expressions in an ObjectFactory

Posted by Xavier Dury <ka...@hotmail.com>.
Ok,

I fixed the styling and the documentation. If anything else must be changed, don't hesitate.

Thanks,

Xavier.

----------------------------------------
> Date: Thu, 12 Sep 2013 12:01:26 +0100
> From: markt@apache.org
> To: users@tomcat.apache.org
> Subject: Re: Using EL expressions in an ObjectFactory
>
> On 12/09/2013 11:49, Xavier Dury wrote:
>> Hi,
>>
>> I implemented a simple ExpressionFactory @
>> https://github.com/kalgon/expression-factory.
>>
>> I would love to see this ExpressionFactory next to
>> org.apache.naming.factory.BeanFactory in tomcat.
>
> No objections in principle.
>
> Haven't looked at the new code in detail. A few initial observations:
> - I'm assuming this is a contribution as per section 5 of the Apache
> License, version 2.0
> - There is no documentation
> - Tomcat code standards use 4 spaces for indents, not tabs
> - Some @Override markers look to be missing
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 		 	   		  
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Using EL expressions in an ObjectFactory

Posted by Mark Thomas <ma...@apache.org>.
On 12/09/2013 11:49, Xavier Dury wrote:
> Hi,
> 
> I implemented a simple ExpressionFactory @
> https://github.com/kalgon/expression-factory.
> 
> I would love to see this ExpressionFactory next to
> org.apache.naming.factory.BeanFactory in tomcat.

No objections in principle.

Haven't looked at the new code in detail. A few initial observations:
- I'm assuming this is a contribution as per section 5 of the Apache
License, version 2.0
- There is no documentation
- Tomcat code standards use 4 spaces for indents, not tabs
- Some @Override markers look to be missing

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org