Since you have to specify the url during deployment for the JNDI ENC, how do you deal with dynamic query strings for a web page?
Furthermore, can one use the HttpURLConnection.getInputStream() method since Enterprise JavaBeans are restricted from performing certain operations such as setting the stream handler factory used by the URL class? If not, how can you retrieve the contents?
-
Using URLConnection and HttpURLConnection in EJB (6 messages)
- Posted by: Steven Lau
- Posted on: June 21 2000 06:54 EDT
Threaded Messages (6)
- URL by Ed Roman on June 22 2000 11:30 EDT
- URLConnection by Steven Lau on June 23 2000 04:11 EDT
-
URLConnection by Ed Roman on June 23 2000 01:55 EDT
- URLConnection by Steven Lau on June 23 2000 02:19 EDT
-
URLConnection by Floyd Marinescu on June 23 2000 04:52 EDT
- URLConnection by Steven Lau on June 25 2000 06:16 EDT
-
URLConnection by Ed Roman on June 23 2000 01:55 EDT
- URLConnection by Steven Lau on June 23 2000 04:11 EDT
-
URL[ Go to top ]
- Posted by: Ed Roman
- Posted on: June 22 2000 11:30 EDT
- in response to Steven Lau
Hi Steven,
I'm not sure what you mean by a dynamic query string for a web page. Can you please elaborate?
Also, to help you with the 2nd question (HttpURLConnection), I've always used servlets for performing Http requests, and had the servlets delegate to the EJB components. Have you considered that alternative? -
URLConnection[ Go to top ]
- Posted by: Steven Lau
- Posted on: June 23 2000 04:11 EDT
- in response to Ed Roman
Basically,
I've got this page that displays dynamic contents based on the query strings. And I want to implement an EJB that can fetch the contents of this page based on the query strings input by the user at another page and do some formatting to the contents.
Here is what I want to do:
I've written a servlet to accept the query strings. The servlet will pass the inputs to an EJB that opens a connection to the URL, set the query strings, fetch the dynamic contents, and format it. An alternative is to have everything done by the servlet but this function is expected to be used quite heavily. The problems lay in setting the query strings and fetching the contents. How can you do it in an EJB? -
URLConnection[ Go to top ]
- Posted by: Ed Roman
- Posted on: June 23 2000 13:55 EDT
- in response to Steven Lau
If I understand you correctly, you've got a web browser that's sending parameters down to a servlet, and your servlet wants to load and format information stored in a database dynamically based upon the parameters sent from the browser. You then want to spit this formatted data back out to the browser. Is that correct?
If this is the case then have you considered using the EJB bean to read the data out of the database, pass it back to the servlet, and have the servlet write it back out to the browser?
-
URLConnection[ Go to top ]
- Posted by: Steven Lau
- Posted on: June 23 2000 14:19 EDT
- in response to Ed Roman
You've got everything right except for the part about getting data from the database. Some of the data are coming from other web servers where I do not have total access to. Therefore, using an HttpURLConnection is the easiest way that does not require tampering with other web servers. -
URLConnection[ Go to top ]
- Posted by: Floyd Marinescu
- Posted on: June 23 2000 16:52 EDT
- in response to Steven Lau
Steve,
Why do you want an EJB to handle these presentation related issues? Infact I an not even sure that it is aloud. Aren't EJB's restricted from performing SocketCommunications ? I think the type of work you trying to do is in the domain of Servlets (Presentation Logic), whereas EJB's should be used for business logic.
What I would recommend doing is having a program fetch the contents of your "foreign" URL and write them to a file on your local drive (use CRON or something). Now your servlets can just access that file (MUCH FASTER than waiting to connect to other servers).
Floyd -
URLConnection[ Go to top ]
- Posted by: Steven Lau
- Posted on: June 25 2000 06:16 EDT
- in response to Floyd Marinescu
The fetching program is exactly what I'm trying to write in EJB. Yes, EJB is restricted to use socket communication but you can obtain a URLConnection using JNDI ENC.