Be more generic for tld checking in the Compiler.isOutDated()

2012-08-01 Thread Ivan
Hi, while checking whether the JSP file is out of date in the
Compiler.isOutDated(), the codes will check whether there is any update for
the tld files used in JSP. Now, the codes are like below :

 Iterator> it = depends.entrySet().iterator();
while (it.hasNext()) {
Entry include = it.next();
try {
String key = include.getKey();
URL includeUrl;

// Currently, the codes will first check whether is of jar
protocol, if not, it will try to get the URL with
JspCompilationContext.getResource().
// This is correct in most cases, while Geronimo tries to
support to reference tld from other places, the string may be file URL
based.
// Is it possible to update the codes to make the checking
more generic
// e.g. if(key.indexOf(":") !=-1) {
  try {
 includeUrl = new URL(key);
  } catch(MalformedURLException e) {}
  }
// If it is reasonable, I would like to open a JIRA for
that. Thanks.

if (key.startsWith("jar:")) {
includeUrl = new URL(key);
} else {
includeUrl = ctxt.getResource(include.getKey());
}
if (includeUrl == null) {
return true;
}

..
} catch (Exception e) {
if (log.isDebugEnabled())
log.debug("Problem accessing resource. Treat as
outdated.",
e);
return true;
}
}

-- 
Ivan


Re: Be more generic for tld checking in the Compiler.isOutDated()

2012-08-02 Thread Ivan
Any comment for this ? Now, the JSP file will be recompiled each time even
no change is done. The most reason is that, e.g. a file:// URL is used for
TLD file.

2012/8/1 Ivan 

> Hi, while checking whether the JSP file is out of date in the
> Compiler.isOutDated(), the codes will check whether there is any update for
> the tld files used in JSP. Now, the codes are like below :
>
>  Iterator> it = depends.entrySet().iterator();
> while (it.hasNext()) {
> Entry include = it.next();
> try {
> String key = include.getKey();
> URL includeUrl;
>
> // Currently, the codes will first check whether is of jar
> protocol, if not, it will try to get the URL with
> JspCompilationContext.getResource().
> // This is correct in most cases, while Geronimo tries to
> support to reference tld from other places, the string may be file URL
> based.
> // Is it possible to update the codes to make the checking
> more generic
> // e.g. if(key.indexOf(":") !=-1) {
>   try {
>  includeUrl = new URL(key);
>   } catch(MalformedURLException e) {}
>   }
> // If it is reasonable, I would like to open a JIRA for
> that. Thanks.
>
> if (key.startsWith("jar:")) {
> includeUrl = new URL(key);
> } else {
> includeUrl = ctxt.getResource(include.getKey());
> }
> if (includeUrl == null) {
> return true;
> }
>
> ..
> } catch (Exception e) {
> if (log.isDebugEnabled())
> log.debug("Problem accessing resource. Treat as
> outdated.",
> e);
> return true;
> }
> }
>
> --
> Ivan
>



-- 
Ivan


Re: svn commit: r1144690 - in /tomcat/trunk: java/org/apache/catalina/startup/Catalina.java java/org/apache/catalina/startup/ClusterRuleSetFactory.java webapps/docs/changelog.xml

2011-07-11 Thread Ivan
Hi, this changes brought a cycle dependency between the tomcat-catalina and
tomcat-catalina-ha module, could you please help to fix it.
Thanks.

2011/7/10 

