1

My application is deployed on Oracle's OAS (ADF environment). My application is a simple form with a submit button. When it's clicked I send a request the Oracle's report server (to the rwservlet). My request look something like this:

http://<server>:<port>/reports/rwservlet?report=<report_name>&userid=<userid>/<password>@<connect_string>&desformat=pdf&destype=cache

This generates a PDF report and returns to the user's browser. I'd like to get that PDF report and save it to my local server as well (so I have 2 servers: the OAS server and the Reports Server - and I called the report on the Reports server and return to the client. I just want to intercept the process and save the report on the OAS server).

To send the request, I used a servlet on my OAS server. I want to somehow get the PDF from my response object (that's my plan). I don't know if this is possible.

BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
berto77
  • 855
  • 3
  • 11
  • 29

1 Answers1

1

You can't intercept/copy client's request. You've to request it programmatically with another HTTP request.

InputStream input = new URL("http://<server>:<port>/reports/rwservlet?report=<report_name>&userid=<userid>/<password>@<connect_string>&desformat=pdf&destype=cache").openStream();
// ...

Just write it to an arbitrary OutputStream the usual Java IO way. For example, a FileOutputStream.

BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
  • Hey BalusC, I used this idea, but implemented it a bit differently...I sent a post request then write the response to a local file. Works great. The resource that I'm requesting is password protected, so had to get around that. Thank you though, your reply got me in the right direction. – berto77 Oct 26 '11 at 16:42
  • You're welcome. You can find an example of sending POST requests by `URLConnection` here: http://stackoverflow.com/questions/2793150/how-to-use-java-net-urlconnection-to-fire-and-handle-http-requests – BalusC Oct 26 '11 at 16:44
  • wow...yea, exactly what I ended up doing. But seems like a lot more stuff here. Thanks for the link – berto77 Oct 28 '11 at 17:35