Re: Webapp HTTP proxy authentication

2013-08-17 Thread Daniel Mikusa
On Aug 16, 2013, at 4:14 PM, Marko Asplund  wrote:

> Hi,
> 
> We're developing webapps running on Tomcat 7. The apps use third-party
> components that we can't modify and those components connect to external
> sites using HTTP.
> Our ops guys have a policy of routing all outbound traffic through an
> authenticating HTTP proxy.
> This is a bit of problem for us since the Oracle Java 7 JVM doesn't support
> configuring proxy authentication on the JVM level (using e.g. system
> properties).
> 
> One possible workaround I could think of is to create a custom javaagent
> that would set a default java.net.Authenticator in premain() method. This
> approach appears to work in a command line program that
> uses HttpURLConnection, but are there any potential caveats to this method
> when used with webapps running in Tomcat? One shortcoming is that the same
> Authenticator would be used for all webapps in the JVM, but this is
> something we can live with.

How about a ServletContextListener?

  http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContextListener.html

or a LifecycleListener?

  https://tomcat.apache.org/tomcat-7.0-doc/config/listeners.html

Either one should allow you to configure your proxy settings before your 
applications start. 

Dan

> 
> 
> marko


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



Re: EL 3.0 Constructor Reference

2013-08-17 Thread Daniel Mikusa
On Aug 17, 2013, at 2:09 AM, Violeta Georgieva  wrote:

> 2013/8/14 Daniel Mikusa wrote:
>> 
>> In the EL 3.0 Spec, section 1.22.3 "Constructor Reference"  states "A
> class name reference, followed by arguments in parenthesis, such as
> "Boolean(true)" denotes the invocation of the constructor of the class with
> the supplied arguments."
>> 
>> This leads me to believe that the following test should work:
>> 
>>@Test
>>public void testImport03() {
>>ELProcessor processor = new ELProcessor();
>>Object result =
>>processor.getValue("Integer('1000')",
>>Integer.class);
>>Assert.assertEquals(Integer.valueOf(1000), result);
>>}
>> 
>> Unfortunately, this fails with the following error.
>> 
>> javax.el.ELException: Function ':Integer' 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:45)
>>at
> org.apache.el.parser.TestAstIdentifier.testImport03(TestAstIdentifier.java:53)
>> …
> 
> This is a bug.
> Can you create an issue in BZ?

Sure, no problem.  

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

Dan

> 
> Thanks
> Violeta


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