You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Danny Bols <db...@osirion.be> on 2003/09/29 10:45:52 UTC

File downloading problem in combination with Tomcat Security

Hello,

we are having problems downloading files from a cocoon based website in
combination with using Tomcat Security.

Normally when downloading a file using IE5 a dialog appears asking to open
or to save the file.  When one chooses for opening, the appropriate
application is started and the file is automatically opened (in our example
Ms Wordpad opens the WRI document).

If we use Tomcat security in this webapp (see web.xml fragment below) the
file is not opened in Ms Wordpad and IE5 gives the following message:
>>>>>>>>>>
Internet Explorer cannot download test.wri from localhost
Internet Explorer was not able to open this Internet site. The requested
site is either unavailable or cannot be found. Please try again later.
>>>>>>>>>>

A small test told us that if we didn't use Cocoon and leave it all up to
Tomcat, the problem didn't occur. In order to get a grip on this problem we
created a small Cocoon webapp (see sitemap.xmap below) to reproduce the
problem. We create a TCP trace to see what happened. The output of this
trace (see below) contains a logrecord of the request without using tomcat
security and a second logrecord with tomcat security activated. We see a
slight difference between the 2 logrecords:
>>>>>>>>>>
Pragma: No-cache
Cache-Control: no-cache
>>>>>>>>>>
We don't have any idea what this means and if this is related to our
problem.


We are using Cocoon 2.0.4 and Tomcat 4.1.24 at the moment. We suspect the
ResourceReader but don't have a good clue. Can anyone help us?

Thanks,

Danny Bols
dbols@osirion.nl





######## BEGIN OF SITEMAP ##########
<?xml version="1.0" encoding="UTF-8"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">

  <!-- Components
============================================================================
= -->
  <map:components>

    <!-- Readers
============================================================================
== -->
    <map:readers default="resource">
      <map:reader name="resource"
src="org.apache.cocoon.reading.ResourceReader"/>
    </map:readers>

    <!-- Matchers
============================================================================
= -->
    <map:matchers default="wildcard">
      <map:matcher name="wildcard"
src="org.apache.cocoon.matching.WildcardURIMatcher"/>
    </map:matchers>
  </map:components>

  <!-- Pipelines
============================================================================
== -->
  <map:pipelines>
    <map:pipeline>
      <map:match pattern="*.wri">
        <map:read mime-type="application/x-mswrite" src="{1}.wri"/>
      </map:match>
      <map:match pattern="*.jpg">
        <map:read mime-type="image/jpg" src="{1}.jpg"/>
      </map:match>
    </map:pipeline>
  </map:pipelines>
</map:sitemap>
######## END OF SITEMAP ##########


######## BEGIN OF WEB.XML FRAGMENT ##########
  <mime-mapping>
    <extension>wri</extension>
    <mime-type>application/x-mswrite</mime-type>
  </mime-mapping>

  <!-- Define a Security Constraint on this Application -->
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Entire Application</web-resource-name>
      <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
       <role-name>manager</role-name>
    </auth-constraint>
  </security-constraint>

  <!-- Define the Login Configuration for this Application -->
  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Tomcat Manager Application</realm-name>
  </login-config>
######## END OF WEB.XML FRAGMENT ##########




######## BEGIN OF TCP LOGFILE ##########
tcpTrace version 0.7.3.710
Copyright (c) 2000-2002 Simon Fell & Matt Humphrey. All rights reserved.

Log Started, 09/26/2003 12:19:35:0517

>>>>>> Downloading Was OK during this logrecord
Logged at, 09/26/2003 12:20:01:0264
Connection Opened, 09/26/2003 12:19:41:0225
Connection Closed, 09/26/2003 12:20:01:0264
Source, 127.0.0.1
Destination, localhost:8080
# Bytes Client -> Server, 408
# Bytes Server -> Client, 187
Client Data, GET /myapp/test.wri HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel,
application/x-shockwave-flash, */*
Accept-Language: nl
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Host: localhost:8686
Connection: Keep-Alive
Authorization: Basic YWRtaW46YWRtaW4=

Server Data, HTTP/1.1 200 OK
X-Cocoon-Version: 2.0.4
Content-Type: application/x-mswrite
Content-Length: 22
Date: Fri, 26 Sep 2003 10:19:41 GMT
Server: Apache Coyote/1.0

Site Domburg Routefile

>>>>>> Downloading Failed During this logrecord
Logged at, 09/26/2003 12:23:44:0074
Connection Opened, 09/26/2003 12:23:24:0036
Connection Closed, 09/26/2003 12:23:44:0074
Source, 127.0.0.1
Destination, localhost:8080
# Bytes Client -> Server, 408
# Bytes Server -> Client, 270
Client Data, GET /myapp/test.wri HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel,
application/x-shockwave-flash, */*
Accept-Language: nl
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Host: localhost:8686
Connection: Keep-Alive
Authorization: Basic YWRtaW46YWRtaW4=

Server Data, HTTP/1.1 200 OK
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-Cocoon-Version: 2.0.4
Content-Type: application/x-mswrite
Content-Length: 22
Date: Fri, 26 Sep 2003 10:23:24 GMT
Server: Apache Coyote/1.0

Site Domburg Routefile
######### END OF TCP LOGFILE ##########