B
bauer
Hi,
I wrote a small web-application that displays tif image that are
retrieved from a database. I use Tomcat "4.1.24-LE-jdk14" as
web-container on a windows XP system and AlternaTiff as Tif Viewer
plugin. The applications works fine. But now I want to move to a unix
system where I use Tomcat "4.1.31". If I execute the same request on
the unix system the image is not displayed anymore but I see a
question dialog box asking me if I want to save or open the file. If I
choose open the binary file is opened in a text editor. I really don't
know why. The only difference I saw (when I used axis Tcp Tunnel
Monitor for monitoring the request datastream) is the response Header
from Tomcat
unix:
"HTTP/1.1 200 OK
Content-Type: image/tiff;charset=ISO-8859-1
Transfer-Encoding: chunked
Date: Tue, 26 Oct 2004 07:44:58 GMT
Server: Apache-Coyote/1.1"
windows:
"HTTP/1.1 200 OK
Content-Type: image/tiff
Transfer-Encoding: chunked
Date: Tue, 26 Oct 2004 07:55:18 GMT
Server: Apache Coyote/1.0"
Here is the code I used to generate the Tif page
<%@ page import="java.io.*"%><%@ page import="de.tui.tas.jsp.*,
java.util.*"%><%
//contains current Tif document information
DocumentBean docBean = (DocumentBean)
session.getAttribute("DOCUMENT_BEAN");
if ( (docBean != null) && (docBean.getCurrentDocument() != null)
&& (docBean.getCurrentDocument().getDocumentPage(0) != null))
{
DocumentPage DocPage = docBean.getCurrentPage();
String sFileName = DocPage.getPhysicalFileName();
String contentType = DocPage.getContentType();
//content type is currently always "image/tiff"
response.setContentType(contentType);
ServletOutputStream outter = response.getOutputStream();
try {
File file = new File(sFileName);
byte[] byteContents = new byte[(int)file.length()];
FileInputStream in = new FileInputStream(sFileName);
int retcd = in.read(byteContents);
in.close();
outter.write(byteContents);
outter.flush();
}
catch (Exception e)
{
e.printStackTrace();
}
}
%>
regeards,
Stephan.
I wrote a small web-application that displays tif image that are
retrieved from a database. I use Tomcat "4.1.24-LE-jdk14" as
web-container on a windows XP system and AlternaTiff as Tif Viewer
plugin. The applications works fine. But now I want to move to a unix
system where I use Tomcat "4.1.31". If I execute the same request on
the unix system the image is not displayed anymore but I see a
question dialog box asking me if I want to save or open the file. If I
choose open the binary file is opened in a text editor. I really don't
know why. The only difference I saw (when I used axis Tcp Tunnel
Monitor for monitoring the request datastream) is the response Header
from Tomcat
unix:
"HTTP/1.1 200 OK
Content-Type: image/tiff;charset=ISO-8859-1
Transfer-Encoding: chunked
Date: Tue, 26 Oct 2004 07:44:58 GMT
Server: Apache-Coyote/1.1"
windows:
"HTTP/1.1 200 OK
Content-Type: image/tiff
Transfer-Encoding: chunked
Date: Tue, 26 Oct 2004 07:55:18 GMT
Server: Apache Coyote/1.0"
Here is the code I used to generate the Tif page
<%@ page import="java.io.*"%><%@ page import="de.tui.tas.jsp.*,
java.util.*"%><%
//contains current Tif document information
DocumentBean docBean = (DocumentBean)
session.getAttribute("DOCUMENT_BEAN");
if ( (docBean != null) && (docBean.getCurrentDocument() != null)
&& (docBean.getCurrentDocument().getDocumentPage(0) != null))
{
DocumentPage DocPage = docBean.getCurrentPage();
String sFileName = DocPage.getPhysicalFileName();
String contentType = DocPage.getContentType();
//content type is currently always "image/tiff"
response.setContentType(contentType);
ServletOutputStream outter = response.getOutputStream();
try {
File file = new File(sFileName);
byte[] byteContents = new byte[(int)file.length()];
FileInputStream in = new FileInputStream(sFileName);
int retcd = in.read(byteContents);
in.close();
outter.write(byteContents);
outter.flush();
}
catch (Exception e)
{
e.printStackTrace();
}
}
%>
regeards,
Stephan.