• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

byteserving pdf documents using servlets in websphere os/390

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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(?)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic