Skip to main content
gamedev.net
🔒 Locked

[java] Same session for Java Client

Started by DareDeveloper Aug 7, 2008 at 11:46 AM 2 replies 1k views
Original Post
DareDeveloper
DareDeveloper
Hi all, not sure if this belongs here ... or if it is more of a web development topic. I use showDocument of BasicService to open an URL from a Webstart application. Unlike AppletContext it is impossible to specify a target, right? Is there a way (platform independent) to open an URL in an external browser and pass _self as target/frame? I guess the answer is no ... but a part of me is still hoping. Not sure if that would help at all, though. Or maybe there is another way to do what I have in mind: I want to log in using the web browser and use that window/tab/session (server side session, btw.) from the java application to submit requests ... (fire and forget ... so that I don't need to store any login information in the application). Using an existing session does work from the mail client for example. That is why I am hoping that there is a way to do the same thing from a java application. Is there a way to do that? Doesn't the server recognize the requests as requests from the same client?
Given enough eyeballs, all mysteries are shallow. MeAndVR
OmegaGearX64
OmegaGearX64
You might want to try the forums at http://forums.sun.com, or the forums at http://forums.java.net/. They might be better able to answer such a question.
BloodWarrior
BloodWarrior
Heyas
Ok so Ive been there and I know exactly what you are doing wrong:

WebStart sucks!
Dont get me wrong, it has its uses but its not for what you are doing.

When you launch WebStart you remember you need to specify some parameters in the JNLP file? including a full http url for where your files are?

This is because WebStart will actually launch a new javaw process which has nothing to do with the current IE process.
Because you are in a different process you have no access to the server session (where you have logged in before starting your application).

So... there you go.

I solved my problem by using an applet instead of webstart. (Oracle does the same, launch an ie which has an 0x0 applet which launches a huge frame which can access the applet which can access the ie page which is logged to the server session).

I might be wrong and there might be some way of making it work. If there is please let me know. (also feel free to browse the java forums for my posts about this problem, look for bwvictorious).

Yours Truly
K
Pain is Inevitable, Suffering is Optional.Unknown
CaptainJester
CaptainJester
URL url = new URL("http://www.mydomain.com/runtask.jsp")URLConnection conn = url.openConnection();InputStream in = conn.getInputStream();byte buf[8192] = new byte[8192];while(in.read(buf) != -1);


Not sure if this is what you are trying to do. This will run the webpage each time you run it. It will allow you to run a task on the server without caring about the output. You will probably have to sign your application to use it though. Also not sure if the server will use sessions properly with this code, but it is something to start with.
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.