> Author: markt
> Date: Sat Jul  9 16:05:42 2011
> New Revision: 1144690
>
> URL: http://svn.apache.org/viewvc?rev=1144690&view=rev
> Log:
> Remove some more unnecessary code
>
> Removed:
>tomcat/trunk/java/org/apache/catalina/startup/ClusterRuleSetFactory.java
> Modified:
>tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
>tomcat/trunk/webapps/docs/changelog.xml
>
> Modified: tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
> URL:
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Catalina.java?rev=1144690&r1=1144689&r2=1144690&view=diff
>
> ==
> --- tomcat/trunk/java/org/apache/catalina/startup/Catalina.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/startup/Catalina.java Sat Jul  9
> 16:05:42 2011
> @@ -36,6 +36,7 @@ import org.apache.catalina.LifecycleExce
>  import org.apache.catalina.LifecycleState;
>  import org.apache.catalina.Server;
>  import org.apache.catalina.core.StandardServer;
> +import org.apache.catalina.ha.ClusterRuleSet;
>  import org.apache.catalina.security.SecurityConfig;
>  import org.apache.juli.ClassLoaderLogManager;
>  import org.apache.tomcat.util.ExceptionUtils;
> @@ -373,13 +374,13 @@ public class Catalina {
> digester.addRuleSet(new EngineRuleSet("Server/Service/"));
> digester.addRuleSet(new HostRuleSet("Server/Service/Engine/"));
> digester.addRuleSet(new
> ContextRuleSet("Server/Service/Engine/Host/"));
> -
>  
> digester.addRuleSet(ClusterRuleSetFactory.getClusterRuleSet("Server/Service/Engine/Host/Cluster/"));
> +digester.addRuleSet(new
> ClusterRuleSet("Server/Service/Engine/Host/Cluster/"));
> digester.addRuleSet(new
> NamingRuleSet("Server/Service/Engine/Host/Context/"));
>
> // When the 'engine' is found, set the parentClassLoader.
> digester.addRule("Server/Service/Engine",
>  new SetParentClassLoaderRule(parentClassLoader));
> -
>  
> digester.addRuleSet(ClusterRuleSetFactory.getClusterRuleSet("Server/Service/Engine/Cluster/"));
> +digester.addRuleSet(new
> ClusterRuleSet("Server/Service/Engine/Cluster/"));
>
> long t2=System.currentTimeMillis();
> if (log.isDebugEnabled())
>
> Modified: tomcat/trunk/webapps/docs/changelog.xml
> URL:
> http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1144690&r1=1144689&r2=1144690&view=diff
>
> ==
> --- tomcat/trunk/webapps/docs/changelog.xml (original)
> +++ tomcat/trunk/webapps/docs/changelog.xml Sat Jul  9 16:05:42 2011
> @@ -66,6 +66,14 @@
>   
> 
>   
> +  
> +
> +  
> +Remove unnecessary serverl.xml parsing code for old cluster
> +implementation that does not ship as part of Tomcat 7. (markt)
> +  
> +
> +  
>  
>  
>   
>
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


-- 
Ivan


Re: svn commit: r1144690 - in /tomcat/trunk: java/org/apache/catalina/startup/Catalina.java java/org/apache/catalina/startup/ClusterRuleSetFactory.java webapps/docs/changelog.xml

2011-07-11 Thread Ivan
Yes, merging the two components is one of the solutions. From other side, it
is something like a registry <-> provider scenario, not sure Tomcat will
support the functions like customized configurations in the server.xml in
the future, and this might be a place to begin it.

2011/7/11 Mark Thomas 

> On 11/07/2011 08:23, Ivan wrote:
> > Hi, this changes brought a cycle dependency between the tomcat-catalina
> and
> > tomcat-catalina-ha module, could you please help to fix it.
>
> I'm not sure that is much of a problem. I'm wondering if we should drop
> the separate catalina.ha.jar and just merge it into catalina.jar
>
> Mark
>
> > Thanks.
> >
> > 2011/7/10 
> >
> >> Author: markt
> >> Date: Sat Jul  9 16:05:42 2011
> >> New Revision: 1144690
> >>
> >> URL: http://svn.apache.org/viewvc?rev=1144690&view=rev
> >> Log:
> >> Remove some more unnecessary code
> >>
> >> Removed:
> >>
>  tomcat/trunk/java/org/apache/catalina/startup/ClusterRuleSetFactory.java
> >> Modified:
> >>tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
> >>tomcat/trunk/webapps/docs/changelog.xml
> >>
> >> Modified: tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Catalina.java?rev=1144690&r1=1144689&r2=1144690&view=diff
> >>
> >>
> ==
> >> --- tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
> (original)
> >> +++ tomcat/trunk/java/org/apache/catalina/startup/Catalina.java Sat Jul
>  9
> >> 16:05:42 2011
> >> @@ -36,6 +36,7 @@ import org.apache.catalina.LifecycleExce
> >>  import org.apache.catalina.LifecycleState;
> >>  import org.apache.catalina.Server;
> >>  import org.apache.catalina.core.StandardServer;
> >> +import org.apache.catalina.ha.ClusterRuleSet;
> >>  import org.apache.catalina.security.SecurityConfig;
> >>  import org.apache.juli.ClassLoaderLogManager;
> >>  import org.apache.tomcat.util.ExceptionUtils;
> >> @@ -373,13 +374,13 @@ public class Catalina {
> >> digester.addRuleSet(new EngineRuleSet("Server/Service/"));
> >> digester.addRuleSet(new HostRuleSet("Server/Service/Engine/"));
> >> digester.addRuleSet(new
> >> ContextRuleSet("Server/Service/Engine/Host/"));
> >> -
> >>
>  
> digester.addRuleSet(ClusterRuleSetFactory.getClusterRuleSet("Server/Service/Engine/Host/Cluster/"));
> >> +digester.addRuleSet(new
> >> ClusterRuleSet("Server/Service/Engine/Host/Cluster/"));
> >> digester.addRuleSet(new
> >> NamingRuleSet("Server/Service/Engine/Host/Context/"));
> >>
> >> // When the 'engine' is found, set the parentClassLoader.
> >> digester.addRule("Server/Service/Engine",
> >>  new
> SetParentClassLoaderRule(parentClassLoader));
> >> -
> >>
>  
> digester.addRuleSet(ClusterRuleSetFactory.getClusterRuleSet("Server/Service/Engine/Cluster/"));
> >> +digester.addRuleSet(new
> >> ClusterRuleSet("Server/Service/Engine/Cluster/"));
> >>
> >> long t2=System.currentTimeMillis();
> >> if (log.isDebugEnabled())
> >>
> >> Modified: tomcat/trunk/webapps/docs/changelog.xml
> >> URL:
> >>
> http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1144690&r1=1144689&r2=1144690&view=diff
> >>
> >>
> ==
> >> --- tomcat/trunk/webapps/docs/changelog.xml (original)
> >> +++ tomcat/trunk/webapps/docs/changelog.xml Sat Jul  9 16:05:42 2011
> >> @@ -66,6 +66,14 @@
> >>   
> >> 
> >>   
> >> +  
> >> +
> >> +  
> >> +Remove unnecessary serverl.xml parsing code for old cluster
> >> +implementation that does not ship as part of Tomcat 7. (markt)
> >> +  
> >> +
> >> +  
> >>  
> >>  
> >>   
> >>
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> >> For additional commands, e-mail: dev-h...@tomcat.apache.org
> >>
> >>
> >
> >
>
>
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


-- 
Ivan


getPart()/getParts() invocation in the filter ?

2010-05-12 Thread Ivan
Hi,
While using the new features of getPart()/getParts() in the Servlet 3.0,
I found that those methods could not be invoked in filter.
After checking the spec, I found some words below :
--->
File upload
 If a request is of type multipart/form-data and if the servlet handling
the
 request is annotated using the @MultipartConfig as defined in Section
8.1.5,
 "@MultipartConfig" on page 8-64, the HttpServletRequest can make
available
 the various parts of the multipart request via the following methods
■ public Collection getParts()
■ public Part getPart(String name).
<---
--->
@MultipartConfig
 This annotation, when specified on a Servlet, indicates that the
request it expects
 is of type mime/multipart. The HttpServletRequest object of the
 corresponding servlet MUST make available the mime attachments via the
 getParts and getPart methods to iterate over the various mime
attachments.
<---
 I am just wondering that :
 a. Are those two methods available when the request is of
multipart/form-data type AND the servlet handlering it are configured with
MultipartConfig (annotation or configurations in web.xml) ? Why not make
those methods avaible once it detects the multipart/form-data type ?
 b. Are those two methods only available in Servlet ? Seems that the
spec expects the users handle the uploading in Servlet ?
 Thanks !
-- 
Ivan


Use KeyManagerFactory.getDefaultAlgorithm() as the default value of algorithm

2009-12-15 Thread Ivan
Hi,
While playing with Tomcat 7 with non-Sun JDK, I got an error "SunX509
KeyManagerFactory not available", it seems that in AbstractEndpoint.java, it
uses SunX509 as the default value, how about using
KeyManagerFactory.getDefaultAlgorithm() as the default value to make Tomcat
more portable.

--->
 private String algorithm = KeyManagerFactory.getDefaultAlgorithm();
public String getAlgorithm() { return algorithm;}
public void setAlgorithm(String s ) { this.algorithm = s;}
<---

Thanks !
-- 
Ivan


Re: Use KeyManagerFactory.getDefaultAlgorithm() as the default value of algorithm

2009-12-16 Thread Ivan
Many thanks ^_^

2009/12/16 Mark Thomas 

> On 16/12/2009 05:34, Ivan wrote:
> > Hi,
> > While playing with Tomcat 7 with non-Sun JDK, I got an error "SunX509
> > KeyManagerFactory not available", it seems that in AbstractEndpoint.java,
> it
> > uses SunX509 as the default value, how about using
> > KeyManagerFactory.getDefaultAlgorithm() as the default value to make
> Tomcat
> > more portable.
> >
> > --->
> >  private String algorithm = KeyManagerFactory.getDefaultAlgorithm();
> > public String getAlgorithm() { return algorithm;}
> > public void setAlgorithm(String s ) { this.algorithm = s;}
> > <---
> >
> > Thanks !
>
> I like it. Done (and the documentation updated) for trunk / Tomcat 7.
>
> Mark
>
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


-- 
Ivan


The time to call populateSessionTrackingModes() in ApplicationContext

2009-12-16 Thread Ivan
Hi,
Currently, the populateSessionTrackingModes() method is called in the
constructor of ApplicationContext, but the codes in the
populateSessionTrackingModes() would check the parent of StandardContext.
I wonder whether it would be more reasonable to add an init method for the
ApplicationContext, and call the ApplicationContext.init while starting
StandardContext. For while the ApplicationContext is created via
StandardContext.getServletConext() method, the StandardContext may not be
added to the whole Tomcat tree.
Any comment ? Thanks !
-- 
Ivan


MalformedObjectNameException is thrown in Tomcat 7

2009-12-17 Thread Ivan
Hi,
I got a ClassCastException in Tomcat 7. Please refer to the stack below
:
javax.management.MalformedObjectNameException: Cannot create object name for
org.apache.catalina.connector.connec...@591a591ajava.lang.classcastexception:
java.net.Inet4Address incompatible with java.lang.String
at
org.apache.catalina.mbeans.MBeanUtils.createObjectName(MBeanUtils.java:477)
at
org.apache.catalina.mbeans.MBeanUtils.destroyMBean(MBeanUtils.java:1100)
at
org.apache.catalina.mbeans.ServerLifecycleListener.destroyMBeans(ServerLifecycleListener.java:614)
at
org.apache.catalina.mbeans.ServerLifecycleListener.destroyMBeans(ServerLifecycleListener.java:892)
at
org.apache.catalina.mbeans.ServerLifecycleListener.destroyMBeans(ServerLifecycleListener.java:858)
at
org.apache.catalina.mbeans.ServerLifecycleListener.lifecycleEvent(ServerLifecycleListener.java:167)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)

It seems that in the MBeanUtils.createObjectName always assume the return
type of address is String, while in Http11Protocol, it has a method
getAddress with return type InetAddress, so ..
The easiest way to workround it is use toString(), so that always a String
object could be got.
Thanks !
-- 
Ivan


Re: [VOTE] Release Tomcat 7.0.0 based on Tomcat 7.0.0 RC1

2010-04-14 Thread Ivan
Hi,
   Just wonder does Tomcat 7 RC fully support Servlet 3.0 ?  The last time I
check it, it seems that ServletContainerInitializer has not been implemented
yet.
   Thanks !

2010/4/15 sebb 

> On 14/04/2010, Mark Thomas  wrote:
> > On 14/04/2010 21:06, sebb wrote:
>
> ...
>
> >  > There is a minor problem with the bin/tomcat-juli.jar - the NOTICE
> says:
> >  > Copyright 19...@year@
> >
> > I'll take a look.
> >
>
> Same problem in extras/tomcat-juli-adapters.jar
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


-- 
Ivan


Re: [VOTE] Release Tomcat 7.0.0 based on Tomcat 7.0.0 RC1

2010-04-14 Thread Ivan
Usually, I trust the real codes more :-)
Just grep the Tomcat trunk codes with 'ServletContainerInitializer', I only
found an empty if block in AnnotationProcessor.java file.

