Re: default pageEncoding

2002-07-30 Thread Daniel Bruce Lynes

On Monday 22 July 2002 23:26, Dmitry Melekhov wrote:

> Eric Leung wrote:
> > Hi,
> >
> > yes, just like HTML add a line like this:
> > 
> >
> > 
> >
> > character set
> >
> > Eric
>
> I understand.
> But our devepopers are too lazy ;-)
> They don't want to write this line in every jsp...
> Is it possible to configure Tomcat (something else) to set default
> encoding?

Besides that, the meta tag doesn't quite work.

Tomcat outputs:

Content-Type: text/html; charset=iso-8859-1

As one of its standard headers.  So, if you're like us, and you're trying to 
output Simplified Chinese, the Simplified Chinese will still show up as 
garbage characters.  The meta tag only overrode the http response header 
under Mozilla, and only under certain conditions.

To get around this problem, you can change your page directive to be:

<%@page contentType="text/html"%>

Note, how I didn't include the charset as part of the content type.

The default is:

<%@page contentType="text/html; charset=iso-8559-1"%>

So, what you can do is:

<%@page contentType="text/html"%>





This is my ÖÐÎÄ text.


And if you've got lazy programmers, you can always write a perl script to go 
through every page that's already been written and just insert it.  Every 
subsequent page however, will need to be updated manually.  Or, like I 
did...a combination of perl and shell scripts :)  I had the task of updating 
400 JSP files, and there was no damned way I was going to do it manually. :p

If you'd like, you can email me privately, and I'll send you the perl utility 
I used as a base for my scripts, but the shell scripts are heavily site 
dependent.

ttfn

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Tomcat 4.0.3 and non-asci characters (JSP pages)

2002-07-30 Thread Daniel Bruce Lynes

On Tuesday 23 July 2002 04:03, Ryszard Lach wrote:

> Could anyone explain how are non-ascii characters processed by Tomcat ?
> I have the following configuraton:
>
> Tomcat 4.0.3 running with apache (mod_webapp), environment: LANG=pl_PL,
> JDK1.4.0 with command-line parameter
> -Djavax.servlet.request.encoding=ISO-8859-2
>
> JSP page with '<%@ page contentType="text/html;CHARSET=ISO-8859-2" %>'
> declared.
>
> All polish characters are displayed in the browser correctly, they also
> are inserted into database correctly, but I cannot receive them in
> e-mail sent from the JSP page - all non-ASCI characters are coming in
> the message as proper LATIN2 characters preceded by 'Â' or 'Ă'
> characters. When I look at the generated from JSP Java code in
> ~catalina/work directory, I see exactly the same.

Are you sure the characters you stored in the database are stored in Latin2, 
and not unicode?

> Decompiled (generated from JSP) class contains octal codes of LATIN2
> characters (i suppose there should be rather UNICODE character's codes).

Octal codes?  Could you give an example of what you are calling an 'octal 
code'?

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Hardening Tomcat 3.2.4

2002-07-30 Thread Daniel Bruce Lynes

On Thursday 25 July 2002 10:23, [EMAIL PROTECTED] wrote:

> I posted a similar question a while ago and did not receive any
> answer from this list. May be, folks on this list are admins/
> developers/programmers who are bothered mostly about application
> itself and not security. May be there is an "overall security"
> list where such questions may be posed. Anybody have suggestions
> where questions such as these may be directed?

We are.  But I think a good number of us are probably running UNIX, or some 
variant thereof.

> It is probably a good idea to pay some attention to security.
> A snippet from my access_log (same IP - somebody is curious!)
> --
> [23/Jul/2002:11:49:38 -0800] "GET /c/winnt/system32/cmd.exe?/c+dir
> HTTP/1.0" 404 648
> [23/Jul/2002:11:49:38 -0800] "GET /d/winnt/system32/cmd.exe?/c+dir
> HTTP/1.0" 404 648
> [23/Jul/2002:11:49:38 -0800] "GET
> /scripts/..%c1%1c../winnt/system32/cmd.exe?/c+dir HTTP/1.0" 400 718
> [23/Jul/2002:11:49:39 -0800] "GET

That's a script kiddy looking for nimda, code red, code red 2, or code green.  
To me, it's just a pain in the ass...flooding my bandwidth.  Doesn't pose any 
real threat.  But, there are certain versions of Tomcat 4.xx that may or may 
not be succeptible, and early versions of Apache 1.3.xx/Apache 2.xx for the 
unicode encoded urls, and of course IIS 4.0/5.0 if you're using the indexing 
server.

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: unable to start tomcat on redhat linux 7.2

2002-07-30 Thread Daniel Bruce Lynes

On Thursday 25 July 2002 01:43, LinuxTyro wrote:

> I have set the JAVA_HOME and TOMCAT_HOME variables
> correctly therefore  cant figure out what is wrong.

export JAVA_HOME=/opt/jdk
export JDK_HOME=/opt/jdk
export PATH=$PATH:/opt/jdk/bin

Or something similar.

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Tomcat 3.2.x

2002-03-19 Thread Daniel Bruce Lynes

I'm curious as to whether this problem is just me.  I haven't seen any 
mention of anyone else running into this problem.

However, what I'm experiencing (it doesn't happen in Tomcat 4.0.x), but I 
still need to get things working under Tomcat 3.2.x is:

1. deploy the war file
2. restart tomcat
3. attempt to run the application

Where the problem lies is in the jar/zip files that are in the 
$TOMCAT_HOME/webapps/appname/WEB-INF/lib directory.  Some don't get loaded at 
all, and others only get partially loaded.  For the ones that only partially 
get loaded, even if I extract them into the classes directory, I still run 
into the same roadblock.

This phenomenon occurs under both Tomcat 3.2.3 and Tomcat 3.2.1.  I can move 
my jar/zip files into the system lib directory, but then my servlets are 
foobar; Tomcat won't find them anymore.

Thanks in advance for any help or answers you might have.

P.S.  Any properties files I have won't get loaded from the WEB-INF/classes 
directory either...I have to put those into the $TOMCAT_HOME/classes 
directory.

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Further to Tomcat 3.2 problem with deploying webapp jar/zip files

2002-03-19 Thread Daniel Bruce Lynes

I've also tried checking the Tomcat bugzilla database, to no avail.  Seems no 
matter what I enter for a query term, I don't get anything back, or if I try 
the simple form, I usually get back one item that is usually for a different 
product.

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: Install tomcat 3.2.3 on Win 98

2002-03-19 Thread Daniel Bruce Lynes

On March 19, 2002 04:46 pm, smashingwebs wrote:

> I need help to set up tomcat 3.2.3 on windows 98.
> I went to sysedit and put in TOMCAT_HOME = c:\tomcat
> into autoexec.bat
> I also put in JAVA_HOME = c:\jdk1.3.1_02

Make sure that says "set JAVA_HOME=c:\jdk1.3.1_02"

The 'set' keyword is required in the autoexec.bat file.

> But when I try to run tomcat I get the message:
>
> "You must set JAVA_HOME to point at your Java Development Kit Installation"
>
> Is there somewhere else where I should set TOMCAT_HOME and JAVA_HOME?

In Windows 98, they should both be set in your autoexec.bat

Also, you might want to add the following line to your config.sys:

shell=c:\command.com /p /e:768

Make sure that the path to command.com is correct for your system.  It might 
be in c:\windows\command, or c:\win98\command, or d:\win98\command, or 
whatever...anyways...I'm sure you get the picture.

This line should give you the extra environment space you typically need for 
developing J2EE applications under Win95/98.

Also, you might want to add Java to your path.  Try the following as the last 
line of your autoexec.bat file:

set PATH=%PATH%;c:\jdk1.3.1_02

ttfn

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Tomcat 3.2.1, 3.2.3, 3.2.4a

2002-03-19 Thread Daniel Bruce Lynes

I've now tried using the WEB-INF/lib directory with all of the above versions 
to no avail.  No matter what, certain lib files I put into the WEB-INF/lib 
directory won't load.  Also, specific class files within specific jar files 
won't load; extracting them into the WEB-INF/classes directory doesn't help.  
Putting everything into the system lib directory works until I get to the 
point where I need to run a servlet.  Then I'm SOL, as it expects to find the 
servlet class files under the WEB-INF/lib or WEB-INF/classes directory.

I have also tried with the following JDK's:

Sun JDK 1.3.1-b24
Sun JDK 1.3.1_02
Blackdown JDK 1.3.0 FCS

For some quick examples, the following fail every time:

