Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-05-09 Thread jean-frederic clere
Remy Maucherat wrote:
jean-frederic clere wrote:
I will try to solve the problem with a filter.

You can simply call response.getWriter() in your filter if you determine 
the file needs to use fileEncoding.
I have used a filter with two wrappers one for GET the other for PUT, Now Tomcat 
runs correcly on the BS2000 Mainframe.

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


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


cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-05-05 Thread jfclere
jfclere 2005/05/05 00:00:10

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  Undo my previous commit - Still looking for a better solution -
  
  Revision  ChangesPath
  1.38  +1 -11 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- DefaultServlet.java   4 May 2005 07:04:30 -   1.37
  +++ DefaultServlet.java   5 May 2005 07:00:09 -   1.38
  @@ -1725,16 +1725,6 @@
   if (cacheEntry.resource != null) {
   byte buffer[] = cacheEntry.resource.getContent();
   if (buffer != null) {
  -if (fileEncoding != null 
  -cacheEntry.attributes.getMimeType()!=null 
  -cacheEntry.attributes.getMimeType().equals(text/html)) 
{
  -/* the binary have to be converted from fileEncoding 
to UTF-8 */
  -try {
  -String str = new String(buffer, fileEncoding);
  -buffer = str.getBytes(UTF-8);
  -} catch (Exception e) {
  -}
  -}
   ostream.write(buffer, 0, buffer.length);
   return;
   }
  
  
  

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



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-05-05 Thread jean-frederic clere
Remy Maucherat wrote:
[EMAIL PROTECTED] wrote:
jfclere 2005/05/04 00:04:30
  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  When the file comes from a resource fileEncoding was not working.
  The default beahviour is unchanged: the file is send without a 
conversion.

   if (cacheEntry.resource != null) {
   byte buffer[] = cacheEntry.resource.getContent();
   if (buffer != null) {
  +if (fileEncoding != null 
  +cacheEntry.attributes.getMimeType()!=null 
  +
cacheEntry.attributes.getMimeType().equals(text/html)) {
  +/* the binary have to be converted from 
fileEncoding to UTF-8 */
  +try {
  +String str = new String(buffer, fileEncoding);
  +buffer = str.getBytes(UTF-8);
  +} catch (Exception e) {
  +}
  +}
   ostream.write(buffer, 0, buffer.length);
   return;

So, can you revert the patch ? I think that's what we more or less 
agreed on, right ?
Done.
Forcing the use of a writer using a getWriter call would likely be more 
efficient (much less GC hungry at least).

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


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


cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-05-04 Thread jfclere
jfclere 2005/05/04 00:04:30

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  When the file comes from a resource fileEncoding was not working.
  The default beahviour is unchanged: the file is send without a conversion.
  
  Revision  ChangesPath
  1.37  +11 -1 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- DefaultServlet.java   2 May 2005 16:52:10 -   1.36
  +++ DefaultServlet.java   4 May 2005 07:04:30 -   1.37
  @@ -1725,6 +1725,16 @@
   if (cacheEntry.resource != null) {
   byte buffer[] = cacheEntry.resource.getContent();
   if (buffer != null) {
  +if (fileEncoding != null 
  +cacheEntry.attributes.getMimeType()!=null 
  +cacheEntry.attributes.getMimeType().equals(text/html)) 
{
  +/* the binary have to be converted from fileEncoding 
to UTF-8 */
  +try {
  +String str = new String(buffer, fileEncoding);
  +buffer = str.getBytes(UTF-8);
  +} catch (Exception e) {
  +}
  +}
   ostream.write(buffer, 0, buffer.length);
   return;
   }
  
  
  

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



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-05-04 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
jfclere 2005/05/04 00:04:30
  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  When the file comes from a resource fileEncoding was not working.
  The default beahviour is unchanged: the file is send without a conversion.
This kind of operation is extremely costly (will likely make 
fileEncoding a problematic option, as imagine doing it on a 1MB text 
file), and seems wrong: the purpose of the byte based sending is to send 
the resource unchanged.

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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-05-04 Thread jean-frederic clere
Remy Maucherat wrote:
[EMAIL PROTECTED] wrote:
jfclere 2005/05/04 00:04:30
  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  When the file comes from a resource fileEncoding was not working.
  The default beahviour is unchanged: the file is send without a 
conversion.

This kind of operation is extremely costly (will likely make 
fileEncoding a problematic option, as imagine doing it on a 1MB text 
file), and seems wrong: the purpose of the byte based sending is to send 
the resource unchanged.
Yes, but if the text files are encoded in EBCDIC for example we will send EBCDIC 
 to the browsers.

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


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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-05-04 Thread Remy Maucherat
jean-frederic clere wrote:
Yes, but if the text files are encoded in EBCDIC for example we will 
send EBCDIC  to the browsers.
Your change makes using the fileEncoding option extremely harmful. For 
straight file serving, we need to send the unchanged resource's bytes, 
so you need to properly encode them on your HD. This is not going to change.

The purpose of fileEncoding is to be used when including static files 
using a request dispatcher, that's it.

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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-05-04 Thread jean-frederic clere
Remy Maucherat wrote:
jean-frederic clere wrote:
Yes, but if the text files are encoded in EBCDIC for example we will 
send EBCDIC  to the browsers.

Your change makes using the fileEncoding option extremely harmful. For 
straight file serving, we need to send the unchanged resource's bytes, 
so you need to properly encode them on your HD. This is not going to 
change.
but http://jakarta.apache.org/tomcat/tomcat-5.5-doc/default-servlet.html tells 
about fileEncoding:
+++
 File encoding to be used when reading static resources. [platform default]
+++
My platform default is OSD_EBCDIC_DF04_1 I have no chances to convince the 
users to use UTF-8 for text files! and httpd (apache-1.3) it is serving those 
files correctly.

What about converting the files when reading them?
The purpose of fileEncoding is to be used when including static files 
using a request dispatcher, that's it.

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


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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-05-04 Thread Remy Maucherat
jean-frederic clere wrote:
Remy Maucherat wrote:
but http://jakarta.apache.org/tomcat/tomcat-5.5-doc/default-servlet.html 
tells about fileEncoding:
+++
 File encoding to be used when reading static resources. [platform default]
+++
My platform default is OSD_EBCDIC_DF04_1 I have no chances to convince 
the users to use UTF-8 for text files! and httpd (apache-1.3) it is 
serving those files correctly.
Do you mean it has the same kind of ugly check for text files, and the 
same kind of file encoding option, and the same reencoding ?

What about converting the files when reading them?
No. I contend resources must be served as is in the default operation 
mode of DefaultServlet. If you disagree with that, you can use a filter, 
right ?

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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-05-04 Thread jean-frederic clere
Remy Maucherat wrote:
jean-frederic clere wrote:
Remy Maucherat wrote:
but 
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/default-servlet.html 
tells about fileEncoding:
+++
 File encoding to be used when reading static resources. [platform 
default]
+++
My platform default is OSD_EBCDIC_DF04_1 I have no chances to 
convince the users to use UTF-8 for text files! and httpd (apache-1.3) 
it is serving those files correctly.

Do you mean it has the same kind of ugly check for text files, and the 
same kind of file encoding option, and the same reencoding ?
I won't tell it ugly, but yes the text file are in EBCDIC in the machine and 
converted to ASCII before beeing send to the browsers.


What about converting the files when reading them?

No. I contend resources must be served as is in the default operation 
mode of DefaultServlet. If you disagree with that, you can use a filter, 
right ?
I will try to solve the problem with a filter.
Rémy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-05-04 Thread Remy Maucherat
jean-frederic clere wrote:
I will try to solve the problem with a filter.
You can simply call response.getWriter() in your filter if you determine 
the file needs to use fileEncoding.

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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-05-04 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
jfclere 2005/05/04 00:04:30
  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  When the file comes from a resource fileEncoding was not working.
  The default beahviour is unchanged: the file is send without a conversion.

   if (cacheEntry.resource != null) {
   byte buffer[] = cacheEntry.resource.getContent();
   if (buffer != null) {
  +if (fileEncoding != null 
  +cacheEntry.attributes.getMimeType()!=null 
  +cacheEntry.attributes.getMimeType().equals(text/html)) 
{
  +/* the binary have to be converted from fileEncoding 
to UTF-8 */
  +try {
  +String str = new String(buffer, fileEncoding);
  +buffer = str.getBytes(UTF-8);
  +} catch (Exception e) {
  +}
  +}
   ostream.write(buffer, 0, buffer.length);
   return;
So, can you revert the patch ? I think that's what we more or less 
agreed on, right ?

Forcing the use of a writer using a getWriter call would likely be more 
efficient (much less GC hungry at least).

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


cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-05-02 Thread luehe
luehe   2005/05/02 09:52:10

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  - Avoid cache lookup if
  
  trimmed.equalsIgnoreCase(WEB-INF) ||
  trimmed.equalsIgnoreCase(META-INF) ||
  trimmed.equalsIgnoreCase(localXsltFile)
  
  - Avoid NPE (by adding check for childCacheEntry.exists)
in the case where ProxyDirContext.lookupCache()
swallows NamingException, in which case the attributes field of
the returned childCacheEntry will be null, causing
  
  childCacheEntry.attributes.getContentLength()
  
in DefaultServlet.renderXml() to throw NPE.
  
  Revision  ChangesPath
  1.36  +7 -5  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- DefaultServlet.java   29 Apr 2005 20:04:03 -  1.35
  +++ DefaultServlet.java   2 May 2005 16:52:10 -   1.36
  @@ -1164,7 +1164,6 @@
   
   CacheEntry childCacheEntry =
   resources.lookupCache(cacheEntry.name + resourceName);
  -
   if (!childCacheEntry.exists) {
   continue;
   }
  @@ -1330,14 +1329,17 @@
   
   NameClassPair ncPair = (NameClassPair) 
enumeration.nextElement();
   String resourceName = ncPair.getName();
  -CacheEntry childCacheEntry =
  -resources.lookupCache(cacheEntry.name + resourceName);
  -
   String trimmed = resourceName/*.substring(trim)*/;
   if (trimmed.equalsIgnoreCase(WEB-INF) ||
   trimmed.equalsIgnoreCase(META-INF))
   continue;
   
  +CacheEntry childCacheEntry =
  +resources.lookupCache(cacheEntry.name + resourceName);
  +if (!childCacheEntry.exists) {
  +continue;
  +}
  +
   sb.append(tr);
   if (shade)
   sb.append( bgcolor=\#ee\);
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-04-28 Thread remm
remm2005/04/28 05:30:39

  Modified:http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
   catalina/src/share/org/apache/catalina/connector
Request.java
   catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  - Rename attributes as suggested by Bill.
  
  Revision  ChangesPath
  1.10  +6 -4  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Http11AprProcessor.java   23 Apr 2005 17:33:40 -  1.9
  +++ Http11AprProcessor.java   28 Apr 2005 12:30:38 -  1.10
  @@ -1324,7 +1324,7 @@
   
   // Advertise sendfile support through a request attribute
   if (endpoint.getUseSendfile()) {
  -request.setAttribute(sendfile.support, Boolean.TRUE);
  +request.setAttribute(org.apache.tomcat.sendfile.support, 
Boolean.TRUE);
   }
   
   }
  @@ -1504,7 +1504,7 @@
   }
   
   // Sendfile support
  -String fileName = (String) request.getAttribute(sendfile.filename);
  +String fileName = (String) 
request.getAttribute(org.apache.tomcat.sendfile.filename);
   if (fileName != null) {
   // No entity body sent here
   outputBuffer.addActiveFilter
  @@ -1512,8 +1512,10 @@
   contentDelimitation = true;
   sendfileData = new AprEndpoint.SendfileData();
   sendfileData.fileName = fileName;
  -sendfileData.start = ((Long) 
request.getAttribute(sendfile.start)).longValue();
  -sendfileData.end = ((Long) 
request.getAttribute(sendfile.end)).longValue();
  +sendfileData.start = 
  +((Long) 
request.getAttribute(org.apache.tomcat.sendfile.start)).longValue();
  +sendfileData.end = 
  +((Long) 
request.getAttribute(org.apache.tomcat.sendfile.end)).longValue();
   }
   
   // Check for compression
  
  
  
  1.23  +2 -2  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Request.java
  
  Index: Request.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Request.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Request.java  20 Apr 2005 16:13:23 -  1.22
  +++ Request.java  28 Apr 2005 12:30:38 -  1.23
  @@ -1367,7 +1367,7 @@
   }
   
   // Pass special attributes to the native layer
  -if (name.startsWith(sendfile.)) {
  +if (name.startsWith(org.apache.tomcat.)) {
   coyoteRequest.setAttribute(name, value);
   }
   
  
  
  
  1.34  +24 -10
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- DefaultServlet.java   27 Apr 2005 23:07:31 -  1.33
  +++ DefaultServlet.java   28 Apr 2005 12:30:38 -  1.34
  @@ -145,6 +145,13 @@
*/
   protected String fileEncoding = null;
   
  +
  +/**
  + * Minimum size for sendfile usage in bytes.
  + */
  +protected int sendfileSize = 48 * 1024;
  +
  +
   // - Static 
Initializer
   
   
  @@ -235,6 +242,12 @@
   ;
   }
   try {
  +value = getServletConfig().getInitParameter(sendfileSize);
  +sendfileSize = Integer.parseInt(value) * 1024;
  +} catch (Throwable t) {
  +;
  +}
  +try {
   value = getServletConfig().getInitParameter(fileEncoding);
   fileEncoding = value;
   } catch (Throwable t) {
  @@ -1488,21 +1501,22 @@
 HttpServletResponse response,
 CacheEntry entry,
 long length, Range range) {
  -if ((entry.resource != null) 
  - ((length  80 * 1024) || (entry.resource.getContent() == 
null))
  +if ((sendfileSize  0)
  + (entry.resource != null)
  + ((length  sendfileSize) || (entry.resource.getContent() == 
null))
  

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-04-27 Thread remm
remm2005/04/27 16:07:31

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  - Better default sendfile size.
  
  Revision  ChangesPath
  1.33  +2 -2  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- DefaultServlet.java   20 Apr 2005 16:13:23 -  1.32
  +++ DefaultServlet.java   27 Apr 2005 23:07:31 -  1.33
  @@ -1489,7 +1489,7 @@
 CacheEntry entry,
 long length, Range range) {
   if ((entry.resource != null) 
  - ((length  256 * 1024) || (entry.resource.getContent() == 
null))
  + ((length  80 * 1024) || (entry.resource.getContent() == 
null))
(entry.attributes.getCanonicalPath() != null)
(Boolean.TRUE == request.getAttribute(sendfile.support))

(request.getClass().getName().equals(org.apache.catalina.connector.RequestFacade))
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-04-20 Thread remm
remm2005/04/20 09:13:23

  Modified:catalina/src/share/org/apache/naming/resources
ResourceAttributes.java FileDirContext.java
   http11/src/java/org/apache/coyote/http11
InternalAprOutputBuffer.java
Http11AprProcessor.java
   util/java/org/apache/tomcat/util/net AprEndpoint.java
   catalina/src/share/org/apache/catalina/connector
Request.java
   catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  - Fix setting timeouts on sockets.
  - Add plumbing code for sendfile (disabled by default), which doesn't work 
yet.
  - Apparently, the Sendfile.run algo is bad. APR is black magic to me, so I'll 
let Mladen fix it :)
  
  Revision  ChangesPath
  1.6   +13 -1 
jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/ResourceAttributes.java
  
  Index: ResourceAttributes.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/ResourceAttributes.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ResourceAttributes.java   29 Aug 2004 16:46:15 -  1.5
  +++ ResourceAttributes.java   20 Apr 2005 16:13:23 -  1.6
  @@ -753,6 +753,18 @@
   }
   
   
  +/**
  + * Return the canonical path of the resource, to possibly be used for 
  + * direct file serving. Implementations which support this should 
override
  + * it to return the file path.
  + * 
  + * @return The canonical path of the resource
  + */
  +public String getCanonicalPath() {
  +return null;
  +}
  +
  +
   // - Attributes 
Methods
   
   
  
  
  
  1.8   +21 -1 
jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/FileDirContext.java
  
  Index: FileDirContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/FileDirContext.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FileDirContext.java   28 Jul 2004 20:27:01 -  1.7
  +++ FileDirContext.java   20 Apr 2005 16:13:23 -  1.8
  @@ -997,6 +997,9 @@
   protected boolean accessed = false;
   
   
  +protected String canonicalPath = null;
  +
  +
   // - ResourceAttributes 
Methods
   
   
  @@ -1102,6 +1105,23 @@
   return super.getResourceType();
   }
   
  +
  +/**
  + * Get canonical path.
  + * 
  + * @return String the file's canonical path
  + */
  +public String getCanonicalPath() {
  +if (canonicalPath == null) {
  +try {
  +canonicalPath = file.getCanonicalPath();
  +} catch (IOException e) {
  +// Ignore
  +}
  +}
  +return canonicalPath;
  +}
  +
   
   }
   
  
  
  
  1.2   +0 -1  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
  
  Index: InternalAprOutputBuffer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InternalAprOutputBuffer.java  14 Apr 2005 18:52:28 -  1.1
  +++ InternalAprOutputBuffer.java  20 Apr 2005 16:13:23 -  1.2
  @@ -20,7 +20,6 @@
   import java.security.AccessController;
   import java.security.PrivilegedAction;
   
  -import org.apache.tomcat.jni.Error;
   import org.apache.tomcat.jni.Socket;
   import org.apache.tomcat.util.buf.ByteChunk;
   import org.apache.tomcat.util.buf.CharChunk;
  
  
  
  1.8   +34 -2 
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Http11AprProcessor.java   18 Apr 2005 16:47:47 -  1.7
  +++ Http11AprProcessor.java   20 Apr 2005 16:13:23 -  1.8
  @@ -158,6 +158,12 @@
   
   
   /**
  + * Sendfile data.
  + */
  +protected AprEndpoint.SendfileData sendfileData = null;
  +
  +
  +/**
* Content delimitator for the request (if false, the connection will
* be closed at 

Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-04-20 Thread Bill Barker

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 20, 2005 9:13 AM
Subject: cvs commit:
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java


 remm2005/04/20 09:13:23

   Modified:catalina/src/share/org/apache/naming/resources
 ResourceAttributes.java FileDirContext.java
http11/src/java/org/apache/coyote/http11
 InternalAprOutputBuffer.java
 Http11AprProcessor.java
util/java/org/apache/tomcat/util/net AprEndpoint.java
catalina/src/share/org/apache/catalina/connector
 Request.java
catalina/src/share/org/apache/catalina/servlets
 DefaultServlet.java
   Log:
   - Fix setting timeouts on sockets.
   - Add plumbing code for sendfile (disabled by default), which doesn't
work yet.
   - Apparently, the Sendfile.run algo is bad. APR is black magic to me, so
I'll let Mladen fix it :)

snip/

   +// Pass special attributes to the native layer
   +if (name.startsWith(sendfile.)) {
   +coyoteRequest.setAttribute(name, value);
   +}
   +

This should be 'org.apache.catalina.sendfile' (or, if you prefer,
'org.apache.tomcat.sendfile').  Otherwise, you'll get BZ reports like:
whine
In my application Filter I do
  request.setAttribute(sendfile.filename, new MySendFileName());
and my application breaks on 5.5.10.  It worked fine on 5.5.9.
/whine




This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication 
in error, please notify us immediately by e-mail and then delete all copies of 
this message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through 
the Internet is not secure. Do not send confidential or sensitive information, 
such as social security numbers, account numbers, personal identification 
numbers and passwords, to us via ordinary (unencrypted) e-mail.


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

Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-04-20 Thread Remy Maucherat
Bill Barker wrote:
This should be 'org.apache.catalina.sendfile' (or, if you prefer,
'org.apache.tomcat.sendfile').  Otherwise, you'll get BZ reports like:
whine
In my application Filter I do
  request.setAttribute(sendfile.filename, new MySendFileName());
and my application breaks on 5.5.10.  It worked fine on 5.5.9.
/whine
Well, I'll add a ckeck for the token to avoid this. It's completely 
broken anyway right now (Mladen says it can be fixed), so there's a 
chance that this feature will be scrapped.

Passing attributes to the lower layer is harmless (and I don't quite 
like huge names, but I can change them if you want to).

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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-04-20 Thread Bill Barker

- Original Message -
From: Remy Maucherat [EMAIL PROTECTED]
To: Tomcat Developers List tomcat-dev@jakarta.apache.org
Sent: Wednesday, April 20, 2005 11:06 AM
Subject: Re: cvs commit:
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java


Bill Barker wrote:
 This should be 'org.apache.catalina.sendfile' (or, if you prefer,
 'org.apache.tomcat.sendfile').  Otherwise, you'll get BZ reports like:
 whine
 In my application Filter I do
   request.setAttribute(sendfile.filename, new MySendFileName());
 and my application breaks on 5.5.10.  It worked fine on 5.5.9.
 /whine

Well, I'll add a ckeck for the token to avoid this. It's completely
broken anyway right now (Mladen says it can be fixed), so there's a
chance that this feature will be scrapped.


I remember reading a while back on [EMAIL PROTECTED] that there were some 
problems
with sendfile on Windows.  I don't remember the details, and I don't follow
[EMAIL PROTECTED] to know if they have been fixed.

Passing attributes to the lower layer is harmless (and I don't quite
like huge names, but I can change them if you want to).


I don't care if you pass all attributes to the Coyote Request.  It might
even be A Good Thing.  It's just that if we follow the spec recommendation
in section 4.2, we can say that the 'org.apache.catalina' attribute name
space is reserved for Tomcat internal attributes.  Reserving the 'sendfile'
namespace for Tomcat internals is rather arbitrary, and more likely to break
webapps.

Rémy

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





This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication 
in error, please notify us immediately by e-mail and then delete all copies of 
this message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through 
the Internet is not secure. Do not send confidential or sensitive information, 
such as social security numbers, account numbers, personal identification 
numbers and passwords, to us via ordinary (unencrypted) e-mail.


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

Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2005-04-20 Thread Remy Maucherat
Bill Barker wrote:
I remember reading a while back on [EMAIL PROTECTED] that there were some 
problems
with sendfile on Windows.  I don't remember the details, and I don't follow
[EMAIL PROTECTED] to know if they have been fixed.
sendfile itself seems to work fine so far (I feed it with the canonical 
path of the file), but however the %ç$!!*ç% poller doesn't do what it 
should be doing (hence my comment about a black magic API). I seems 
blocking sendfiles would be working ok, but there are little benefits.

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


cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java LocalStrings.properties

2004-10-29 Thread luehe
luehe   2004/10/29 15:29:30

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java LocalStrings.properties
  Log:
  Include warning message when an included resource is not available,
  instead of ignoring silently
  
  Revision  ChangesPath
  1.30  +10 -1 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- DefaultServlet.java   14 Oct 2004 23:58:38 -  1.29
  +++ DefaultServlet.java   29 Oct 2004 22:29:29 -  1.30
  @@ -657,7 +657,16 @@
   Globals.INCLUDE_REQUEST_URI_ATTR);
   if (requestUri == null) {
   requestUri = request.getRequestURI();
  +} else {
  +// We're included, and the response.sendError() below is going
  +// to be ignored by the resource that is including us.
  +// Therefore, the only way we can let the including resource
  +// know is by including warning message in response
  +response.getWriter().write(
  +sm.getString(defaultServlet.missingResource,
  +requestUri));
   }
  +
   response.sendError(HttpServletResponse.SC_NOT_FOUND,
  requestUri);
   return;
  
  
  
  1.5   +1 -0  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/LocalStrings.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LocalStrings.properties   26 Mar 2003 09:53:10 -  1.4
  +++ LocalStrings.properties   29 Oct 2004 22:29:29 -  1.5
  @@ -1,3 +1,4 @@
  +defaultServlet.missingResource=The requested resource ({0}) is not available
   defaultservlet.directorylistingfor=Directory Listing for:
   defaultservlet.upto=Up to:
   defaultservlet.subdirectories=Subdirectories:
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2004-10-14 Thread luehe
luehe   2004/10/14 16:58:38

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  Expose any errors on an included resource.
  
  For example, a JSP with this include action:
jsp:include page=nonexistent
  or
jsp:include page=nonexistent.jsp
  where nonexistent[.jsp] does not exist, currently returns silently, hiding the
  fact that the resource to be included does not exist.
  
  This patch returns a 404 with the name of the nonexistent resource.
  
  Yes, SRV.8.3 (The Include Method) mentions that
  
it [the target servlet] cannot set headers or call any method that
affects the headers of the response. Any attempt to do so must be
ignored.
  
  but i don't think it is referring to the error case.
  
  Let me know if you see any problems.
  
  Revision  ChangesPath
  1.29  +22 -8 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- DefaultServlet.java   19 Sep 2004 01:20:10 -  1.28
  +++ DefaultServlet.java   14 Oct 2004 23:58:38 -  1.29
  @@ -281,12 +281,12 @@
   protected String getRelativePath(HttpServletRequest request) {
   
   // Are we being processed by a RequestDispatcher.include()?
  -if (request.getAttribute(javax.servlet.include.request_uri)!=null) {
  -String result = (String)
  -request.getAttribute(javax.servlet.include.path_info);
  +if (request.getAttribute(Globals.INCLUDE_REQUEST_URI_ATTR) != null) {
  +String result = (String) request.getAttribute(
  +Globals.INCLUDE_PATH_INFO_ATTR);
   if (result == null)
  -result = (String)
  -request.getAttribute(javax.servlet.include.servlet_path);
  +result = (String) request.getAttribute(
  +Globals.INCLUDE_SERVLET_PATH_ATTR);
   if ((result == null) || (result.equals()))
   result = /;
   return (result);
  @@ -651,8 +651,15 @@
   CacheEntry cacheEntry = resources.lookupCache(path);
   
   if (!cacheEntry.exists) {
  +// Check if we're included so we can return the appropriate 
  +// missing resource name in the error
  +String requestUri = (String) request.getAttribute(
  +Globals.INCLUDE_REQUEST_URI_ATTR);
  +if (requestUri == null) {
  +requestUri = request.getRequestURI();
  +}
   response.sendError(HttpServletResponse.SC_NOT_FOUND,
  -   request.getRequestURI());
  +   requestUri);
   return;
   }
   
  @@ -660,8 +667,15 @@
   // ends with / or \, return NOT FOUND
   if (cacheEntry.context == null) {
   if (path.endsWith(/) || (path.endsWith(\\))) {
  +// Check if we're included so we can return the appropriate 
  +// missing resource name in the error
  +String requestUri = (String) request.getAttribute(
  +Globals.INCLUDE_REQUEST_URI_ATTR);
  +if (requestUri == null) {
  +requestUri = request.getRequestURI();
  +}
   response.sendError(HttpServletResponse.SC_NOT_FOUND,
  -   request.getRequestURI());
  +   requestUri);
   return;
   }
   }
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java WebdavServlet.java

2004-09-18 Thread funkman
funkman 2004/09/18 18:20:10

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java WebdavServlet.java
  Log:
  md5Helper, md5Encoder, and normalize are used by WebdavServlet,
  not DefaultServelt so move them into WebdavServlet.
  
  Remove unused method appendParameters
  
  Revision  ChangesPath
  1.28  +16 -120   
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- DefaultServlet.java   29 Aug 2004 16:46:12 -  1.27
  +++ DefaultServlet.java   19 Sep 2004 01:20:10 -  1.28
  @@ -1,12 +1,12 @@
   /*
* Copyright 1999,2004 The Apache Software Foundation.
  - * 
  + *
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
  - * 
  + *
*  http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -32,8 +32,6 @@
   import java.io.Reader;
   import java.io.StringReader;
   import java.io.StringWriter;
  -import java.security.MessageDigest;
  -import java.security.NoSuchAlgorithmException;
   import java.util.Enumeration;
   import java.util.StringTokenizer;
   import java.util.Vector;
  @@ -56,7 +54,6 @@
   import javax.xml.transform.stream.StreamSource;
   
   import org.apache.catalina.Globals;
  -import org.apache.catalina.util.MD5Encoder;
   import org.apache.catalina.util.ServerInfo;
   import org.apache.catalina.util.StringManager;
   import org.apache.catalina.util.URLEncoder;
  @@ -113,18 +110,6 @@
   
   
   /**
  - * MD5 message digest provider.
  - */
  -protected static MessageDigest md5Helper;
  -
  -
  -/**
  - * The MD5 helper object for this class.
  - */
  -protected static final MD5Encoder md5Encoder = new MD5Encoder();
  -
  -
  -/**
* Array containing the safe characters set.
*/
   protected static URLEncoder urlEncoder;
  @@ -259,13 +244,6 @@
   , output buffer size= + output);
   }
   
  -// Load the MD5 helper used to calculate signatures.
  -try {
  -md5Helper = MessageDigest.getInstance(MD5);
  -} catch (NoSuchAlgorithmException e) {
  -throw new UnavailableException(No MD5);
  -}
  -
   // Load the proxy dir context.
   try {
   resources = (ProxyDirContext) getServletContext()
  @@ -288,7 +266,7 @@
   if (resources == null) {
   throw new UnavailableException(No resources);
   }
  -
  +
   }
   
   
  @@ -345,7 +323,7 @@
   serveResource(request, response, true);
   } catch( IOException ex ) {
   // we probably have this check somewhere else too.
  -if( ex.getMessage() != null 
  +if( ex.getMessage() != null
ex.getMessage().indexOf(Broken pipe) = 0 ) {
   // ignore it.
   }
  @@ -619,71 +597,6 @@
   
   
   /**
  - * Return a context-relative path, beginning with a /, that represents
  - * the canonical version of the specified path after .. and . elements
  - * are resolved out.  If the specified path attempts to go outside the
  - * boundaries of the current context (i.e. too many .. path elements
  - * are present), return codenull/code instead.
  - *
  - * @param path Path to be normalized
  - */
  -protected String normalize(String path) {
  -
  -if (path == null)
  -return null;
  -
  -// Create a place for the normalized path
  -String normalized = path;
  -
  -if (normalized == null)
  -return (null);
  -
  -if (normalized.equals(/.))
  -return /;
  -
  -// Normalize the slashes and add leading slash if necessary
  -if (normalized.indexOf('\\') = 0)
  -normalized = normalized.replace('\\', '/');
  -if (!normalized.startsWith(/))
  -normalized = / + normalized;
  -
  -// Resolve occurrences of // in the normalized path
  -while (true) {
  -int index = normalized.indexOf(//);
  -if (index  0)
  -break;
  -normalized = normalized.substring(0, index) +
  -normalized.substring(index + 1);
  -}
  -
  -// Resolve occurrences of /./ in the 

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2004-07-13 Thread remm
remm2004/07/13 08:04:37

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  - Prevent a silent ISE when serving a file with a 0 content-length.
  
  Revision  ChangesPath
  1.25  +10 -2 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- DefaultServlet.java   13 Jul 2004 09:43:19 -  1.24
  +++ DefaultServlet.java   13 Jul 2004 15:04:37 -  1.25
  @@ -775,6 +775,7 @@
   }
   
   Vector ranges = null;
  +long contentLength = -1L;
   
   if (cacheEntry.context != null) {
   
  @@ -800,6 +801,14 @@
   response.setHeader(Last-Modified, 
   cacheEntry.attributes.getLastModifiedHttp());
   
  +// Get content length
  +contentLength = cacheEntry.attributes.getContentLength();
  +// Special case for zero length files, which would cause a 
  +// (silent) ISE when setting the output buffer size
  +if (contentLength == 0L) {
  +content = false;
  +}
  +
   }
   
   ServletOutputStream ostream = null;
  @@ -835,7 +844,6 @@
   contentType + ');
   response.setContentType(contentType);
   }
  -long contentLength = cacheEntry.attributes.getContentLength();
   if ((cacheEntry.resource != null)  (contentLength = 0)) {
   if (debug  0)
   log(DefaultServlet.serveFile:  contentLength= +
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2004-05-26 Thread yoavs
yoavs   2004/05/26 09:03:06

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  Minor JavaDoc fixes (Bugzilla 28335)
  
  Revision  ChangesPath
  1.23  +6 -8  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- DefaultServlet.java   17 May 2004 21:39:33 -  1.22
  +++ DefaultServlet.java   26 May 2004 16:03:06 -  1.23
  @@ -496,8 +496,8 @@
   /**
* Process a POST request for the specified resource.
*
  - * @param request The servlet request we are processing
  - * @param response The servlet response we are creating
  + * @param req The servlet request we are processing
  + * @param resp The servlet response we are creating
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet-specified error occurs
  @@ -725,8 +725,6 @@
* Get the ETag associated with a file.
*
* @param resourceInfo File object
  - * @param strong True if we want a strong ETag, in which case a checksum
  - * of the file has to be calculated
*/
   protected String getETag(ResourceInfo resourceInfo) {
   if (resourceInfo.strongETag != null) {
  @@ -1845,7 +1843,7 @@
* output stream, and ensure that both streams are closed before returning
* (even in the face of an exception).
*
  - * @param istream The input stream to read from
  + * @param resourceInfo The resource information 
* @param ostream The output stream to write to
*
* @exception IOException if an input/output error occurs
  @@ -1891,7 +1889,7 @@
* output stream, and ensure that both streams are closed before returning
* (even in the face of an exception).
*
  - * @param istream The input stream to read from
  + * @param resourceInfo The resource info
* @param writer The writer to write to
*
* @exception IOException if an input/output error occurs
  @@ -2307,7 +2305,7 @@
   /**
* Constructor.
*
  - * @param pathname Path name of the file
  + * @param path Path name of the file
*/
   public ResourceInfo(String path, DirContext resources) {
   set(path, resources);
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2004-02-27 Thread remm
remm2004/02/27 07:06:54

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  - Bug 27293: Fix if-unmodified-since check, using the old-and-simple trick of
adding 1000.
  
  Revision  ChangesPath
  1.20  +2 -2  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DefaultServlet.java   27 Feb 2004 14:58:46 -  1.19
  +++ DefaultServlet.java   27 Feb 2004 15:06:54 -  1.20
  @@ -1825,7 +1825,7 @@
   long lastModified = resourceInfo.date;
   long headerValue = request.getDateHeader(If-Unmodified-Since);
   if (headerValue != -1) {
  -if ( lastModified  headerValue ) {
  +if ( lastModified  (headerValue + 1000)) {
   // The entity has not been modified since the date
   // specified by the client. This is not an error case.
   response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED);
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2003-08-18 Thread jfarcand
jfarcand2003/08/18 12:41:56

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  Fix NPE when getMessage returns null.
  
  Revision  ChangesPath
  1.17  +6 -5  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- DefaultServlet.java   29 Jul 2003 14:23:35 -  1.16
  +++ DefaultServlet.java   18 Aug 2003 19:41:56 -  1.17
  @@ -513,7 +513,8 @@
   serveResource(request, response, true);
   } catch( IOException ex ) {
   // we probably have this check somewhere else too.
  -if( ex.getMessage().indexOf(Broken pipe) = 0 ) {
  +if( ex.getMessage() != null 
  + ex.getMessage().indexOf(Broken pipe) = 0 ) {
   // ignore it.
   }
   throw ex;
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2003-07-29 Thread remm
remm2003/07/29 07:23:35

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  - Normalizing the path here seems useless (note: this cannot cause any
security issues). If the path needs to be normalized during request dispatching,
then it should be done in the request dispatcher itself, not here (please send a 
test case
where it breaks if there's a problem - or better, add one in the tester - so that 
I can fix it).
  
  Revision  ChangesPath
  1.16  +5 -5  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DefaultServlet.java   29 Jul 2003 12:19:06 -  1.15
  +++ DefaultServlet.java   29 Jul 2003 14:23:35 -  1.16
  @@ -487,7 +487,7 @@
   if ((result == null) || (result.equals())) {
   result = /;
   }
  -return normalize(result);
  +return (result);
   
   }
   
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2003-07-25 Thread funkman
funkman 2003/07/25 12:26:31

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  remove welcome file processing since it is done by the mapper
  
  Revision  ChangesPath
  1.14  +9 -89 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DefaultServlet.java   19 Jun 2003 12:23:47 -  1.13
  +++ DefaultServlet.java   25 Jul 2003 19:26:31 -  1.14
  @@ -161,7 +161,7 @@
   
   
   /**
  - * Should we generate directory listings when no welcome file is present?
  + * Should we generate directory listings?
*/
   protected boolean listings = true;
   
  @@ -179,12 +179,6 @@
   
   
   /**
  - * The set of welcome files for this web application
  - */
  -protected String welcomes[] = new String[0];
  -
  -
  -/**
* MD5 message digest provider.
*/
   protected static MessageDigest md5Helper;
  @@ -322,18 +316,9 @@
   if (output  256)
   output = 256;
   
  -// Initialize the set of welcome files for this application
  -welcomes = (String[]) getServletContext().getAttribute
  -(Globals.WELCOME_FILES_ATTR);
  -if (welcomes == null)
  -welcomes = new String[0];
  -
   if (debug  0) {
   log(DefaultServlet.init:  input buffer size= + input +
   , output buffer size= + output);
  -for (int i = 0; i  welcomes.length; i++)
  -log(DefaultServlet.init:  welcome file= +
  -welcomes[i]);
   }
   
   // Load the MD5 helper used to calculate signatures.
  @@ -956,36 +941,9 @@
   }
   }
   
  -// If the resource is a collection (aka a directory), we check
  -// the welcome files list.
  -if (resourceInfo.collection) {
  -
  -if (!request.getRequestURI().endsWith(/)) {
  -String redirectPath = path;
  -String contextPath = request.getContextPath();
  -if ((contextPath != null)  (!contextPath.equals(/))) {
  -redirectPath = contextPath + redirectPath;
  -}
  -if (!(redirectPath.endsWith(/)))
  -redirectPath = redirectPath + /;
  -redirectPath = appendParameters(request, redirectPath);
  -response.sendRedirect(redirectPath);
  -return;
  -}
  -
  -ResourceInfo welcomeFileInfo = checkWelcomeFiles(path, resources);
  -if (welcomeFileInfo != null) {
  -String redirectPath = welcomeFileInfo.path;
  -String contextPath = request.getContextPath();
  -if ((contextPath != null)  (!contextPath.equals(/))) {
  -redirectPath = contextPath + redirectPath;
  -}
  -redirectPath = appendParameters(request, redirectPath);
  -response.sendRedirect(redirectPath);
  -return;
  -}
  -
  -} else {
  +// Check if the conditions specified in the optional If headers are
  +// satisfied.
  +if (!resourceInfo.collection) {
   
   // Checking If headers
   boolean included =
  @@ -2292,7 +2250,7 @@
 long start, long end) {
   
   if (debug  10)
  -System.out.println(Serving bytes: + start + - + end);
  +log(Serving bytes: + start + - + end);
   
   try {
   istream.skip(start);
  @@ -2375,44 +2333,6 @@
   
   }
   
  -
  -/**
  - * Check to see if a default page exists.
  - *
  - * @param pathname Pathname of the file to be served
  - */
  -private ResourceInfo checkWelcomeFiles(String pathname,
  -   DirContext resources) {
  -
  -String collectionName = pathname;
  -if (!pathname.endsWith(/)) {
  -collectionName += /;
  -}
  -
  -// Refresh our currently defined set of welcome files
  -synchronized (welcomes) {
  -welcomes = (String[]) getServletContext().getAttribute
  -(Globals.WELCOME_FILES_ATTR);
  -if (welcomes == null)
  -welcomes = new String[0];
  -}
  -
  -// Serve a welcome resource or file if one exists
  -for (int i = 0; i  welcomes.length; i++) {
  -
  -// Does the specified resource exist?
  -String resourceName = 

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2003-06-19 Thread funkman
funkman 2003/06/19 05:23:47

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  Cleanup for xslt and readme functionality
  - make readme retrieval its own method
  - getting xsltInputStream its own method
  - use Resource for above functionality instead of ResourceInfo
  
  Revision  ChangesPath
  1.13  +96 -67
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DefaultServlet.java   17 Jun 2003 01:31:12 -  1.12
  +++ DefaultServlet.java   19 Jun 2003 12:23:47 -  1.13
  @@ -1384,37 +1384,13 @@
*/
   protected InputStream render
   (String contextPath, ResourceInfo resourceInfo) {
  -InputStream xsltInputStream = null;
  -try {
  -if (localXsltFile!=null) {
  -DirContext resources = getResources();
  -String xsltFile = resourceInfo.path + localXsltFile;
  -ResourceInfo xsltInfo = new ResourceInfo(xsltFile, resources);
  -
  -if (xsltInfo.exists)
  -xsltInputStream = xsltInfo.getStream();
  -}
  -
  -if (xsltInputStream==null  globalXsltFile!=null)
  -xsltInputStream = new FileInputStream(globalXsltFile);
  -
  -} catch(Throwable e) {
  -xsltInputStream = null;
  -}
  -
  +InputStream xsltInputStream =
  +findXsltInputStream(resourceInfo.directory);
   
   if (xsltInputStream==null) {
   return renderHtml(contextPath, resourceInfo);
   } else {
  -try {
  -return renderXml(contextPath, resourceInfo, xsltInputStream);
  -} finally {
  -try {
  -xsltInputStream.close();
  -} catch(Throwable e){
  -;
  -}
  -}
  +return renderXml(contextPath, resourceInfo, xsltInputStream);
   }
   
   }
  @@ -1501,24 +1477,12 @@
   
   sb.append(/entries);
   
  -if (readmeFile!=null) {
  -DirContext resources = getResources();
  -String readme = resourceInfo.path + readmeFile;
  -ResourceInfo readmeInfo = new ResourceInfo(readme,
  -   resources);
  -if (readmeInfo.exists()) {
  -try {
  -StringWriter buffer = new StringWriter();
  -copyRange(new InputStreamReader(readmeInfo.getStream()),
  -  new PrintWriter(buffer));
  +String readme = getReadme(resourceInfo.directory);
   
  -sb.append(readme![CDATA[);
  -sb.append(buffer.toString());
  -sb.append(]]/readme);
  -} catch(IOException e) {
  -; /* Change me if this should be verbose */
  -}
  -}
  +if (readme!=null) {
  +sb.append(readme![CDATA[);
  +sb.append(readme);
  +sb.append(]]/readme);
   }
   
   
  @@ -1538,7 +1502,7 @@
   osWriter.flush();
   return (new ByteArrayInputStream(stream.toByteArray()));
   } catch (Exception e) {
  -e.printStackTrace();
  +log(directory transform failure:  + e.getMessage());
   return renderHtml(contextPath, resourceInfo);
   }
   }
  @@ -1698,24 +1662,11 @@
   
   sb.append(HR size=\1\ noshade);
   
  -if (readmeFile!=null) {
  -DirContext resources = getResources();
  -String readme = resourceInfo.path + readmeFile;
  -ResourceInfo readmeInfo = new ResourceInfo(readme,
  -   resources);
  -if (readmeInfo.exists()) {
  -try {
  -StringWriter buffer = new StringWriter();
  -copyRange(new InputStreamReader(readmeInfo.getStream()),
  -  new PrintWriter(buffer));
  -
  -sb.append(buffer.toString());
  -sb.append(HR size=\1\ noshade);
  -} catch(IOException e) {
  -; /* Change me if this should be verbose */
  -}
  -}
  - }
  +String readme = getReadme(resourceInfo.directory);
  +if (readme!=null) {
  +sb.append(readme);
  +sb.append(HR size=\1\ noshade);
  +}
   
   

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2003-06-17 Thread funkman
funkman 2003/06/16 18:31:12

  Modified:catalina/src/conf web.xml
   catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  - Allow a site (webapp) wide xslt transformation for look (real file name)
  - Allow per directory xslt transformation for customized look
  - Allow a readme file to be rendered with the directory listing
  - fix typo in row color when trying to gray bar lines
  
  Any suggestions on not making globalXsltFile a real file but still
  cross webapp app friendly?
  
  Revision  ChangesPath
  1.19  +17 -0 jakarta-tomcat-catalina/catalina/src/conf/web.xml
  
  Index: web.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/conf/web.xml,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- web.xml   15 Jun 2003 13:12:44 -  1.18
  +++ web.xml   17 Jun 2003 01:31:11 -  1.19
  @@ -39,6 +39,23 @@
 !--   readonlyIs this context read only, so HTTP   --
 !--   commands like PUT and DELETE are   --
 !--   rejected?  [true]  --
  +  !--  --
  +  !--   readmeFile  File name to display with the directory--
  +  !--   contents. [null]   --
  +  !--  --
  +  !--  For directory listing customization. Checks localXsltFile, then --
  +  !--  globalXsltFile, then defaults to original behavior. --
  +  !--  --
  +  !--   localXsltFile   Make directory listings an XML doc and --
  +  !--   pass the result to this style sheet residing   --
  +  !--   in that directory. This overrides  --
  +  !--globalXsltFile[null]  --
  +  !--  --
  +  !--   globalXsltFile  Site wide configuration version of --
  +  !--   localXsltFile This argument is expected--
  +  !--   to be a physical file. [null]  --
  +  !--  --
  +  !--  --
   
   servlet
   servlet-namedefault/servlet-name
  
  
  
  1.12  +248 -31   
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DefaultServlet.java   15 Jun 2003 08:17:37 -  1.11
  +++ DefaultServlet.java   17 Jun 2003 01:31:12 -  1.12
  @@ -1,4 +1,5 @@
   /*
  + * 
* $Header$
* $Revision$
* $Date$
  @@ -76,6 +77,8 @@
   import java.io.RandomAccessFile;
   import java.io.Reader;
   import java.io.InputStreamReader;
  +import java.io.StringReader;
  +import java.io.StringWriter;
   import java.io.Writer;
   import java.io.OutputStreamWriter;
   import java.net.MalformedURLException;
  @@ -110,6 +113,12 @@
   import javax.naming.directory.Attribute;
   import javax.naming.directory.Attributes;
   
  +import javax.xml.transform.Source;
  +import javax.xml.transform.stream.StreamSource;
  +import javax.xml.transform.TransformerFactory;
  +import javax.xml.transform.stream.StreamResult;
  +import javax.xml.transform.Transformer;
  +
   import org.apache.tomcat.util.http.FastHttpDateFormat;
   
   import org.apache.naming.resources.Resource;
  @@ -193,6 +202,25 @@
   protected static URLEncoder urlEncoder;
   
   
  +/**
  + * Allow customized directory listing per directory.
  + */
  +protected String  localXsltFile = null;
  +
  +
  +/**
  + * Allow customized directory listing per instance.
  + */
  +protected String  globalXsltFile = null;
  +
  +
  +/**
  + * Allow a readme file to be included.
  + */
  +protected String readmeFile = null;
  +
  +
  +
   // - Static Initializer
   
   
  @@ -283,6 +311,11 @@
   ;
   }
   
  +globalXsltFile = getServletConfig().getInitParameter(globalXsltFile);
  +localXsltFile = getServletConfig().getInitParameter(localXsltFile);
  +readmeFile = 

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2003-06-15 Thread remm
remm2003/06/15 01:17:37

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  - Using a thread local doesn't seem worthwhile, as corectness requires the
resource info be recycled at the end of processing (otherwise, the context
cannot be garbage collected when undeploying).
  
  Revision  ChangesPath
  1.11  +6 -27 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DefaultServlet.java   1 May 2003 11:29:16 -   1.10
  +++ DefaultServlet.java   15 Jun 2003 08:17:37 -  1.11
  @@ -193,12 +193,6 @@
   protected static URLEncoder urlEncoder;
   
   
  -/**
  - * Thread local resource info.
  - */
  -protected ThreadLocal localResourceInfo = new ThreadLocal();
  -
  -
   // - Static Initializer
   
   
  @@ -247,9 +241,6 @@
* Finalize this servlet.
*/
   public void destroy() {
  -
  -;   // No actions necessary
  -
   }
   
   
  @@ -590,13 +581,7 @@
   // Input stream for temp. content file used to support partial PUT
   FileInputStream contentFileInStream = null;
   
  -ResourceInfo resourceInfo = (ResourceInfo) localResourceInfo.get();
  -if (resourceInfo == null) {
  -resourceInfo = new ResourceInfo(path, resources);
  -localResourceInfo.set(resourceInfo);
  -} else {
  -resourceInfo.set(path, resources);
  -}
  +ResourceInfo resourceInfo = new ResourceInfo(path, resources);
   Range range = parseContentRange(req, resp);
   
   InputStream resourceInputStream = null;
  @@ -920,13 +905,7 @@
   
   // Retrieve the Catalina context and Resources implementation
   DirContext resources = getResources();
  -ResourceInfo resourceInfo = (ResourceInfo) localResourceInfo.get();
  -if (resourceInfo == null) {
  -resourceInfo = new ResourceInfo(path, resources);
  -localResourceInfo.set(resourceInfo);
  -} else {
  -resourceInfo.set(path, resources);
  -}
  +ResourceInfo resourceInfo = new ResourceInfo(path, resources);
   
   if (!resourceInfo.exists) {
   response.sendError(HttpServletResponse.SC_NOT_FOUND, 
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2003-01-08 Thread remm
remm2003/01/08 11:36:11

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  - Invalid date headers should be ignored.
  - Bug 15890.
  
  Revision  ChangesPath
  1.5   +6 -6  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultServlet.java   3 Jan 2003 19:32:52 -   1.4
  +++ DefaultServlet.java   8 Jan 2003 19:36:10 -   1.5
  @@ -1609,7 +1609,7 @@
   }
   }
   } catch(IllegalArgumentException illegalArgument) {
  -return false;
  +return true;
   }
   return true;
   
  @@ -1700,7 +1700,7 @@
   }
   }
   } catch(IllegalArgumentException illegalArgument) {
  -return false;
  +return true;
   }
   return true;
   
  
  
  

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




cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java WebdavServlet.java

2003-01-03 Thread remm
remm2003/01/03 11:32:53

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java WebdavServlet.java
  Log:
  - Use the new FastHttpDateFormat.
  - Remove the remaining formatters.
  
  Revision  ChangesPath
  1.4   +22 -35
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultServlet.java   17 Dec 2002 20:06:49 -  1.3
  +++ DefaultServlet.java   3 Jan 2003 19:32:52 -   1.4
  @@ -92,6 +92,7 @@
   import java.text.SimpleDateFormat;
   import java.security.MessageDigest;
   import java.security.NoSuchAlgorithmException;
  +
   import javax.servlet.RequestDispatcher;
   import javax.servlet.ServletException;
   import javax.servlet.ServletContext;
  @@ -99,6 +100,7 @@
   import javax.servlet.http.HttpServlet;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
  +
   import javax.naming.NamingException;
   import javax.naming.InitialContext;
   import javax.naming.Context;
  @@ -107,10 +109,13 @@
   import javax.naming.directory.DirContext;
   import javax.naming.directory.Attribute;
   import javax.naming.directory.Attributes;
  +
  +import org.apache.tomcat.util.http.FastHttpDateFormat;
  +
   import org.apache.naming.resources.Resource;
   import org.apache.naming.resources.ResourceAttributes;
  +
   import org.apache.catalina.Globals;
  -import org.apache.catalina.util.FastHttpDateFormat;
   import org.apache.catalina.util.MD5Encoder;
   import org.apache.catalina.util.RequestUtil;
   import org.apache.catalina.util.ServerInfo;
  @@ -183,18 +188,6 @@
   
   
   /**
  - * The set of SimpleDateFormat formats to use in getDateHeader().
  - */
  -protected static final SimpleDateFormat formats[] = {
  -new SimpleDateFormat(EEE, dd MMM  HH:mm:ss zzz, Locale.US),
  -new SimpleDateFormat(EE, dd-MMM-yy HH:mm:ss zzz, Locale.US),
  -new SimpleDateFormat(EEE  d HH:mm:ss , Locale.US)
  -};
  -
  -
  -protected final static TimeZone gmtZone = TimeZone.getTimeZone(GMT);
  -
  -/**
* Array containing the safe characters set.
*/
   protected static URLEncoder urlEncoder;
  @@ -205,10 +198,6 @@
*/
   // - Static Initializer
   static {
  -formats[0].setTimeZone(gmtZone);
  -formats[1].setTimeZone(gmtZone);
  -formats[2].setTimeZone(gmtZone);
  -
   urlEncoder = new URLEncoder();
   urlEncoder.addSafeCharacter('-');
   urlEncoder.addSafeCharacter('_');
  @@ -1216,23 +1205,20 @@
   
   // Checking If-Range
   String headerValue = request.getHeader(If-Range);
  +
   if (headerValue != null) {
   
  +long headerValueTime = (-1L);
  +try {
  +headerValueTime = request.getDateHeader(If-Range);
  +} catch (Exception e) {
  +;
  +}
  +
   String eTag = getETag(resourceInfo);
   long lastModified = resourceInfo.date;
   
  -Date date = null;
  -
  -// Parsing the HTTP Date
  -for (int i = 0; (date == null)  (i  formats.length); i++) {
  -try {
  -date = formats[i].parse(headerValue);
  -} catch (ParseException e) {
  -;
  -}
  -}
  -
  -if (date == null) {
  +if (headerValueTime == (-1L)) {
   
   // If the ETag the client gave does not match the entity
   // etag, then the entire entity is returned.
  @@ -1244,7 +1230,7 @@
   // If the timestamp of the entity the client got is older than
   // the last modification date of the entity, the entire entity
   // is returned.
  -if (lastModified  (date.getTime() + 1000))
  +if (lastModified  (headerValueTime + 1000))
   return null;
   
   }
  @@ -2289,8 +2275,9 @@
   creationDate = tempDate.getTime();
   tempDate = tempAttrs.getLastModifiedDate();
   if (tempDate != null) {
  -httpDate = FastHttpDateFormat.getDate(tempDate);
   date = tempDate.getTime();
  +httpDate = 
  +FastHttpDateFormat.formatDate(date, null);
   } else {
   httpDate = 

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java InvokerServlet.java

2002-12-17 Thread jfarcand
jfarcand2002/12/17 12:06:51

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java InvokerServlet.java
  Log:
  Servlet 2.4 Specification addition
  --
  SRV.8.4.2 Forwarded Request Parameters
  
Except for servlets obtained by using the getNamedDispatcher method, a
servlet being used from a servlet that has been invoked by another
servlet using the forward method of RequestDispatcher.
  
The following request attributes must be set:
- javax.servlet.forward.request_uri
- javax.servlet.forward.context_path
- javax.servlet.forward.servlet_path
- javax.servlet.forward.path_info
- javax.servlet.forward.query_string
  
  Revision  ChangesPath
  1.3   +5 -5  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultServlet.java   18 Sep 2002 13:17:31 -  1.2
  +++ DefaultServlet.java   17 Dec 2002 20:06:49 -  1.3
  @@ -969,7 +969,7 @@
   
   // Checking If headers
   boolean included =
  -(request.getAttribute(Globals.CONTEXT_PATH_ATTR) != null);
  +(request.getAttribute(Globals.INCLUDE_CONTEXT_PATH_ATTR) != null);
   if (!included 
!checkIfHeaders(request, response, resourceInfo)) {
   return;
  
  
  
  1.4   +8 -8  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/InvokerServlet.java
  
  Index: InvokerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/InvokerServlet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- InvokerServlet.java   7 Oct 2002 20:35:19 -   1.3
  +++ InvokerServlet.java   17 Dec 2002 20:06:50 -  1.4
  @@ -272,15 +272,15 @@
   String inServletPath = null;
   String inPathInfo = null;
   boolean included =
  -(request.getAttribute(Globals.REQUEST_URI_ATTR) != null);
  +(request.getAttribute(Globals.INCLUDE_REQUEST_URI_ATTR) != null);
   
   if (included) {
   inRequestURI =
  -(String) request.getAttribute(Globals.REQUEST_URI_ATTR);
  +(String) request.getAttribute(Globals.INCLUDE_REQUEST_URI_ATTR);
   inServletPath =
  -(String) request.getAttribute(Globals.SERVLET_PATH_ATTR);
  +(String) request.getAttribute(Globals.INCLUDE_SERVLET_PATH_ATTR);
   inPathInfo =
  -(String) request.getAttribute(Globals.PATH_INFO_ATTR);
  +(String) request.getAttribute(Globals.INCLUDE_PATH_INFO_ATTR);
   } else {
   inRequestURI = request.getRequestURI();
   inServletPath = request.getServletPath();
  
  
  

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




cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java

2002-09-18 Thread remm

remm2002/09/18 06:17:31

  Modified:catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
  Log:
  - Port patch.
  
  Revision  ChangesPath
  1.2   +6 -6  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultServlet.java   18 Jul 2002 16:47:40 -  1.1
  +++ DefaultServlet.java   18 Sep 2002 13:17:31 -  1.2
  @@ -1023,8 +1023,8 @@
   } catch (IllegalStateException e) {
   // If it fails, we try to get a Writer instead if we're
   // trying to serve a text file
  -if ( (contentType != null)
  -  (contentType.startsWith(text)) ) {
  +if ( (contentType == null)
  + || (contentType.startsWith(text)) ) {
   writer = response.getWriter();
   } else {
   throw e;
  
  
  

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