Re: [JSP] List directory content within a war-file

2011-07-16 Thread Pid *
On 16 Jul 2011, at 15:46, Dark Before Dawn  wrote:

> Hi there,
>
> I am trying to list files and directories within an war-file i.e 
> images/summer2010 images/winter2010. The war-file is deployed on a tomcat 7 
> instance with unpackWARs="false".
> Since I have no exposed filesystem getRealPath will return null.

If you 'have no exposed file system', how do you expect to get files?


p

> So I tried to use getResourceAsStream wich works fine for files but not for 
> directories.
> My other idea was to use getResource and URL/URI to get a java.io.File via 
> JNDI. But this file is not a file nor a directory.
> Cheers
> Darky
>
> Code Snippet:
>// null if unpackWar = false
>String absolute = 
> this.getServletConfig().getServletContext().getRealPath("files");
>out.write("Files: " + absolute);
>
>// jndi
>URL url = 
> this.getServletConfig().getServletContext().getResource("files");
>out.write("" + url.toURI());
>
>File f = new File("file:" + url.toURI());
>
>// Both null
>out.write(" isDir: " + f.isDirectory());
>out.write(" isFile: " + f.isFile());
>
>InputStream is = 
> this.getServletConfig().getServletContext().getResourceAsStream("files/1.txt");
>
>// NPE if directory
>BufferedReader br = new BufferedReader(new InputStreamReader(is));
>String line;
>out.write("content");
>while ((line = br.readLine()) != null) {
>// print file content
>out.write(line +"");
>}
>br.close();
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

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



Re: IIS 7.5 2008 Server

2011-07-16 Thread Pid *
On 16 Jul 2011, at 07:51, Ian Porter  wrote:

> Hi pid
>
> I am using tomcat version 7.0, I have read the documentation below
> thanks, but it does not say that it is working with iis 7.5?
>
> I shall reinstall it again, and redo the files etc ? Is there any
> version you recommend of tomcat to work with iis 7.5 ?(with the isapi
> redirect.dll)
>
> Or is it because I am using iis 7.5 or something else ?

What have you tried, so far?
Post inline your configuration files.


p

