Re: Default character encoding for ServletRequest

2009-10-01 Thread Markus Meyer
It all depends on the client. IIRC if you set the charset in the content 
type header to utf-8, like this


contentType=text/html; charset=utf-8

most browsers will then use utf-8 for HTTP GET and POST requests when 
responding to the given page.


See this thread for some more information:

http://mail-archives.apache.org/mod_mbox/tomcat-users/200111.mbox/%3cd913221a882fd31198d90008c75d6909058b4...@cwnl-ams-pri01.nl.compuware.com%3e#archives

Markus


Halm Reusser schrieb am 01.10.2009 13:22:

Pid wrote:

How about?

 request.setCharacterEncoding(ENCODING);


I wan't do it within the application. I prefer to configure the app 
container or the app itself.


Bearing in mind that you're not really changing what the client 
requests, or might expect you to be setting...


Is there a possibility to force the client to use a specific encoding?

-Halm

-
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: How to check if the client dropped the connection

2009-09-28 Thread Markus Meyer

Jason Brittain schrieb:

The first time you call flush, it will send the HTTP response
headers to the client, so you would need to first set the headers before
flushing.  That sounds difficult for you to do because you're writing an
image, and one of the headers would be Content-Length, which you probably
don't know until your image is generated.


Actually, Content-Length is optional as per the HTTP-1.1 spec:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

However, my take on the OP is that a better optimization strategy in 
this case would be to just cache a larger image on the server rather 
than generating every image on-demand. That is, when the user is moving 
around in the image, the server, on the first request, would calculate 
the image for a much larger portion of the map than requested and stores 
it on disk in temporary storage (or in some cache area in RAM, if 
feasible, after all RAM is cheap these days and 64-bit machines can have 
lots of RAM). Storage of the images would not be done all at once but in 
tiles. When then user then moves around in the client, the requests just 
reads the tiles of the created image from disk, puts them together and 
clips the borders, then compresses the image and sends it to the client. 
It is possible that PNG even has some support for compressing parts of 
an image so the tiles itself could be already stored in compressed 
format, but it's been a while since I read the PNG spec last time. The 
same could be done for zooming by storing images in a pyramidal 
structure, like it is done in pattern recognition. While the user is 
moving, a background thread associated with the client could try to 
anticipate where the user is likely to be moving to and calculate the 
given tiles in advance. Actually, this sounds like an interesting 
project for several Ph.D. theses...



Markus

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



Re: How to check if the client dropped the connection

2009-09-28 Thread Markus Meyer

aaime74 schrieb:

Well, something like that has actually been done already, it's called
tile caching, and works under the restrictive conditions that you
can force the client to make requests in predetermined sizes and tiles.
As for applying this to the general case, I invite you to have a look
at how big the raster surface is and how much space is required
to actually store on the disk a full map (only _one_ map, some GeoServer
installs do serve 500-1000 different layers) here:


I'm not saying you should store the whole map all at once. My approach 
was to dynamically cache requests that the client may want to make in 
advance. An easy example would be if a client makes a request for the 
city center, you create the map for the city center plus the suburbs 
around it and store it somewhere, then return the city center. If the 
user then moves around a bit to see the suburbs, you already have the 
whole map cached and just need to return it, no need to do any further 
calculation.


If you then also compress the image on the fly while you are reading it 
from disk (or from some memory cache), you will start writing to the 
output stream very soon (also detecting the dropped connection very 
soon) and the servlet will not need much RAM. Of course this does not 
work if you just use Java's built-in PNG encoder.


Obviously, caching always comes with the price that you will have the 
occassional cache miss :-) That is, this does not work for every request 
but may decrease load and RAM usage a lot for typical use cases.


In your OP you write: Unfortunately in the meantime the older requests 
are still running, drawing a map takes time and a lot of memory, for 
example the above request, which is a small one btw, allocates a 
BufferedImage of 700KB. This indicates that you (1) seem to not use any 
caching (drawing a map takes time - with caching the map would already 
have been drawn) and (2) you use BufferedImage which of course does not 
allow you to PNG-encode on the fly. Both problems would be solved with 
the above suggestion.



Markus

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



Re: How to check if the client dropped the connection

2009-09-28 Thread Markus Meyer

Martin Gainty schrieb:

could you explain just a bit more what is a tile?


If you have a very large image, say 1 million x 1 million pixels or 
something like that, it is more efficient to split the image into tiles, 
that is small images of, say, 256 x 256 pixels. If a certain portion of 
the big image is requested, you can then load these tiles individually 
from disk and put them together to form the portion of the image that 
was requested. Tiles which are inside the requested image portion can be 
used as is, tiles at the borders may not be contained fully in the 
requested image and must possibly be clipped.


How tiles are used can be seen e.g. in Google Maps: when you have a slow 
internet connection, while scrolling you can actually see that the map 
consists of rectangular tiles which are loaded on demand.


This is more or less the same concept as blocks when doing paging of 
virtual memory or pages when talking about processor caches. Even 
Audacity (audio editor) uses this concept to achieve fast editing of 
very large audio files.



