开发者

Open PDF file on client's browser directly from Java Servlet Class

开发者 https://www.devze.com 2023-02-12 03:16 出处:网络
Hey Folks, So this is the rundown: Essentially, what I want: PL/SQL Procedure call(using UTL_HTTP) --> Java Web Application, Servlet --> opens up a browser window and renders a PDF.

Hey Folks, So this is the rundown:

Essentially, what I want: PL/SQL Procedure call(using UTL_HTTP) --> Java Web Application, Servlet --> opens up a browser window and renders a PDF.

We use the package UTL_HTTP within our PL/SQL Procedure for this, as it has an option to send requests to external urls via the POST method. The only reason we use this package is to ensure our data is passed as POST parameters (apparently, there is no other way to open up external sites directly from PL/SQL procedures while passing parameters through the POST method). There are other means to provide urls directly and pass get parameters as part of the request url string, but this would expose sensitive parameters like username, password, serial id etc.

This http request from the PL/SQL procedure is intercepted by a servlet in our Java Web Application. Our Java Web Application is a Document Management Application and handles all the document management logic.

We managed to reach the servlet and also get a hold of the PDF and put it in the response.

Here's the catch: Since the originating application was a PL/SQL Procedure that sends the HTTP request directly to our Web Application, at no point is a browser window opened. So in our Java servlet class, we get hold of the PDF and write it onto the response. But we need to spawn a browser window to render the pdf. I found this neat site that provides Java Code to open up a browser window directly from a java class. But the problem is that the browser window opens up at the server directly and not on the client.This browser window ought to open up in our client machine from wh开发者_如何学编程ere the http request was issued not at the server.

Any suggestions?

Cheers


If you are using an PL/SQL Web aplication (using APEX or webToolkit) you can send to the browser the blob that you get from the UTL_HTTP call to the servlet

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号