• Post Reply Bookmark Topic Watch Topic
  • New Topic

byteserving pdf documents using servlets in websphere os/390

 
nathan krish
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am encountering problem trying to byteserver pdf documents using servlets in websphere os/390. The IE browser hangs and need to be end tasked. Please reply your valuable suggestions.
Also need to know whether websphere server in os/390 is capable of handling byte serving. Any valuable reply is appreciated.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some browsers are very picky about the Content-length being correctly set in the response headers. Without a content length, the browser is not sure if the transmission is complete and so appears to hang.
Generally speaking, you should set the Content-length whenever serving non-html resources.
Bill

------------------
author of:
 
Tim Holloway
Bartender
Posts: 18416
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By "byteserving" do you mean writing binary data rather than text data? Yes, WebLogic supports that. I think that's a basic J2ee requirement.
I haven't had problems with IE, but Netscape most definitely will give you grief if you don't supply a content-length with a PDF. It's quite well-documented.
Because you're running on a mainframe, you also need to be careful you know what codeset you're dealing with. A little slippage on ASCII isn't a big deal, but if you're creating PDF directives in EBCDIC you will create unreadable documents (which may cause the Acrobat Reader, hence the web browser) to hang or even crash. A lot of times you get "transparent" code translation when you bop about a z-System, but sometimes transparent is a liability, not an asset.
 
nathan krish
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The content length is set to exact bytes served. For example if Range in the request header(start-stop range) is bytes=1202-31023, the following are the header setting in the response:
res.setStatus(res.SC_PARTIAL_CONTENT)
res.setContentLength(29822)
res.setHeader("Content-range", bytes1202-31023/29822)
Then the file pointer in the randomaccessfile(pdf file) is set to the start range and the file is written to the output stream (servlet response) till stop range.
If I execute the servlet without partial byte serving logic, it is displaying the document properly.
 
Tim Holloway
Bartender
Posts: 18416
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Content-range is a new one on me. I'm not sure I'd want to depend on all browsers honoring it. Also, most of what I saw seemed to indicate that the client was responsible for specifying the range it wanted(?)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!