2010/4/15 sebb 

> The RELEASE-NOTES file says:
>
> 
> =
> Bundled APIs:
> =
> A standard installation of Tomcat 7.0 makes all of the following APIs
> available
> for use by web applications (by placing them in "lib"):
> 
> * servlet-api.jar (Servlet 3.0 API)
> 
>
> On 15/04/2010, Ivan  wrote:
> > Hi,
> >Just wonder does Tomcat 7 RC fully support Servlet 3.0 ?  The last
> time I
> >  check it, it seems that ServletContainerInitializer has not been
> implemented
> >  yet.
> >Thanks !
> >
> >  2010/4/15 sebb 
> >
> >
> >  > On 14/04/2010, Mark Thomas  wrote:
> >  > > On 14/04/2010 21:06, sebb wrote:
> >  >
> >  > ...
> >  >
> >  > >  > There is a minor problem with the bin/tomcat-juli.jar - the
> NOTICE
> >  > says:
> >  > >  > Copyright 19...@year@
> >  > >
> >  > > I'll take a look.
> >  > >
> >  >
> >  > Same problem in extras/tomcat-juli-adapters.jar
> >  >
> >
> > > -
> >  > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> >  > For additional commands, e-mail: dev-h...@tomcat.apache.org
> >  >
> >  >
> >
> >
> >
> > --
> >
> > Ivan
> >
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


-- 
Ivan


Re: svn commit: r937975 - /tomcat/trunk/java/org/apache/catalina/core/StandardContext.java

2010-04-27 Thread Ivan
I still get the java.lang.ArrayIndexOutOfBoundsException, i think that it
should be

filterMapInsertPoint + 1,

--->
System.arraycopy(filterMaps, filterMapInsertPoint, results,
filterMapInsertPoint + 1,
filterMaps.length - filterMapInsertPoint);
<---

2010/4/26 Giulio Quaresima 

> You need more coffee ;)
> 100 - (10 + 1) is algebraically equivalent to 100 - 10 - 1
>
>
> Tim Funk wrote:
>
>> Got it
>>
>> thanks
>>
>> -Tim
>>
>> On 4/26/2010 6:36 AM, Mark Thomas wrote:
>>
>>> On 26/04/2010 11:33, Tim Funk wrote:
>>>
>>>> I'm feeling stupid at the moment. (Or need more coffee) But why do the
>>>> parenthesis make a difference? (Since only addition/subtraction is done
>>>> and no multiplication - I can't tell why this fixes it)
>>>>
>>>
>>> 100 - 10 + 1 = 91
>>> 100 - (10 + 1) = 89
>>>
>>
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: dev-h...@tomcat.apache.org
>>
>>
>>
>>
> --
> *
> * Dott. Giulio Quaresima (Ph.D) *
> *   *
> * Area Reti e Servizi Web   *
> * Ripartizione Servizi Informatici e Statistici *
> * Università degli Studi di Perugia *
> * P.zza Università 1 - 06081 Perugia (PG)   *
> * Tel. 075 585 5183 - 075 585 5172  *
> * Fax  075 585 5172 *
> * e-mail giulio.quares...@unipg.it  *
> *
>
>
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


-- 
Ivan


Can Tomcat Native be used to write SSL clients?

2009-07-30 Thread Ivan Ristic
Apologies if this is the wrong list to ask, but I couldn't find a
mailing list dedicated to Tomcat Native.

I have a need to write an SSL client, in Java, using OpenSSL (because
OpenSSL supports some features that are not supported by JSSE). I've
noticed that there's a server example in the Tomcat Native
distribution but no mention of clients.

I also need to retain I/O control, exchanging buffers with OpenSSL
without letting it work with my sockets directly.

Is this possible? Any help and pointers would be greatly appreciated.

-- 
Ivan Ristic
Test your SSL server @ SSL Labs
https://www.ssllabs.com/ssldb/

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