Unable to open .chm file from a link in weblogic server. But the same jsp code works in Websphere
Sample Code :
<!-- < a href="JavaScript:window.navigate('help/ARTGALRY.CHM')"> Linked Text</a> -->
The above link, works well in websphere. help is a folder that resides in the server. But when i tried to execute the same in Weblogic, some junk characters appeared . so i tried to direct the link to Display.jsp and passed the path of the chm file as the parameter. I cleared teh out buffer using out.clearBuffer() . i set the content type to application/x-msdownload and also set the header to content disposition.
Nothing worked .
I need immediate help to sort out this issue. Can anybody help me
<br>
Thanks in advance
Sumithra
-
Unable to open .chm file from a link in Weblogic . (5 messages)
- Posted by: sumithra sampath
- Posted on: March 22 2004 07:15 EST
Threaded Messages (5)
- Unable to open .chm file from a link in Weblogic . by Mircea Crisan on March 22 2004 08:54 EST
- Unable to open .chm file from a link in Weblogic . by sumithra sampath on March 23 2004 00:07 EST
-
Unable to open .chm file from a link in Weblogic . by Mircea Crisan on March 23 2004 07:02 EST
- Unable to open .chm file from a link in Weblogic . by sumithra sampath on March 23 2004 07:37 EST
- Unable to open .chm file from a link in Weblogic . by sumithra sampath on March 23 2004 07:37 EST
-
Unable to open .chm file from a link in Weblogic . by Mircea Crisan on March 23 2004 07:02 EST
- Unable to open .chm file from a link in Weblogic . by sumithra sampath on March 23 2004 00:07 EST
-
Unable to open .chm file from a link in Weblogic .[ Go to top ]
- Posted by: Mircea Crisan
- Posted on: March 22 2004 08:54 EST
- in response to sumithra sampath
Hi,
I think you should check your server configurations on how to associate file extensions to mime types. From what you are telling I suppose websphere has the
*.chm -- application/x-msdownload mime type associtation, while weblogic doesn't.
Best regards, Mircea -
Unable to open .chm file from a link in Weblogic .[ Go to top ]
- Posted by: sumithra sampath
- Posted on: March 23 2004 00:07 EST
- in response to Mircea Crisan
Hi
Thanks for your reply. I even tried including the mime type
<mime-mapping>
<extension>chm</extension>
<mime-type>application/x-msdownload</mime-type>
</mime-mapping>
in the web.xml file. and still it doesnt work. What should i do ? -
Unable to open .chm file from a link in Weblogic .[ Go to top ]
- Posted by: Mircea Crisan
- Posted on: March 23 2004 07:02 EST
- in response to sumithra sampath
Hi
Another solution would be to write a servlet mapped on the '*.chm' requests that sets the appropriate content type ("application/x-msdownload") and writes the bytes in the output stream.
Best regards, Mircea -
Unable to open .chm file from a link in Weblogic .[ Go to top ]
- Posted by: sumithra sampath
- Posted on: March 23 2004 07:37 EST
- in response to Mircea Crisan
Hi
I tried writing a Jsp, i checked if the file extension is .chm , then set the response.setContentType to " application/mshelp " (i even tried setting application/mshelp in web.xml adn provinding this in response.setContentType). I cleared the out object's buffer and got the OutputStream from the response object and tried getting the buffers everything. Still it doesnt work. Here is the code that i wrote.
if(extension.equalsIgnoreCase(".chm")){
response.setContentType("application/mshelp");
}
response.setHeader("Content-disposition", "attachment; filename="+fileName);
ServletOutputStream out_s = null;
BufferedOutputStream bos = null;
InputStream fin = null;
try {
System.out.println("HII" + response.isCommitted() );
URL url = new URL(finalPath);
URLConnection conn = url.openConnection();
System.out.println("get ContentType ====== "+conn.getContentType());
fin = conn.getInputStream();
//fin = new FileInputStream(finalPath);
System.out.println("fin . available ==== "+fin.available());
byte[] b = new byte[fin.available()];
fin.read(b);
out.clearBuffer();
out_s = response.getOutputStream();
System.out.println("committed = "+response.isCommitted());
//out_s.println("Testing");
bos = new BufferedOutputStream(out_s);
bos.write(b);
} catch (Exception e) {
e.printStackTrace();
}//end of catch
finally {
try {
if (fin != null) {
fin.close();
}
if (bos != null) {
bos.close();
}
if (out_s != null) {
out_s.flush();
//out_s.close();
}
} catch (IOException e) {
e.printStackTrace();
}//end of catch
}//end of finally -
Unable to open .chm file from a link in Weblogic .[ Go to top ]
- Posted by: sumithra sampath
- Posted on: March 23 2004 07:37 EST
- in response to Mircea Crisan
Hi
I tried writing a Jsp, i checked if the file extension is .chm , then set the response.setContentType to " application/mshelp " (i even tried setting application/mshelp in web.xml adn provinding this in response.setContentType). I cleared the out object's buffer and got the OutputStream from the response object and tried getting the buffers everything. Still it doesnt work. Here is the code that i wrote.
if(extension.equalsIgnoreCase(".chm")){
response.setContentType("application/mshelp");
}
response.setHeader("Content-disposition", "attachment; filename="+fileName);
ServletOutputStream out_s = null;
BufferedOutputStream bos = null;
InputStream fin = null;
try {
System.out.println("HII" + response.isCommitted() );
URL url = new URL(finalPath);
URLConnection conn = url.openConnection();
System.out.println("get ContentType ====== "+conn.getContentType());
fin = conn.getInputStream();
//fin = new FileInputStream(finalPath);
System.out.println("fin . available ==== "+fin.available());
byte[] b = new byte[fin.available()];
fin.read(b);
out.clearBuffer();
out_s = response.getOutputStream();
System.out.println("committed = "+response.isCommitted());
//out_s.println("Testing");
bos = new BufferedOutputStream(out_s);
bos.write(b);
} catch (Exception e) {
e.printStackTrace();
}//end of catch
finally {
try {
if (fin != null) {
fin.close();
}
if (bos != null) {
bos.close();
}
if (out_s != null) {
out_s.flush();
//out_s.close();
}
} catch (IOException e) {
e.printStackTrace();
}//end of catch
}//end of finally