Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

http session from a bean

 
Skip Cole
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Beans have limitations on opening sockets, correct?
Can a bean get a reference to an object (via JNDI), and then call a method on that object that opens a socket?
Further, can the method of that object then establish an https session? I am going to try this out as a proof of concept, but I figured I would ask this here first to see if anyone knew off hand.
Thanks,
Skip
 
Danl Thompson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out pages 76-77 of the J2EE spec for permissions:
ftp://ftp.java.sun.com/pub/j2ee/xsei32434k/j2ee-1_3-pfd3-spec.pdf
EJB's can certainly use sockets to connect to legacy systems, but they can't accept or listen, so they can't implement a SocketServer.
dan'l
 
Skip Cole
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dan'l,
Thanks for this info. I trying to figure out what the implications are.
If a bean can't accept or listen, then it seems like it will be impossible for it to set up an HTTPS session, since that requires communication back and forth. So that may put me back into my original situation.
I think I am going to try this out to see how it works. I am really dragging this SCEA project out. I like to test things out too much (but I am learning quite a lot).
Skip
 
Danl Thompson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Skip, I wish I was a thorough as you. I didn't write any code to test my design assumptions before I turned in my submission, but that should still be OK. I'm going to try writing a session bean that uses a socket to talk to an HTTP server this weekend. If it doesn't work I'll cry. As long as you're not trying to manage threads it should be fine though.
 
Skip Cole
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dan'l,
I can tell from your postings that you are a very thorough person. I know when you get your results back you will have passed this easily.
I just want to nail down all of this technology, because I want to be able to go to a client and get them set up quickly.
Skip
 
Danl Thompson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Skip, I think you'll find you can do a
HttpURLConnection c = (HttpURLConnection)url.openConnection();
and then get or post from within a session bean.
dan'l
 
Skip Cole
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dan'l,
I am glad to know that.
Actually I started reading up on JMS, and playing with it. It seems people are doing a lot more with message oriented middleware these days, so I think my solution will use use MOMs to do these things.
(Now I got to figure out how to depict this using UML :-))
Thanks,
Skip
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic