Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2003-03-08 Thread Bill Barker

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 07, 2003 10:51 PM
Subject: cvs commit:
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java


 costin  2003/03/07 22:51:34

   Modified:coyote/src/java/org/apache/coyote/tomcat5
 CoyoteConnector.java
   Log:
   A bit more flexibility in starting ( init/start may end up beeing called
twice,
   that shouldn't be treated as a catastrophic event ).

   Improved self-registration. My understanding is that we only need an
Engine,
   so if no Service exists, just go to the engine.

   Revision  ChangesPath
   1.17  +54 -21
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteCo
nnector.java

   Index: CoyoteConnector.java
   ===
   @@ -1062,11 +1062,12 @@
 * Initialize this connector (create ServerSocket here!)
 */
public void initialize()
   -throws LifecycleException {
   -
   -if (initialized)
   -throw new LifecycleException
   -(sm.getString(coyoteConnector.alreadyInitialized));
   +throws LifecycleException
   +{
   +if (initialized) {
   +
log.info(sm.getString(coyoteConnector.alreadyInitialized));
   +return;
   +}

I'm not sure that I'm happy with this.  Throwing an exception seems much
cleaner than logging at a low level and pretending to be happy with
everything.

This isn't a veto, since I haven't looked into the callers enough (yet) to
know what changes.  But it is a very big red-flag.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[PATCH] The Japanese translation patch for servlet examples in Tomcat4

2003-03-08 Thread Kan Ogawa
Hi, Catalina committers.

This patch is the Japanese message resource for servlet examples in Tomcat 4,
and also includes some modification for it.
I wish the patch to be applied.

Regards,

-- 
Kan Ogawa
[EMAIL PROTECTED]# $Id$

# Default localized resources for example servlets
# This locale is ja_JP

helloworld.title=\u3053\u3093\u306b\u3061\u306f\u4e16\u754c\uff01

requestinfo.title=\u30ea\u30af\u30a8\u30b9\u30c8\u60c5\u5831 \u4f8b\u984c
requestinfo.label.method=\u30e1\u30bd\u30c3\u30c9:
requestinfo.label.requesturi=\u30ea\u30af\u30a8\u30b9\u30c8URI:
requestinfo.label.protocol=\u30d7\u30ed\u30c8\u30b3\u30eb:
requestinfo.label.pathinfo=\u30d1\u30b9\u60c5\u5831:
requestinfo.label.remoteaddr=\u30ea\u30e2\u30fc\u30c8\u30a2\u30c9\u30ec\u30b9:

requestheader.title=\u30ea\u30af\u30a8\u30b9\u30c8\u30d8\u30c3\u30c0\u60c5\u5831 
\u4f8b\u984c

requestparams.title=\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf 
\u4f8b\u984c
requestparams.params-in-req=\u3053\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30d1\u30e9\u30e1\u30fc\u30bf:
requestparams.no-params=\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u3042\u308a\u307e\u305b\u3093\u3001\u4f55\u304b\u5165\u308c\u3066\u304f\u3060\u3055\u3044\u3002
requestparams.firstname=\u59d3:
requestparams.lastname=\u540d:

cookies.title=\u30af\u30c3\u30ad\u30fc \u4f8b\u984c
cookies.cookies=\u3042\u306a\u305f\u306e\u30d6\u30e9\u30a6\u30b6\u306f\u3001\u6b21\u306e\u30af\u30c3\u30ad\u30fc\u3092\u9001\u4fe1\u3057\u3066\u3044\u307e\u3059:
cookies.no-cookies=\u3042\u306a\u305f\u306e\u30d6\u30e9\u30a6\u30b6\u306f\u3001\u30af\u30c3\u30ad\u30fc\u3092\u307e\u3063\u305f\u304f\u9001\u4fe1\u3057\u3066\u3044\u307e\u305b\u3093\u3002
cookies.make-cookie=\u3042\u306a\u305f\u306e\u30d6\u30e9\u30a6\u30b6\u306b\u9001\u4fe1\u3059\u308b\u30af\u30c3\u30ad\u30fc\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002
cookies.name=\u540d\u524d:
cookies.value=\u5024:
cookies.set=\u53ea\u4eca\u3001\u6b21\u306e\u30af\u30c3\u30ad\u30fc\u3092\u3042\u306a\u305f\u306e\u30d6\u30e9\u30a6\u30b6\u306b\u9001\u4fe1\u3057\u307e\u3057\u305f:

sessions.title=\u30bb\u30c3\u30b7\u30e7\u30f3 \u4f8b\u984c
sessions.id=\u30bb\u30c3\u30b7\u30e7\u30f3ID:
sessions.created=\u30bb\u30c3\u30b7\u30e7\u30f3\u4f5c\u6210\u6642\u523b:
sessions.lastaccessed=\u6700\u5f8c\u306b\u9001\u4fe1\u3057\u305f\u6642\u523b:
sessions.data=\u3053\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u306b\u306f\u3001\u6b21\u306e\u30c7\u30fc\u30bf\u304c\u3042\u308a\u307e\u3059:
sessions.adddata=\u3053\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u306b\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002
sessions.dataname=\u30bb\u30c3\u30b7\u30e7\u30f3\u5c5e\u6027\u540d:
sessions.datavalue=\u30bb\u30c3\u30b7\u30e7\u30f3\u5c5e\u6027\u5024:
Index: jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/CookieExample.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/CookieExample.java,v
retrieving revision 1.3
diff -u -w -r1.3 CookieExample.java
--- jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/CookieExample.java  23 Apr 
2002 15:17:25 -  1.3
+++ jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/CookieExample.java  8 Mar 
2003 09:14:05 -
@@ -18,13 +18,15 @@
 
 public class CookieExample extends HttpServlet {
 
-ResourceBundle rb = ResourceBundle.getBundle(LocalStrings);
-
 public void doGet(HttpServletRequest request,
   HttpServletResponse response)
 throws IOException, ServletException
 {
+ResourceBundle rb =
+ResourceBundle.getBundle(LocalStrings,request.getLocale());
+
 response.setContentType(text/html);
+response.setLocale(request.getLocale());
 
 PrintWriter out = response.getWriter();
 out.println(html);
Index: jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/HelloWorldExample.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/HelloWorldExample.java,v
retrieving revision 1.2
diff -u -w -r1.2 HelloWorldExample.java
--- jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/HelloWorldExample.java  29 Nov 
2001 18:27:25 -  1.2
+++ jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/HelloWorldExample.java  8 Mar 
2003 09:14:05 -
@@ -23,7 +23,10 @@
 {
 ResourceBundle rb =
 ResourceBundle.getBundle(LocalStrings,request.getLocale());
+
 response.setContentType(text/html);
+response.setLocale(request.getLocale());
+
 PrintWriter out = response.getWriter();
 
 out.println(html);
Index: jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/RequestHeaderExample.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/RequestHeaderExample.java,v

[GUMP] Build Failure - jakarta-tomcat-jk

2003-03-08 Thread Craig McClanahan

This email is autogenerated from the output from:
http://cvs.apache.org/builds/gump/2003-03-08/jakarta-tomcat-jk.html


Buildfile: build.xml

detect:
 [echo]  jakarta-tomcat-connectors 

prepare:
Overriding previous definition of reference to xml-apis.classpath

report:
 [echo] Tomcat33: ${tomcat33.detect} 
/home/rubys/jakarta/jakarta-tomcat/build/tomcat/lib/common/tomcat_core.jar
 [echo] Tomcat40:  true /home/rubys/jakarta/jakarta-tomcat-4.0/build
 [echo] Tomcat41: ${tomcat41.detect} /home/rubys/jakarta/jakarta-tomcat-4.1/build
 [echo] Tomcat5:  ${tomcat5.detect} 
/home/rubys/jakarta/jakarta-tomcat-catalina/build
 [echo] Apache13: ${apache13.detect} ${apache13.home}
 [echo] Apache2: ${apache2.detect} ${apache2.home}
 [echo] iPlanet:  ${iplanet.detect} ${iplanet.home}
 [echo] IIS:  ${iis.detect} ${iis.home}
 [echo] jmx:  /opt/jmx-1_0_1-ri_bin/jmx/lib/jmxri.jar true 
/home/rubys/jakarta/jakarta-commons/modeler/dist/commons-modeler.jar true

jkjava:
[javac] Compiling 19 source files to 
/home/rubys/jakarta/jakarta-tomcat-connectors/jk/build/classes
[javac] 
/home/rubys/jakarta/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/config/ApacheConfig.java:61:
 package org.apache.catalina does not exist
[javac] import org.apache.catalina.*;
[javac] ^
[javac] 
/home/rubys/jakarta/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/config/ApacheConfig.java:64:
 package javax.servlet does not exist
[javac] import javax.servlet.*;
[javac] ^
[javac] 
/home/rubys/jakarta/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/config/BaseJkConfig.java:61:
 package org.apache.catalina does not exist
[javac] import org.apache.catalina.*;
[javac] ^
[javac] 
/home/rubys/jakarta/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/config/BaseJkConfig.java:125:
 cannot resolve symbol
[javac] symbol  : class LifecycleListener 
[javac] location: class org.apache.ajp.tomcat4.config.BaseJkConfig
[javac] public class BaseJkConfig  implements LifecycleListener {
[javac]   ^
[javac] 
/home/rubys/jakarta/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/config/ApacheConfig.java:333:
 cannot resolve symbol
[javac] symbol  : class Host 
[javac] location: class org.apache.ajp.tomcat4.config.ApacheConfig
[javac] protected void generateVhostHead(Host host, PrintWriter mod_jk) {
[javac]  ^
[javac] 
/home/rubys/jakarta/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/config/ApacheConfig.java:355:
 cannot resolve symbol
[javac] symbol  : class Host 
[javac] location: class org.apache.ajp.tomcat4.config.ApacheConfig
[javac] protected void generateVhostTail(Host host, PrintWriter mod_jk) {
[javac]  ^
[javac] 
/home/rubys/jakarta/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/config/ApacheConfig.java:386:
 cannot resolve symbol
[javac] symbol  : class Context 
[javac] location: class org.apache.ajp.tomcat4.config.ApacheConfig
[javac] protected void generateStupidMappings(Context context,
[javac]   ^
[javac] 
/home/rubys/jakarta/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/config/ApacheConfig.java:425:
 cannot resolve symbol
[javac] symbol  : class Context 
[javac] location: class org.apache.ajp.tomcat4.config.ApacheConfig
[javac] protected void generateContextMappings(Context context, PrintWriter 
mod_jk )
[javac]^
[javac] 
/home/rubys/jakarta/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/config/ApacheConfig.java:497:
 cannot resolve symbol
[javac] symbol  : class Context 
[javac] location: class org.apache.ajp.tomcat4.config.ApacheConfig
[javac] private void generateWelcomeFiles(Context context, PrintWriter mod_jk 
) {
[javac]   ^
[javac] 
/home/rubys/jakarta/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/config/ApacheConfig.java:512:
 cannot resolve symbol
[javac] symbol  : class Context 
[javac] location: class org.apache.ajp.tomcat4.config.ApacheConfig
[javac] private void generateStaticMappings(Context context, PrintWriter 
mod_jk ) {
[javac] ^
[javac] 
/home/rubys/jakarta/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/config/ApacheConfig.java:584:
 cannot resolve symbol
[javac] symbol  : class Context 
[javac] location: class org.apache.ajp.tomcat4.config.ApacheConfig
[javac] private String getApacheDocBase(Context context)
[javac] ^
[javac] 

Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5MapperListener.java

2003-03-08 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
costin  2003/03/07 22:52:36

  Modified:coyote/src/java/org/apache/coyote/tomcat5
MapperListener.java
  Log:
  A Server is not required for non-standalone operation. In fact, Embeded doesn't define
   a server, and most apps embeding tomcat use this approach.
  
  All we care is an Engine.
Hmm, yes. Well, actually, no. In that junk code (I should have put a 
fixme), I'm trying to look up the hosts. I was planning to rewrite the 
code using JMX and remove the coupling (the only good solution IMO).

What do you think ?

Remy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler JspRuntimeContext.java

2003-03-08 Thread glenn
glenn   2003/03/08 06:19:48

  Modified:jasper2/src/share/org/apache/jasper/compiler Tag:
tomcat_4_branch JspRuntimeContext.java
  Log:
  Fix bug #17775
  
  Make sure web applications are granted a FilePermission to
  read the web application context directory in addition to
  its contents.
  
  Minor refactoring and cleanup of code for adding FilePermission's.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.4.2.5   +24 -12
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspRuntimeContext.java
  
  Index: JspRuntimeContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspRuntimeContext.java,v
  retrieving revision 1.4.2.4
  retrieving revision 1.4.2.5
  diff -u -r1.4.2.4 -r1.4.2.5
  --- JspRuntimeContext.java28 Dec 2002 01:46:59 -  1.4.2.4
  +++ JspRuntimeContext.java8 Mar 2003 14:19:48 -   1.4.2.5
  @@ -373,25 +373,37 @@
   if( docBase == null ) {
   docBase = options.getScratchDir().toString();
   }
  -if (!docBase.endsWith(File.separator)){
  -docBase = docBase + File.separator;
  +String codeBase = docBase;
  +if (!codeBase.endsWith(File.separator)){
  +codeBase = codeBase + File.separator;
   }
  -File contextDir = new File(docBase);
  +File contextDir = new File(codeBase);
   URL url = contextDir.getCanonicalFile().toURL();
   codeSource = new CodeSource(url,null);
   permissionCollection = policy.getPermissions(codeSource);
   
   // Create a file read permission for web app context directory
  +if (!docBase.endsWith(File.separator)){
  +permissionCollection.add
  +(new FilePermission(docBase,read));
  +docBase = docBase + File.separator;
  +} else {
  +permissionCollection.add
  +(new FilePermission
  +(docBase.substring(0,docBase.length() - 1),read));
  +}
   docBase = docBase + -;
   permissionCollection.add(new FilePermission(docBase,read));
   
  -// Create a file read permission for web app tempdir (work) 
directory
  +// Create a file read permission for web app tempdir (work)
  +// directory
   String workDir = options.getScratchDir().toString();
  -if (workDir.endsWith(File.separator)) {
  -workDir = workDir + -;
  -} else {
  -workDir = workDir + File.separator + -;
  +if (!workDir.endsWith(File.separator)){
  +permissionCollection.add
  +(new FilePermission(workDir,read));
  +workDir = workDir + File.separator;
   }
  +workDir = workDir + -;
   permissionCollection.add(new FilePermission(workDir,read));
   
   // Allow the JSP to access org.apache.jasper.runtime.HttpJspBase
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java WebappLoader.java

2003-03-08 Thread glenn
glenn   2003/03/08 06:20:45

  Modified:.RELEASE-NOTES-4.1.txt
   catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java WebappLoader.java
  Log:
  Fix bug #17775
  
  Make sure web applications are granted a FilePermission to
  read the web application context directory in addition to
  its contents.
  
  Minor refactoring and cleanup of code for adding FilePermission's.
  
  Revision  ChangesPath
  1.62  +10 -1 jakarta-tomcat-4.0/RELEASE-NOTES-4.1.txt
  
  Index: RELEASE-NOTES-4.1.txt
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/RELEASE-NOTES-4.1.txt,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- RELEASE-NOTES-4.1.txt 7 Mar 2003 10:59:35 -   1.61
  +++ RELEASE-NOTES-4.1.txt 8 Mar 2003 14:20:44 -   1.62
  @@ -714,6 +714,11 @@
Session Manager StoreBase
Fix a NPE bug when the background thread expires sessions.
   
  +[4.1.22] #17775
  + WebappClassLoader
  + Grant web applications a FilePermission to read the web application
  + context directory in addition to its contents.
  +
   
   Coyote Bug Fixes:
   
  @@ -1179,6 +1184,10 @@
   [4.1.22] JspC:
Add documentation.
   
  +[4.1.22] #17775
  + JspRuntimeContext
  + Grant web applications JSP pages a FilePermission to read the web 
application
  + context directory in addition to its contents.
   
   
   KNOWN ISSUES IN THIS RELEASE:
  
  
  
  1.48  +22 -7 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- WebappClassLoader.java10 Oct 2002 22:04:24 -  1.47
  +++ WebappClassLoader.java8 Mar 2003 14:20:45 -   1.48
  @@ -475,14 +475,27 @@
* @param path file directory path
*/
   public void addPermission(String path) {
  +if (path == null) {
  +return;
  +}
  +
   if (securityManager != null) {
   Permission permission = null;
   if( path.startsWith(jndi:) || path.startsWith(jar:jndi:) ) {
  +if (!path.endsWith(/)) {
  +path = path + /;
  +}
   permission = new JndiPermission(path + *);
  +addPermission(permission);
   } else {
  -permission = new FilePermission(path + -,read);
  +if (!path.endsWith(File.separator)) {
  +permission = new FilePermission(path, read);
  +addPermission(permission);
  +path = path + File.separator;
  +}
  +permission = new FilePermission(path + -, read);
  +addPermission(permission);
   }
  -addPermission(permission);
   }
   }
   
  @@ -494,7 +507,9 @@
* @param url URL for a file or directory on local system
*/
   public void addPermission(URL url) {
  -addPermission(url.toString());
  +if (url != null) {
  +addPermission(url.toString());
  +}
   }
   
   
  
  
  
  1.31  +15 -28
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappLoader.java
  
  Index: WebappLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- WebappLoader.java 20 Sep 2002 21:20:44 -  1.30
  +++ WebappLoader.java 8 Mar 2003 14:20:45 -   1.31
  @@ -887,37 +887,28 @@
   String contextRoot = servletContext.getRealPath(/);
   if (contextRoot != null) {
   try {
  -contextRoot = 
  -(new File(contextRoot)).getCanonicalPath() 
  -+ File.separator;
  +contextRoot = (new File(contextRoot)).getCanonicalPath();
   classLoader.addPermission(contextRoot);
   } catch (IOException e) {
   // Ignore
   }
   }
   
  -URL classesURL =
  -servletContext.getResource(/WEB-INF/classes/);
  -if (classesURL != null)
  -classLoader.addPermission(classesURL);
  -
  +URL classesURL = servletContext.getResource(/WEB-INF/classes/);
  +  

DO NOT REPLY [Bug 17775] - java.security.AccessControlException: access denied (java.io.FilePermission error

2003-03-08 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17775.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17775

java.security.AccessControlException: access denied (java.io.FilePermission error

[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED



--- Additional Comments From [EMAIL PROTECTED]  2003-03-08 14:24 ---
Thanks for reporting this.  I have committed a patch to CVS which
makes sure a read FilePermission for the web application directory
itself is added in addition to a read FilePermission for its contents.

This fix will be available in the next Tomcat release, 4.1.22.

To get around this for now you can add a second FilePermission.

You need two FilePermission's, one for the webapp/myapp directory,
and one for its contents. Like this:

permission java.io.FilePermission ${catalina.home}/webapps/myapp, read;
permission java.io.FilePermission ${catalina.home}/webapps/myapp/-,
read,write,delete;

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 MapperListener.java

2003-03-08 Thread Costin Manolache
Remy Maucherat wrote:

 [EMAIL PROTECTED] wrote:
 costin  2003/03/07 22:52:36
 
   Modified:coyote/src/java/org/apache/coyote/tomcat5
 MapperListener.java
   Log:
   A Server is not required for non-standalone operation. In fact, Embeded
   doesn't define
a server, and most apps embeding tomcat use this approach.
   
   All we care is an Engine.
 
 Hmm, yes. Well, actually, no. In that junk code (I should have put a
 fixme), I'm trying to look up the hosts. I was planning to rewrite the
 code using JMX and remove the coupling (the only good solution IMO).
 
 What do you think ?

It's even better. 
But you can just look for contexts - using the j2eeType=WebModule to
do the query ( but you'll have to parse the host and path from
the name - the spec doesn't define a host attribute ).

What I think is that we should clean up a bit before 5.0 is final - 
we have Embeded which doesn't extend or use Service or Server, and 
is probably used either directly or as a model by people. 

Engine is the only stable point ( which makes sense ), we should deprecate
and make sure we don't depend too much on Service or Server ( except the 
standalone case ), otherwise some features will not work very well if tomcat
is embeded in some other app.

And we should clean up the naming conventions ASAP. We don't need 5 names
( server name, service name, engine name, jvmroute and JMX domain ) - 
all we need is a Servlet Engine ID - common to all of them. 

Costin 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2003-03-08 Thread Costin Manolache
Bill Barker wrote:

   Index: CoyoteConnector.java
   ===
   @@ -1062,11 +1062,12 @@
 * Initialize this connector (create ServerSocket here!)
 */
public void initialize()
   -throws LifecycleException {
   -
   -if (initialized)
   -throw new LifecycleException
   -(sm.getString(coyoteConnector.alreadyInitialized));
   +throws LifecycleException
   +{
   +if (initialized) {
   +
 log.info(sm.getString(coyoteConnector.alreadyInitialized));
   +return;
   +}
 
 I'm not sure that I'm happy with this.  Throwing an exception seems much
 cleaner than logging at a low level and pretending to be happy with
 everything.
 
 This isn't a veto, since I haven't looked into the callers enough (yet) to
 know what changes.  But it is a very big red-flag.

The problem is that right now init/start are called twice in JMX mode - 
and I couldn't find any simple way to avoid this ( that wouldn't break too
much ).

If you load a connector as a MBean, the JMX container will take care of its
lifecycle - this way the connector could be unloaded/reloaded under JMX
control just like any other jmx component. But tomcat requires the
connector to be registered in Service, and Service will also call
init/stat/stop on it.

I think supporting both operating modes is quite important, so please 
let's not throw exceptions for a while. Having init() called twice
is really not that bad - it may be a sign that the container is confused (
which is very true :-), but the component doesn't have to throw errors.

The best would be to find a better solution to deal with the lifecycle - 
if the JMX container manages a component, Service shouldn't be used.


Costin




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java WebappLoader.java

2003-03-08 Thread glenn
glenn   2003/03/08 09:01:20

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java WebappLoader.java
  Log:
  Port bug #17775 patch from Tomcat 4
  
  Revision  ChangesPath
  1.15  +19 -4 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- WebappClassLoader.java4 Feb 2003 07:24:22 -   1.14
  +++ WebappClassLoader.java8 Mar 2003 17:01:20 -   1.15
  @@ -464,14 +464,27 @@
* @param path file directory path
*/
   public void addPermission(String path) {
  +if (path == null) {
  +return;
  +}
  +
   if (securityManager != null) {
   Permission permission = null;
   if( path.startsWith(jndi:) || path.startsWith(jar:jndi:) ) {
  +if (!path.endsWith(/)) {
  +path = path + /;
  +}
   permission = new JndiPermission(path + *);
  +addPermission(permission);
   } else {
  -permission = new FilePermission(path + -,read);
  +if (!path.endsWith(File.separator)) {
  +permission = new FilePermission(path, read);
  +addPermission(permission);
  +path = path + File.separator;
  +}
  +permission = new FilePermission(path + -, read);
  +addPermission(permission);
   }
  -addPermission(permission);
   }
   }
   
  @@ -483,7 +496,9 @@
* @param url URL for a file or directory on local system
*/
   public void addPermission(URL url) {
  -addPermission(url.toString());
  +if (url != null) {
  +addPermission(url.toString());
  +}
   }
   
   
  
  
  
  1.8   +15 -28
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java
  
  Index: WebappLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- WebappLoader.java 26 Feb 2003 20:20:39 -  1.7
  +++ WebappLoader.java 8 Mar 2003 17:01:20 -   1.8
  @@ -898,37 +898,28 @@
   String contextRoot = servletContext.getRealPath(/);
   if (contextRoot != null) {
   try {
  -contextRoot = 
  -(new File(contextRoot)).getCanonicalPath() 
  -+ File.separator;
  +contextRoot = (new File(contextRoot)).getCanonicalPath();
   classLoader.addPermission(contextRoot);
   } catch (IOException e) {
   // Ignore
   }
   }
   
  -URL classesURL =
  -servletContext.getResource(/WEB-INF/classes/);
  -if (classesURL != null)
  -classLoader.addPermission(classesURL);
  -
  +URL classesURL = servletContext.getResource(/WEB-INF/classes/);
  +classLoader.addPermission(classesURL);
   URL libURL = servletContext.getResource(/WEB-INF/lib/);
  -if (libURL != null) {
  -classLoader.addPermission(libURL);
  -}
  +classLoader.addPermission(libURL);
   
   if (contextRoot != null) {
   
   if (libURL != null) {
   File rootDir = new File(contextRoot);
   File libDir = new File(rootDir, WEB-INF/lib/);
  -String path = null;
   try {
  -path = libDir.getCanonicalPath() + File.separator;
  +String path = libDir.getCanonicalPath();
  +classLoader.addPermission(path);
   } catch (IOException e) {
   }
  -if (path != null)
  -classLoader.addPermission(path);
   }
   
   } else {
  @@ -936,23 +927,19 @@
   if (workDir != null) {
   if (libURL != null) {
   File libDir = new File(workDir, WEB-INF/lib/);
  -String path = null;
   try {
  -path = libDir.getCanonicalPath() + File.separator;
  +String path = 

cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler JspRuntimeContext.java

2003-03-08 Thread glenn
glenn   2003/03/08 09:01:54

  Modified:jasper2/src/share/org/apache/jasper/compiler
JspRuntimeContext.java
  Log:
  Port bug #17775 patch from Tomcat 4
  
  Revision  ChangesPath
  1.12  +26 -13
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspRuntimeContext.java
  
  Index: JspRuntimeContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspRuntimeContext.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- JspRuntimeContext.java21 Feb 2003 18:23:14 -  1.11
  +++ JspRuntimeContext.java8 Mar 2003 17:01:54 -   1.12
  @@ -398,30 +398,43 @@
   if( docBase == null ) {
   docBase = options.getScratchDir().toString();
   }
  -if (!docBase.endsWith(File.separator)){
  -docBase = docBase + File.separator;
  +String codeBase = docBase;
  +if (!codeBase.endsWith(File.separator)){
  +codeBase = codeBase + File.separator;
   }
  -File contextDir = new File(docBase);
  +File contextDir = new File(codeBase);
   URL url = contextDir.getCanonicalFile().toURL();
   codeSource = new CodeSource(url,null);
   permissionCollection = policy.getPermissions(codeSource);
   
  +// Create a file read permission for web app context directory
  +if (!docBase.endsWith(File.separator)){
  +permissionCollection.add
  +(new FilePermission(docBase,read));
  +docBase = docBase + File.separator;
  +} else {
  +permissionCollection.add
  +(new FilePermission
  +(docBase.substring(0,docBase.length() - 1),read));
  +}
   docBase = docBase + -;
   permissionCollection.add(new FilePermission(docBase,read));
   
  -// Create a file read permission for web app tempdir (work) 
directory
  +// Create a file read permission for web app tempdir (work)
  +// directory
   String workDir = options.getScratchDir().toString();
  -if (workDir.endsWith(File.separator)) {
  -workDir = workDir + -;
  -} else {
  -workDir = workDir + File.separator + -;
  +if (!workDir.endsWith(File.separator)){
  +permissionCollection.add
  +(new FilePermission(workDir,read));
  +workDir = workDir + File.separator;
   }
  +workDir = workDir + -;
   permissionCollection.add(new FilePermission(workDir,read));
   
   // Allow the JSP to access org.apache.jasper.runtime.HttpJspBase
   permissionCollection.add( new RuntimePermission(
   accessClassInPackage.org.apache.jasper.runtime) );
  -
  +
   if (parentClassLoader instanceof URLClassLoader) {
   URL [] urls = parentClassLoader.getURLs();
   String jarUrl = null;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5MapperListener.java

2003-03-08 Thread Remy Maucherat
Costin Manolache wrote:
Remy Maucherat wrote:


[EMAIL PROTECTED] wrote:

costin  2003/03/07 22:52:36

 Modified:coyote/src/java/org/apache/coyote/tomcat5
   MapperListener.java
 Log:
 A Server is not required for non-standalone operation. In fact, Embeded
 doesn't define
  a server, and most apps embeding tomcat use this approach.
 
 All we care is an Engine.
Hmm, yes. Well, actually, no. In that junk code (I should have put a
fixme), I'm trying to look up the hosts. I was planning to rewrite the
code using JMX and remove the coupling (the only good solution IMO).
What do you think ?


It's even better. 
But you can just look for contexts - using the j2eeType=WebModule to
do the query ( but you'll have to parse the host and path from
the name - the spec doesn't define a host attribute ).

What I think is that we should clean up a bit before 5.0 is final - 
we have Embeded which doesn't extend or use Service or Server, and 
is probably used either directly or as a model by people. 

Engine is the only stable point ( which makes sense ), we should deprecate
and make sure we don't depend too much on Service or Server ( except the 
standalone case ), otherwise some features will not work very well if tomcat
is embeded in some other app.

And we should clean up the naming conventions ASAP. We don't need 5 names
( server name, service name, engine name, jvmroute and JMX domain ) - 
all we need is a Servlet Engine ID - common to all of them. 
That sounds reasonable. 4 unique IDs seems overkill.

Remy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/memory MemoryProtocolHandler.java

2003-03-08 Thread remm
remm2003/03/08 09:35:55

  Modified:coyote/src/java/org/apache/coyote/memory
MemoryProtocolHandler.java
  Log:
  - Add static hook to retrieve the protocol handler which can be used
to generate requests. It's too complex to retrieve the protocol handler
otherwise.
  
  Revision  ChangesPath
  1.2   +12 -0 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/memory/MemoryProtocolHandler.java
  
  Index: MemoryProtocolHandler.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/memory/MemoryProtocolHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MemoryProtocolHandler.java14 Jan 2003 23:08:09 -  1.1
  +++ MemoryProtocolHandler.java8 Mar 2003 17:35:55 -   1.2
  @@ -112,6 +112,16 @@
   }
   
   
  +/**
  + * Hook to easily retrieve the protocol handler.
  + */
  +protected static MemoryProtocolHandler protocolHandler = null;
  +
  +public static MemoryProtocolHandler getProtocolHandler() {
  +return protocolHandler;
  +}
  +
  +
   //  ProtocolHandler Methods
   
   
  @@ -120,6 +130,7 @@
*/
   public void init()
   throws Exception {
  +protocolHandler = this;
   }
   
   
  @@ -133,6 +144,7 @@
   
   public void destroy()
   throws Exception {
  +protocolHandler = null;
   }
   
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]