Re: serializing XML to a ServletOutputStream fails

2001-02-05 Thread Dimitris Dinodimos

Use the PrintWriter object returned by
response.getWriter().
You will find more info at
http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletResponse.html

--- Michael Mealling <[EMAIL PROTECTED]> wrote:
> (This might be a bug so I'm cc-ing to tomcat-dev)
> Hi,
> I'm trying to serialize some XML out to a
> ServletOutputStream but
> the resulting XML on the client side contains
> corrupted Unicode
> characters (the DOM I'm serializing out contains
> Chinese, Korean,
> English, etc). Here's the code in question:
> 
> response.setContentType("text/xml;
> charset=UTF-8");
> ServletOutputStream out =
> response.getOutputStream();
> 
 
> This code looks like its the right way to do this
> but either
> I've hit a bug or else I'm missing something (an
> encoding somewhere
> between a Stream and a Writer?)
> 
 


__
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

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




[PATCH] for Bug Report 741 (security constraint match)

2001-02-01 Thread Dimitris Dinodimos



The new behavior is as following:
When defining a security constraint for "/foo/*", 
matches resource "/foo" and "/foo/whatever" but not "/foo.jsp"
 
Cheers,
Dimitris Dinodimos

Index: AccessInterceptor.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/request/Attic/AccessInterceptor.java,v
retrieving revision 1.12.2.4
diff -u -r1.12.2.4 AccessInterceptor.java
--- AccessInterceptor.java  2000/08/24 21:50:51 1.12.2.4
+++ AccessInterceptor.java  2001/01/29 20:10:37
@@ -321,7 +321,9 @@

switch( ct.getMapType() ) {
case Container.PREFIX_MAP:
-   return path.startsWith( ctPath.substring(0, ctPathL - 2  ));
+   if (path.equals( ctPath.substring(0, ctPathL - 2  )))
+   return true;
+   return path.startsWith( ctPath.substring(0, ctPathL - 1  ));
case Container.EXTENSION_MAP:
return ctPath.substring( 1 ).equals( URLUtil.getExtension( path ));
case Container.PATH_MAP:



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


[PATCH] for Bug Report 788 (exception when trying to view a directory)

2001-02-01 Thread Dimitris Dinodimos



Hello All,
This bug can be reproduced when the browser's accepted 
language is not represented in the ISO-8859-1 character set.
The fix sets the requested locale at the server's response, 
and uses a Writer in order to convert to the proper character set.
 
Cheers,
Dimitris Dinodimos

Index: StaticInterceptor.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/request/Attic/StaticInterceptor.java,v
retrieving revision 1.7.2.6
diff -u -r1.7.2.6 StaticInterceptor.java
--- StaticInterceptor.java  2000/12/12 20:33:46 1.7.2.6
+++ StaticInterceptor.java  2001/01/29 20:11:10
@@ -485,6 +485,7 @@

if (! inInclude) {
res.setContentType("text/html");
+   res.setLocale(locale);
buf.append("\r\n");
buf.append("\r\n");
buf.append("")
@@ -634,7 +635,7 @@

if (! inInclude)  buf.append("\r\n");
 
-   if( res.isUsingWriter() ) {
+   if( !res.isUsingStream() ) {
PrintWriter out=res.getWriter();
out.print(buf);
} else {



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


Re: [PATCH] for Bug Report 741 (security constraint match)

2001-01-30 Thread Dimitris Dinodimos

Oops. This is the correct patch file.

--- Dimitris Dinodimos <[EMAIL PROTECTED]> wrote:
> The new behavior is as following:
> When defining a security constraint for "/foo/*",
> matches resource "/foo" and "/foo/whatever" but not
> "/foo.jsp"
>  
> Cheers,
> Dimitris Dinodimos


__
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Index: AccessInterceptor.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/request/Attic/AccessInterceptor.java,v
retrieving revision 1.12.2.4
diff -u -r1.12.2.4 AccessInterceptor.java
--- AccessInterceptor.java  2000/08/24 21:50:51 1.12.2.4
+++ AccessInterceptor.java  2001/01/29 20:10:37
@@ -321,7 +321,9 @@

switch( ct.getMapType() ) {
case Container.PREFIX_MAP:
-   return path.startsWith( ctPath.substring(0, ctPathL - 2  ));
+   if (path.equals( ctPath.substring(0, ctPathL - 2  )))
+   return true;
+   return path.startsWith( ctPath.substring(0, ctPathL - 1  ));
case Container.EXTENSION_MAP:
return ctPath.substring( 1 ).equals( URLUtil.getExtension( path ));
case Container.PATH_MAP:



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


[PATCH] for Bug Report 788 (exception when trying to view a directory)

2001-01-30 Thread Dimitris Dinodimos

Hello All,
This bug can be reproduced when the browser's accepted
language is not represented in the ISO-8859-1
character set.
The fix sets the requested locale at the server's
response, and uses a Writer in order to convert to the
proper character set.
 
Cheers,
Dimitris Dinodimos



__
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Index: StaticInterceptor.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/request/Attic/StaticInterceptor.java,v
retrieving revision 1.7.2.6
diff -u -r1.7.2.6 StaticInterceptor.java
--- StaticInterceptor.java  2000/12/12 20:33:46 1.7.2.6
+++ StaticInterceptor.java  2001/01/29 20:11:10
@@ -485,6 +485,7 @@

if (! inInclude) {
res.setContentType("text/html");
+   res.setLocale(locale);
buf.append("\r\n");
buf.append("\r\n");
buf.append("")
@@ -634,7 +635,7 @@

if (! inInclude)  buf.append("\r\n");
 
-   if( res.isUsingWriter() ) {
+   if( !res.isUsingStream() ) {
PrintWriter out=res.getWriter();
out.print(buf);
} else {



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


[PATCH] for Bug Report 741 (security constraint match)

2001-01-30 Thread Dimitris Dinodimos

The new behavior is as following:
When defining a security constraint for "/foo/*",
matches resource "/foo" and "/foo/whatever" but not
"/foo.jsp"
 
Cheers,
Dimitris Dinodimos



__
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Index: StaticInterceptor.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/request/Attic/StaticInterceptor.java,v
retrieving revision 1.7.2.6
diff -u -r1.7.2.6 StaticInterceptor.java
--- StaticInterceptor.java  2000/12/12 20:33:46 1.7.2.6
+++ StaticInterceptor.java  2001/01/29 20:11:10
@@ -485,6 +485,7 @@

if (! inInclude) {
res.setContentType("text/html");
+   res.setLocale(locale);
buf.append("\r\n");
buf.append("\r\n");
buf.append("")
@@ -634,7 +635,7 @@

if (! inInclude)  buf.append("\r\n");
 
-   if( res.isUsingWriter() ) {
+   if( !res.isUsingStream() ) {
PrintWriter out=res.getWriter();
out.print(buf);
} else {



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


[PATCH] for Bug report 743

2001-01-13 Thread Dimitris Dinodimos



Hello,
 
There are two more bugs (report 741 and 744) that I 
would like to be fixed in version 3.2.2
Does anyone work on these bugs? If no one works on 
them I could try to fix them this weekend.
Can you please let me know.
 
Thank you very much,
Dimitris Dinodimos
 

Index: HttpRequestAdapter.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/service/http/Attic/HttpRequestAdapter.java,v
retrieving revision 1.16.2.5
diff -u -r1.16.2.5 HttpRequestAdapter.java
--- HttpRequestAdapter.java 2001/01/12 04:27:04 1.16.2.5
+++ HttpRequestAdapter.java 2001/01/13 10:11:09
@@ -247,21 +247,23 @@
 }
 
 public int getServerPort() {
-if(serverPort == -1) {
-//XXX Which is the default in case we can not get the port
-//from the request??
-serverPort=socket.getLocalPort();
-String hostHeader = this.getHeader("host");
-if (hostHeader != null) {
-int i = hostHeader.indexOf(':');
-if (i > -1) {
-hostHeader = hostHeader.substring(i+1);
-try{
-serverPort=Integer.parseInt(hostHeader);
-}catch(NumberFormatException pex){
-}
-}else serverPort=80;
-}
+if (serverPort != -1)
+return serverPort;
+String hostHeader = this.getHeader("host");
+if (hostHeader == null)
+serverPort = socket.getLocalPort();
+else {
+int i = hostHeader.indexOf(':');
+if (i > -1) {
+hostHeader = hostHeader.substring(i+1);
+try {
+serverPort = Integer.parseInt(hostHeader);
+} catch (NumberFormatException pex) {
+}
+} else if (isSecure())
+serverPort = 443;
+else
+serverPort = 80;
 }
 return serverPort;
 }



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


[PATCH] (Was: 3.2 cvs problems with ROOT context?)

2001-01-12 Thread Dimitris Dinodimos

Hello to all of you,This bug was introduced by the latest fix, that was made
to correct the problem in tomcat when it didn't have a ROOT context.This
patch gives getLongestPrefixMatch() a chance to return the ROOT
context.Cheers,Dimitris Dinodimos



Index: PrefixMapper.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/util/PrefixMapper.java,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 PrefixMapper.java
--- PrefixMapper.java   2001/01/04 21:28:33 1.3.2.1
+++ PrefixMapper.java   2001/01/12 17:25:20
@@ -214,12 +214,14 @@
container=myMap.mapCache.get(path);
if( container!=null ) return container;
}
-   
-   while (s.length() > 0) {
+
+   while (s.length() >= 0) {
//if(debug>8) context.log( "Prefix: " + s  );
container = myMap.prefixMappedServlets.get(s);

if (container == null) {
+   if (s.length() == 0)
+   return null;
s=URLUtil.removeLast( s );
}  else {
if( myMap.mapCacheEnabled ) {
@@ -228,7 +230,8 @@
}
return container;
}
-   }
+   } 
+
return container;
 }
 



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