Markus

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



Re: Tomcat App Configuration

2009-09-07 Thread Markus Meyer

Hi,

just use an entry like the following in your Tomcat's server.xml 
configuration file:


Context path=/ docBase=/path/to/where/your/webapp/resides/

HTH
Markus

skarahan schrieb:

Hi,

I use tomcat5.5 on ubuntu and have java web application.When I run it, its
address looks like http://servername:8180/myapp; on browser address
line.But I don't like this.when I write  http://servername:8180/; address
on web browser address line,I want to open my application.

I hope that I can explain my question..

Thanks for your help.
  



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



Re: Tomcat App Configuration

2009-09-07 Thread Markus Meyer
I'm not sure what's the problem, but I would not put the app into 
/usr/share/tomcat5.5/webapps because this is the default location. I 
would put the webapp into a different location. Also, check if you 
already have a ROOT directory in your webapps/ path which may interfere 
with your other root setting.



Markus

skarahan schrieb:

Hi ,
thanks your help.I add this line server.xml Context path=/
docBase=/usr/share/tomcat5.5/webapp/myapp/ I can see it manager page
path column.But its not running.is there another xml file to congire it.?


Markus Meyer wrote:
  

Hi,

just use an entry like the following in your Tomcat's server.xml 
configuration file:


Context path=/ docBase=/path/to/where/your/webapp/resides/

HTH
Markus

skarahan schrieb:


Hi,

I use tomcat5.5 on ubuntu and have java web application.When I run it,
its
address looks like http://servername:8180/myapp; on browser address
line.But I don't like this.when I write  http://servername:8180/;
address
on web browser address line,I want to open my application.

I hope that I can explain my question..

Thanks for your help.
  
  

-
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: Tomcat App Configuration

2009-09-07 Thread Markus Meyer

Hi André,

sorry if I got that one wrong. It's just that it works for me the way I 
describe it. (I generally avoid putting my webapps into the default 
setting and create Context entries for all of them.)



Markus

André Warnier schrieb:

Markus,
that was a bad recommendation.
Look here instead :
http://wiki.apache.org/tomcat/HowTo#head-2e16a614a1be6e03102fc69dd59587a30e20bc5c 




Markus Meyer wrote:
I'm not sure what's the problem, but I would not put the app into 
/usr/share/tomcat5.5/webapps because this is the default location. 
I would put the webapp into a different location. Also, check if you 
already have a ROOT directory in your webapps/ path which may 
interfere with your other root setting.



Markus

skarahan schrieb:

Hi ,
thanks your help.I add this line server.xml Context path=/
docBase=/usr/share/tomcat5.5/webapp/myapp/ I can see it manager 
page
path column.But its not running.is there another xml file to congire 
it.?



Markus Meyer wrote:
 

Hi,

just use an entry like the following in your Tomcat's server.xml 
configuration file:


Context path=/ docBase=/path/to/where/your/webapp/resides/

HTH
Markus

skarahan schrieb:
  

Hi,

I use tomcat5.5 on ubuntu and have java web application.When I run 
it,

its
address looks like http://servername:8180/myapp; on browser address
line.But I don't like this.when I write  http://servername:8180/;
address
on web browser address line,I want to open my application.

I hope that I can explain my question..

Thanks for your help.


-
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






-
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: user / password

2009-08-27 Thread Markus Meyer
I do not know NetBeans but you probably want to have a look at 
tomcat-users.xml in the Tomcat configuration directory.


Chris Lenart schrieb:

NetBeans is trying to connect to Tomcat and asking for an ID and password.
Wher do I find this?



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



Re: user / password

2009-08-27 Thread Markus Meyer

See http://www.netbeans.org/kb/61/websvc/gs-axis.html

Search for tomcat-users.xml in this document.

Chris Lenart schrieb:

I did but it's blank. Do I add one?

-Original Message-
From: Markus Meyer [mailto:me...@mesw.de] 
Sent: Thursday, August 27, 2009 3:14 PM

To: Tomcat Users List
Subject: Re: user / password


I do not know NetBeans but you probably want to have a look at 
tomcat-users.xml in the Tomcat configuration directory.


Chris Lenart schrieb:
NetBeans is trying to connect to Tomcat and asking for an ID and 
password. Wher do I find this?




-
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



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



Strange problems with SSL support in Tomcat 6

2009-08-26 Thread Markus Meyer

Hi,

I have a Debian machine where previously, Tomcat 5.5 was installed 
(using the Tomcat 5.5 Debian package). uname -a returns:


Linux server02 2.6.26-2-amd64 #1 SMP Sun Jul 26 20:35:48 UTC 2009 x86_64 
GNU/Linux


