How to show a word document


We have a word document on IS, we want to show this to users by clicking a link on a jsp page. (JSP is hosted on the same IS).

looking for methods/steps(Like pointing the link to an IS service which delivers the document…) to deliver this word document to the browser so that browser opens word document. (Sometimes this could be a pdf or some other documents)


I assume your Word/PDF document exists somewhere on the file system on the IS box. You will need to simply server the documents via HTTP and ensure the directory is accessible via HTTP. For example, to server a document called “test.doc”? on “IS/packages/myapp/docs”?, your HTTP address will be http://ishost:port/myapp/docs/test.doc.

As far as activating the documents with appropriate handler on the browser end, that’s something the user will have to setup. If you are “manually”? streaming the document, you will need to setup appropriate MIME type of the document you are returning in the HTTP response (but I think it’s something like “application/msword”? and “application/pdf”).

I hope this helps!


Hido’s approach will work for files served through file system only. AND, you SHOULD implement some security solution on top of it. (else, it will be open to access to all)

do look into webM Java API for Service.setRepsonse; This approach will also work for file served via Db.


Thanks Hido and Saurabh

Hido : We need to keep these files external to application package and also as Saurabh mentions there is a security issue.

I am doing the following… getting access denied errors , may be missing something

  • a dummy service with name “worddoc”, execute ACL - anonymous
  • using getFile, loadas bytes (word document is at /abd/userdocs/temp.doc)
  • passing these byte stream to service -

When invoking this service from a browser, getting the error 403 not authorized to access the page.