jnp-client.jar comes with JBoss 2.4.x (I'm using 2.4.4)
jnp-client.jar:  org.jnp.interfaces.NamingContextFactory

The home interface from my jar file that I've archived up for the 
application, but other classes within the same jar file load up fine.

log4j is v1.1.3
log4j.jar:  Cannot find the context for  (this works in 3.2.4a and 3.2.3 
but not in 3.2.1); it is fixed by including the $TOMCAT_HOME/lib directory in 
the classpath, and dumping the log4j.properties file in there.

jboss-client.jar comes with JBoss 2.4.x (I'm using 2.4.4)
jboss-client.jar:  fails to load proxy class when attempting to get the 
remote interface from the home interface (this is after I've put 
jnp-client.jar into the $TOMCAT_HOME/lib directory).

I could list 3 or 4 more jar files, but I'm sure you get the idea, and can 
appreciate the fact that this isn't a complicated setup.  I'm wondering if 
there's something special I have to do in my startup scripts?

Also, I'm running Linux kernel v2.2.19, and glibc 2.2.3.

Thanks in advance for any help you might be able to offer.

I just want to make sure this is a bug, and not a configuration error, before 
submitting it to bugzilla.

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: Tomcat 3.2.1, 3.2.3, 3.2.4a

2002-03-19 Thread Daniel Bruce Lynes

On March 19, 2002 07:26 pm, you wrote:

> Random thought -- have you replicated the package structure in your
> directory structure underneath WEB-INF/classes?

No

I ended up saying #$#@$@# on it, and installed Tomcat 4 for now.  However, I 
still need to get 3.2/3.3 working (neither work...both with the same set of 
problems).  Tomcat 4's another ball of wax; no binaries seem to exist for the 
Apache->Tomcat link.  I know this is all possible in Tomcat 3.x, because it's 
working just fine in Forte using the Tomcat module, which is Tomcat 3.2.

I'm guessing I need to configure something specifically for it, but I have no 
idea where to start.

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: Tomcat 4.0.3. is not unpacking my WAR file

2002-03-21 Thread Daniel Bruce Lynes

On March 21, 2002 08:02 am, you wrote:

> Tomcat 4.0.3 is NOT unpacking my WAR file and my application
> is not getting loaded. Is this a bug or is there a configuration
> issue that I am missing.

It'll only do this if the server is restarted.  Tomcat doesn't support 
on-the-fly deploy yet.   I've also noticed that if the directory already 
exists for the web application in question, that it never extracts the war 
file.  This seems to be the behaviour on all of the Tomcat versions I've 
tried recently (3.2.1,3.2.3,3.3rc1,4.0.1).

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Software caused connection abort (Was: Re: Please help me! problem with tomcat.)

2002-03-27 Thread Daniel Bruce Lynes

On March 26, 2002 07:29 pm, Zhe wrote:

> Maybe it's silly, but I want get some help!
> In one of my jsp page I want to show a image dynamically, so I put an
> dynamical IMG tag in the HTML jsp is outputting. 
 But when the client
> request the page the image cann't be showen. And there is some error
> message :" 2002-03-26 17:40:00 - Ctx( /gongwen ): IOException in: R(
> /gongwen + /image/0002-01.tif + null) Software caused connection abort:
> socket write error". When I change the daynamical IMG tag to
> src="/image/0002-01.jpg" and put 0002-01.jpg file into
> corresponding path, it works well. I don't know whether thetomcat cann't
> transfer the tif file.
> I am useing win2k + tomcat3.2.3 +jdk1.4

If it's any consolation, I've encountered this behaviour under Tomcat 3.2 
module for Forte v3, using JDK 1.4 under Linux w/libc2.2.3.  I've also 
experienced it under the Tomcat 3.2 module for Forte v3 with JDK 1.3.1_02 
under Windows 2000 w/sp2.

It seems to only happen on pages that employ large numbers of images (not 
necessarily large), and when using a frameset.  I've been able to reproduce 
it when browsing under Netscape 6.2.1 in Linux.  However, browing under 
Internet Explorer 5.0 SP2 under Windows 2000 SP2, I wasn't able to reproduce 
the behaviour; it only happened once.

The problem was an internal error in the HotSpot client VM under JDK 1.4.  I 
still haven't determined the cause of the error under JDK 1.3.1_02 under 
Windows, as I was unable to reproduce the error.

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: i18n_http_output('pass');

2002-02-12 Thread Daniel Bruce Lynes

On February 12, 2002 08:47 pm, you wrote:

> Does anybody know Java servlet equivalent functions of the following PHP
> functions i18n_http_output('pass') for
> Japanese encoding and readfile() ?

You could try taking a look at the i18n support in Struts, or at the separate 
i18n Jakarta taglibs project.

http://jakarta.apache.org/struts
http://jakarta.apache.org/taglibs/

ttfn

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Tomcat 4.1.18

2003-01-17 Thread Daniel Bruce Lynes
I'm currently having a small problem with Tomcat 4.1.18, which didn't exist in 
Tomcat 4.0.4.

The problem can be illustrated with a one liner JSP:

<%@ page contentType="text/html" %>

This one line spits out an HTTP header of Content-Type: text/html on Tomcat 
4.0.4

However, under 4.1.18, the following is spit out:

Content-Type: text/html;charset=ISO-8859-1

I need the former behaviour because these pages need to handle both GB2312-80 
and ISO-8859-1.  As such, I cannot have the character set explicitly set, and 
it also cannot be dynamically generated.  The locale information is 
determined when the  information is output, using a taglib.  By 
that time, the page directive has already been issued.  Also, the contentType 
field in the page directive cannot be dynamic from what I've been able to 
determine. (Tomcat 3.xx)  Has this behaviour changed in 4.0.x/4.1.x?

Thanks.

Daniel

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Tomcat 4.1.18

2003-01-17 Thread Daniel Bruce Lynes
On Friday 17 January 2003 07:03, Shapira, Yoav wrote:

> Howdy,
> Perhaps this will shed some light.  See Issue 1 at
> http://www.jcp.org/aboutJava/communityprocess/maintenance/jsr053/errata_
> 1_2_a_20020321.html
>
> Yoav Shapira
> Millennium ChemInformatics

Thanks, Yoav.  I will try this out today, and I'll let you know how I made 
out.

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Tomcat 4.1.18

2003-01-17 Thread Daniel Bruce Lynes
On Friday 17 January 2003 07:03, Shapira, Yoav wrote:

> Howdy,
> Perhaps this will shed some light.  See Issue 1 at
> http://www.jcp.org/aboutJava/communityprocess/maintenance/jsr053/errata_
> 1_2_a_20020321.html
>
> Yoav Shapira
> Millennium ChemInformatics

This sort of fixed it.  It fixed one problem, but dug a bigger hole elsewhere.

The charset header is now fixed.  However, the problem that remains now is 
that struts doesn't load up the resources properly.  The messages that get 
pumped out to the page end up as a bunch of question marks.

To fix this, I wrote my own tag library to read in the struts messages, and 
output them:

String value=(String)messages.getMessage(key);
try {
byte[] text=value.getBytes("iso-8859-1") ;
value=new String(text,"gb2312") ;
} catch( java.io.UnsupportedEncodingException uee ) {
}
JspWriter.out(value) ;

It should be clear that this isn't a valid solution either.  If support for 
languages other than English and mainland Chinese is desired, a lot of 
branching code will be needed here.

Thanks.

Daniel

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Tomcat 4.03 Configuration

2003-01-21 Thread Daniel Bruce Lynes
On Tuesday 21 January 2003 08:37, Alfie Pino wrote:

> This might be a dumb question, but I need some help.
>
> 1. Tomcat 4.03 on Windows OS
> 2. how do I get tomcat to pre-compile JSP pages?

jspc.bat in your tomcat's bin directory

> 3. How do I configre Tomcat to use the complied pages only? So that I
> can remove the JSP pages? I am having performance issues, and also, I do
> not want to store the jsp code on the server. Please help..

Again, jspc.bat in your tomcat's bin directory.  If you want help, type 
'jspc.bat -help'.

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: user authentication

2000-11-13 Thread Daniel Bruce Lynes

On Mon, 13 Nov 2000, Michelle wrote:

> I've been delving through the Tomcat archives and various guru site
> out there, trying to piece together a sound approach to handling
> user authentication and rights access.  I've seen some threads and
> articles on using sessions, some references in the Tomcat archives
> to JDBCRealm (which I cannot find anything more on), hooking into
> databases .. etc.  I find I am a bit miffed and coming here looking
> for some suggestions.
> 
> My site 
> > will have static and dynamic pages
> > will contain both protected and unprotected areas
> > in the protected areas, will require logins
> > each user will be assigned a role for the protected area
> which grants access rights such as read, write, admin
> - yes, an ACL model

For our system, we're managing it all through sessions.  When the person logs
in, their login information is checked against a database object.  If it
matches, they're logged in.  Otherwise, they're asked to provide a correct
login, or bugger off.

After they're logged in, there is a user object associated with their session
(session.setAttribute( user, "user" )).

It is through this user object that decides where they can access, and what they
can access.

> 
> Any thoughts on the best approach?
> 
> > Should I use JDBCRealm (an can someone send me the link
>to docs please?)
> > Should I use the session object to hold a URL to role access
> hash once a user logs?
> > Should I spin my own (YIKES!)?

That's what we chose to do.  However, we have very specific needs for our
project.  Perhaps you do not, for yours.  Perhaps you just want a UNIX-style ACL
system.  If that is the case, and you're not overly concerned about passwords
flying over the network, you might consider Apache access control files (if
you're using Apache), or whatever the similar item is for IIS.)

Daniel Lynes
eService System Corp.