Now, for some reason I installed Tomcat 6 by using the binary 
distribution of Tomcat 6.0.20 downloadable from the website (because 
there's no Debian package for Tomcat 6 yet). I copied over the 
configuration files: logging.properties, server.xml, tomcat-users.xml 
and everything works fine except SSL.


The server listens on port 80 for HTTP requests and on port 443 for 
HTTPS requests. With the exact same configuration and certificate file, 
SSL works with Tomcat 5.5 but not with Tomcat 6. Everything else works 
without any flaws.


When I try to access the server using https://myserver.com/; in 
firefox, the error code ssl_error_rx_record_too_long appears. However, 
no errors are logged at all, although I set everything to ALL in the 
logging.properties file.


I even converted the PKCS12 certificate I use to JKS format but although 
keytool shows the certificate just fine, using the JKS keystore has the 
same effect.


I use the following connector settings in /opt/tomcat6/conf/server.xml:

Connector
  port=443

  scheme=https
  secure=true
  clientAuth=false

  sslProtocol=TLS

  keystoreFile=/opt/tomcat6/conf/cert.p12
  keystorePass=*
  keystoreType=pkcs12

  maxHttpHeaderSize=8192
  maxThreads=150
  minSpareThreads=25
  maxSpareThreads=75
  enableLookups=false
  connectionTimeout=2
  disableUploadTimeout=true
  acceptCount=100
  /

Tomcat is run as root (for now at least), so permission problems should 
not occur. Of course /opt/tomcat6/conf/cert.p12 exists and is a valid 
certificate.


I would be extremely grateful if someone has an idea on how I could 
attempt to debug this strange problem.


Thanks in advance!

Best regards
Markus

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



Re: Strange problems with SSL support in Tomcat 6

2009-08-26 Thread Markus Meyer

Just for the record:

many thanks for Martin for helping me off-list. My problem was that I 
had not added the AprLifecycleListener to server.xml.


Lesson learned: do not copy over configuration files from Tomcat 5.5 to 
Tomcat 6 but start with the new ones from Tomcat 6 and insert the 
appropriate directives.



Markus


Markus Meyer schrieb:

Hi,

I have a Debian machine where previously, Tomcat 5.5 was installed 
(using the Tomcat 5.5 Debian package). uname -a returns:


Linux server02 2.6.26-2-amd64 #1 SMP Sun Jul 26 20:35:48 UTC 2009 x86_64 
GNU/Linux


Now, for some reason I installed Tomcat 6 by using the binary 
distribution of Tomcat 6.0.20 downloadable from the website (because 
there's no Debian package for Tomcat 6 yet). I copied over the 
configuration files: logging.properties, server.xml, tomcat-users.xml 
and everything works fine except SSL.


The server listens on port 80 for HTTP requests and on port 443 for 
HTTPS requests. With the exact same configuration and certificate file, 
SSL works with Tomcat 5.5 but not with Tomcat 6. Everything else works 
without any flaws.


When I try to access the server using https://myserver.com/; in 
firefox, the error code ssl_error_rx_record_too_long appears. However, 
no errors are logged at all, although I set everything to ALL in the 
logging.properties file.


I even converted the PKCS12 certificate I use to JKS format but although 
keytool shows the certificate just fine, using the JKS keystore has the 
same effect.


I use the following connector settings in /opt/tomcat6/conf/server.xml:

Connector
  port=443

  scheme=https
  secure=true
  clientAuth=false

  sslProtocol=TLS

  keystoreFile=/opt/tomcat6/conf/cert.p12
  keystorePass=*
  keystoreType=pkcs12

  maxHttpHeaderSize=8192
  maxThreads=150
  minSpareThreads=25
  maxSpareThreads=75
  enableLookups=false
  connectionTimeout=2
  disableUploadTimeout=true
  acceptCount=100
  /

Tomcat is run as root (for now at least), so permission problems should 
not occur. Of course /opt/tomcat6/conf/cert.p12 exists and is a valid 
certificate.


I would be extremely grateful if someone has an idea on how I could 
attempt to debug this strange problem.


Thanks in advance!

Best regards
Markus

-
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



How to configure per-webapp logging

2009-08-12 Thread Markus Meyer

Hi,

I'd like to configure my webapp to log into a separate file. (Actually, 
I'd like to have two files, one with only the SEVERE messages and one 
with all messages, but let's start with an easy example here.)


This is a Debian 5.0 server.

The webapp is installed in 
/var/lib/tomcat5.5/webapps/productionserver_test, and I have created a 
file 
/var/lib/tomcat5.5/webapps/productionserver_test/WEB-INF/classes/logging.properties 
as per the tutorials with the following content:



handlers= org.apache.juli.FileHandler

org.apache.juli.FileHandler.level = ALL
org.apache.juli.FileHandler.directory = 
${catalina.base}/logs/productionserver_test

org.apache.juli.FileHandler.prefix = productionserver_test

com.gfii.productionserver.handlers = org.apache.juli.FileHandler


The class com.gfii.productionserver is the name of the logger. In the 
webapp, I call Logger.getLogger(com.gfii.productionserver) whenever I 
need to have access to the logger.


When I add this logging.properties file, this has two effects:

- Logging information for com.gfii.productionserver is not logged to 
the main Tomcat logs anymore

- The directory ${catalina.base}/logs/productionserver_test is created

However, no log files are created in this directory.

What am I doing wrong? Please let me know if you need more information.

Thanks in advance!


Markus


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