>
> Regards
> Ian
>
>
> On Friday, July 15, 2011, Pid  wrote:
>> On 15/07/2011 22:21, Ian Porter wrote:
>>> Hi All
>>>
>>> I am trying to get the tomcat server to work on IIS 7.5 with 2008
>>> Server, I have tried many different ways and websites that say that
>>> they work, but when I go through there examples I am just not able to
>>> get it to work :(
>>
>> Which version of Tomcat?
>>
>>> I have enabled the execute rights on the dll, virtual directory.
>>>
>>> I was wondering if there was any advice or this way works for sure or
>>> this website example really does work. because I am at a loss for why
>>> the IIS redirect is not working.
>>
>> Did you read this website?
>>
>>  http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html
>>
>>  http://tomcat.apache.org/tomcat-7.0-doc/setup.html#Windows
>>
>>  http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html
>>
>>
>>
>> p
>>
>>
>>
>
> --
> Kind regards
> Ian Porter
>
> www: www.codingfriends.com
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

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



Re: RedHat and mod_jk

2011-07-16 Thread Leon Kolchinsky
Hi,

On RedHat installation of mod_jk is as easy as:

1.
# yum install httpd httpd-devel gcc gcc-c++

2.
Go to http://tomcat.apache.org/download-connectors.cgi and download the
source code (I'm giving an example with 1.2.31 version)
# wget
http://apache.mirror.aussiehq.net.au//tomcat/tomcat-connectors/jk/source/jk-1.2.31/tomcat-connectors-1.2.31-src.tar.gz
3.
# tar -xvzf tomcat-connectors-1.2.31-src.tar.gz

Read docs/webserver_howto/apache.html or native/BUILDING.txt for options.

# cd tomcat-connectors-1.2.31-src/native/
# which apxs
# ./configure --with-apxs=/usr/sbin/apxs --enable-api-compatibility
# make
# make install

You don't need any Java packages for that.

Also my way of installing JAVA on RedHat (Since many Apps support only Sun's
JDK/JRE):

JAVA INSTALLATION:
--
1. Go to http://www.oracle.com/technetwork/java/javase/downloads/index.htmland
download latest Self Extracting Installer.

Put it all under /opt or any other dir. you choose.
[root@vera126 downloads]# ls -l /opt
-rw-r--r--  1 root root  85052342 May 19 11:15 jdk-6u25-linux-i586.bin
[root@vera126 downloads]# cd /opt

# sh jdk-6u25-linux-i586.bin
# ln -s jdk1.6.0_25 jdk

# updatedb;locate javac |grep bin
/opt/jdk1.6.0_25/bin/javac
2.
Here /opt/jdk is the actual JAVA_HOME for your machine. Note this as you
will need it to run the following commands.

alternatives --install /usr/bin/java java /opt/jdk/bin/java 100
alternatives --install /usr/bin/jar jar /opt/jdk/bin/jar 100
alternatives --install /usr/bin/javac javac /opt/jdk/bin/javac 100

3.
Finally you should configure alternative to use Sun's JVM as the default
JVM. To do this type:
# /usr/sbin/alternatives --config java

4.
In the future when we update Java, we only need to update this symlink (for
JAVA_HOME)
/opt/jdk

5.
Last check:
[root@vera126 opt]# java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) Client VM (build 20.0-b11, mixed mode, sharing)


I've already seen members of this list giving good tips on that.

Cheers,
Leon Kolchinsky



On Fri, Jul 15, 2011 at 18:23, André Warnier  wrote:

> Hi.
>
> Recently, other people and myself were looking for a pre-packaged mod_jk
> binary for a RedHat RHELS system.
>
> As a result of some investigation (by Mark Eggers on one side, and an
> independent sysadmin of my customer on the other side), things seem to boil
> down to (largely quoted) :
>
> "
> In the RedHat product "Red Hat Enterprise Linux Server" (RHELS), there is
> no repository containing a pre-packaged mod_jk module.
>
> To obtain such a package, the client has to purchase the separate RedHat
> package "JBoss Enterprise Web Server", which contains mod_jk.
> "
>
> I would suppose that RedHat has good lawyers, and that they are "allowed"
> to do such a thing.  Personally, I find this a bit "cheeky", specially from
> a company that presents itself as a champion of Open Source.
> It is not an unmitigated feeling, because on the other hand I also
> recognise that mod_jk is a complex piece of software, and that supporting it
> for customers certainly has a cost.
>
> But whatever the real merits of my personal feelings in the matter,
> there are people (even sysadmins) who are comfortable with the idea of
> installing a software package from sources; but there are also many people
> who simply do not have the time to go through the hassle, and people who are
> uncomfortable with the installation of such packages (because of maintenance
> reasons, patches etc.), and people who are just not allowed to install
> anything that is not part of the standard corporate repository.
>
> In the practice thus, it probably means that a number of people will no
> longer use mod_jk on RHEL systems in the future, and I find this a pity,
> because even from a purely technical point of view, it is always better to
> have some alternatives.  And there are things which you can do with mod_jk,
> which you cannot with mod_proxy_ajp and/or mod_proxy_http (and probably
> vice-versa).
>
> Anyway, I wonder if anyone here has another opinion on the matter.
>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@tomcat.**apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: RedHat and mod_jk

2011-07-16 Thread Thad Humphries
On Sat, Jul 16, 2011 at 12:09 AM, Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Thad,
>
> On 7/15/2011 9:59 PM, Thad Humphries wrote:
> > If you rely on RedHat, Novell, OpenSuSE, Unbuntu, etc. you can wait
> > for some things until you are old and gray.
>
> Sing it. We're stuck on MySQL 5.0 in production because of this very
> fact. Sometimes I pine for the days of Gentoo. Only sometimes.
>
> > Worse is to have some update that you haven't screened stomp on
> > something you need.
>

Right, but when I roll my own, I can more easily keep multiple versions of a
program--Apache, Tomcat, Java, Firebird RDBMS, etc. and switch between them
if need be. (Life, however, has become easier since someone else here took
over the database stuff. Now I just run whatever version of Firebird
OpenSuSE is installing, and let production worry the final version.)


> Most package managers have provisions for holding a package (or the
> whole repo) at a certain level.
>
> Actually, the really nice thing about Debian, for instance, is that
> their releases are all stable (assuming you don't follow Sid like an
> idiot): you should never get stomped with anything. The bad news is that
> you have to wait for a major upgrade in order to get that next version
> of whatever - like MySQL 5.1 :(
>
> - -chris
>

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: Problems with installing ssl certificate under tomcat

2011-07-16 Thread Piotr Pawlowski
Christopher and All,

I am really sorry for not replying. I've coped with my problem before I went
to holidays.
Solution, which helped me to correctly install delivered certificate, it's
key and CA chain, can be found under following URL:
http://linuxadmin.com.pl/index.php/tomcat-and-ssl-certificates-small-how-to/
Christopher, thank you for your help. I hope, that this conversation will
also help somebody else.

Best Regards
--
Piotr Pawlowski


On 29 June 2011 16:00, Christopher Schultz wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Piotr,
>
> On 6/29/2011 3:11 AM, Piotr Pawlowski wrote:
> > My server.conf for ssl connector looks as follows:
> >
> > * >maxThreads="150" scheme="https" secure="true"
> >clientAuth="false" sslProtocol="TLS" keyAlias="someAlias"
> > keystoreFile="/etc/tomcat/ssl/keystoreFile"
> > keystorePass="SomeSecretPassword" />
>
> Okay. Are you using APR or not?
>
> > All files connected with SSL , including key store file, are located in *
> > /etc/tomcat/ssl/* directory.
>
> What is the output of the following command:
>
> $ keytool -list -keystore /etc/tomcat/ssl/keystoreFile
>
> You will need to import not only your own certificate and key, but also
> the certs from your Certificate Authority (CA).
>
> > "sec_error_bad_signature" is visible when I enter website from web
> browser
> > (FireFox).
>
> Are there any messages in the log file during startup and/or when you
> try to make a request?
>
> - -chris
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk4LMAcACgkQ9CaO5/Lv0PDmxwCdFFWVWXspT74UbfLw0j6p5r3u
> 7CUAoI5Gt8aJQEhcSiEcbN193CSpkvCW
> =LeMr
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: How can i change JSESSIONIDSSO cookie name?

2011-07-16 Thread Mathan Karthik
It has been verified, we have to set only 
org.apache.catalina.authenticator.Constants.SSO_SESSION_COOKIE_NAME  in system 
properties. No need to set org.apache.catalina.SSO_SESSION_COOKIE_NAME.


Apache Tomcat Configuration Reference - System Properties document has to be 
modified. It has been reported as a bug. Hope they will make the necessary 
changes in document. Thanks a lot.


Regards,
Mathan Karthik R
ZOHO Development Center(India) Pvt Ltd


 On Sat, 16 Jul 2011 22:34:59 +0530 Mark 
Eggers wrote  


- Original Message -

> From: Mathan Karthik 
> To: Tomcat Users List 
> Cc: 
> Sent: Saturday, July 16, 2011 12:49 AM
> Subject: Re: How can i change JSESSIONIDSSO cookie name?
> 
> Hi Mark
> 
> Thanks for the response. 
> 
> 
> I have added 
org.apache.catalina.authenticator.Constants.SSO_SESSION_COOKIE_NAME 
> and org.apache.catalina.SSO_SESSION_COOKIE_NAME in system properties. Gave 
the 
> same cookie name for the both system properties. Now Its working.
> 
> 
> Is it mandatory to keep both the entries? Please advice.
> 
> 
> Regards,
> Mathan Karthik R
> 


Glad it now works. Also, it's good that you've reported how it works. The next 
time someone comes up with this problem, hopefully they'll search the mail list 
archives and get the question answered a lot easier (and faster).

As to what's required, I suggest that you experiment and find out what works. 
Or you could read the documentation, including the API available for download 
as apache-tomcat-version-fulldocs.tar.gz.

I've never changed the JSESSIONID or JSESSIONIDSSO names, since I've never had 
a requirement that could be met by doing so. All I did was read the 
documentation, which is probably a good suggestion.

If you find the documentation difficult to follow write a Wiki entry or propose 
a documentation patch and attach it to a bugzilla enhancement request. I've 
seen both suggested several times on the list.

. . . . just my two cents.

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



Re: RedHat and mod_jk

2011-07-16 Thread Dark Before Dawn

After some API reading I found getResourcePaths().
http://download.oracle.com/javaee/1.3/api/javax/servlet/ServletContext.html#getResourcePaths%28java.lang.String%29

Cheers
Darky

   Hi there,
   I am trying to list files and directories within an war-file i.e
   images/summer2010 images/winter2010. The war-file is deployed on a
   tomcat 7 instance with unpackWARs="false".
   Since I have no exposed filesystem getRealPath will return null. So
   I tried to use getResourceAsStream wich works fine for files but not
   for directories.
   My other idea was to use getResource and URL/URI to get a
   java.io.File via JNDI. But this file is not a file nor a directory.
   Cheers
   Darky



Re: How can i change JSESSIONIDSSO cookie name?

2011-07-16 Thread Mark Eggers
- Original Message -

> From: Mathan Karthik 
> To: Tomcat Users List 
> Cc: 
> Sent: Saturday, July 16, 2011 12:49 AM
> Subject: Re: How can i change JSESSIONIDSSO cookie name?
> 
> Hi Mark
> 
> Thanks for the response. 
> 
> 
> I have added 
> org.apache.catalina.authenticator.Constants.SSO_SESSION_COOKIE_NAME 
> and org.apache.catalina.SSO_SESSION_COOKIE_NAME in system properties. Gave 
> the 
> same cookie name for the both system properties. Now Its working.
> 
> 
> Is it mandatory to keep both the entries? Please advice.
> 
> 
> Regards,
> Mathan Karthik R
> 


Glad it now works. Also, it's good that you've reported how it works. The next 
time someone comes up with this problem, hopefully they'll search the mail list 
archives and get the question answered a lot easier (and faster).

As to what's required, I suggest that you experiment and find out what works. 
Or you could read the documentation, including the API available for download 
as apache-tomcat-version-fulldocs.tar.gz.

I've never changed the JSESSIONID or JSESSIONIDSSO names, since I've never had 
a requirement that could be met by doing so. All I did was read the 
documentation, which is probably a good suggestion.

If you find the documentation difficult to follow write a Wiki entry or propose 
a documentation patch and attach it to a bugzilla enhancement request. I've 
seen both suggested several times on the list.

. . . . just my two cents.

/mde/

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



[JSP] List directory content within a war-file

2011-07-16 Thread Dark Before Dawn

Hi there,

I am trying to list files and directories within an war-file i.e 
images/summer2010 images/winter2010. The war-file is deployed on a 
tomcat 7 instance with unpackWARs="false".
Since I have no exposed filesystem getRealPath will return null. So I 
tried to use getResourceAsStream wich works fine for files but not for 
directories.
My other idea was to use getResource and URL/URI to get a java.io.File 
via JNDI. But this file is not a file nor a directory.

Cheers
Darky

Code Snippet:
// null if unpackWar = false
String absolute = 
this.getServletConfig().getServletContext().getRealPath("files");

out.write("Files: " + absolute);

// jndi
URL url = 
this.getServletConfig().getServletContext().getResource("files");

out.write("" + url.toURI());

File f = new File("file:" + url.toURI());

// Both null
out.write(" isDir: " + f.isDirectory());
out.write(" isFile: " + f.isFile());

InputStream is = 
this.getServletConfig().getServletContext().getResourceAsStream("files/1.txt");


// NPE if directory
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line;
out.write("content");
while ((line = br.readLine()) != null) {
// print file content
out.write(line +"");
}
br.close();


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



Re: Problem-Tomcat 7.0.16 on mac os 10.6.8

2011-07-16 Thread Alexandra Stylianidou
Thanks for everything!!!It's running now!

2011/7/15 Hassan Schroeder 

> On Fri, Jul 15, 2011 at 12:26 PM, Alexandra Stylianidou
>  wrote:
> > You mean the logs(folder) from tomcat folder or the logs from console?
>
> I mean wherever your running Tomcat is writing its logging messages.
>
> You said you reconfigured the connector port and started it. Where
> are those startup messages?
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> http://about.me/hassanschroeder
> twitter: @hassan
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Strange MySQL-Behaviour with JDBC-Realm

2011-07-16 Thread Kris
Did autoreconnect solve your problem?




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



Re: How can i change JSESSIONIDSSO cookie name?

2011-07-16 Thread Mathan Karthik
Hi Mark

Thanks for the response. 


I have added 
org.apache.catalina.authenticator.Constants.SSO_SESSION_COOKIE_NAME and 
org.apache.catalina.SSO_SESSION_COOKIE_NAME in system properties. Gave the same 
cookie name for the both system properties. Now Its working.


Is it mandatory to keep both the entries? Please advice.


Regards,
Mathan Karthik R



 On Sat, 16 Jul 2011 02:48:50 +0530 Mark 
Eggers wrote  


- Original Message - 
 
> From: Mathan Karthik  
> To: Tomcat Users List  
> Cc: 
> Sent: Friday, July 15, 2011 1:30 PM 
> Subject: Re: How can i change JSESSIONIDSSO cookie name? 
> 
> Hi Mark 
> 
> Thanks for your swift response. Sorry i missed to mention my tomcat 
version. One 
> of my application using tomcat_6_0_28 and another application using 
> tomcat_5_0_28. 
> 
> I have added org.apache.catalina.SSO_SESSION_COOKIE_NAME and 
> org.apache.catalina.SESSION_COOKIE_NAME. Now my JSESSIONID cookie name got 
> changed. But JSESSIONIDSSO name didn't get changed. Am i missing anything? 
> 
> 
> Regards, 
> Mathan Karthik R 
 
 
A quick look at the docs (and javadocs) seems to indicate that this is not 
possible for 5.0.x. All interesting fields are public static final String. Time 
to upgrade. 
 
For 6.0.28, why did you change both? I was under the impression that you only 
wanted the SSO cookie name changed. 
 
>From the the documentation: 
 
org.apache.catalina.SESSION_COOKIE_NAME 
 
Note that the Servlet specification requires this to be JSESSIONID. You should 
not rely on being able to change this. 
 
How did you set the system property? Did you read this? 
 
http://wiki.apache.org/tomcat/FAQ/Miscellaneous#Q29 
 
 
In particular, it's a good idea to create a setenv.sh file in 
$CATALINA_HOME/bin (or $CATALINA_BASE/bin if you're running several Tomcats 
from a base installation) and add the appropriate setting to CATALINA_OPTS. 
Something like: 
 
#!/bin/bash 
CATALINA_OPTS="-Dorg.apache.catalina.SSO_SESSION_COOKIE_NAME=JNONSTANDARDSSO" 
export CATALINA_OPTS 
 
might work. 
 
 
This is based on my reading of the documentation. I've not tried this. 
 
. . . . just my two cents. 
 
/mde/ 
 
- 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org 
For additional commands, e-mail: users-h...@tomcat.apache.org 
 



Browser Caching Of Static Files (css/images/js)

2011-07-16 Thread Reinwald Warapen

Hey,
I recently implemented that static resources of my web application 
running on Tomcat v 6.0.32 should be cached by the browser for a very 
large period of time (> 1 year) .


Though of sharing these helpful articles for those who are  interested 
in the same.


http://www.reinwaldwarapen.com/2011/07/browser-internals-when-it-comes-to_12.html

http://www.reinwaldwarapen.com/2011/02/my-take-on-optimizing-http-caching-for.html

Thanks

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