"browser integration" in a desktop app

S

sponxe

I developed a C# desktop app with an integrated webbrowser control
because often I need to auto-fill some fields in a remote php form.

Now I would like to move to Java (rewriting the app) because I am
planning to abandon completely Windows but I have a problem with the
aforementioned feature. Does Java have something like that (maybe in
6.0) to allow me to integrate one browser (I assume Firefox on Linux)
so that I can get the webpage form, extract the fields and fill them?

Thanks in advance.

sponxe

P.S. I tried Mono on Linux but my app doesn't work and besides I
already planned to rewrite a lot of classes (time is not a problem).
 
A

Andrew Thompson

..Does Java have something like that (maybe in
6.0) to allow me to integrate one browser (I assume Firefox on Linux)
so that I can get the webpage form, extract the fields and fill them?

JDIC seems to have a project(/API) that does this,
under 'demos' is a 'browser'..
<https://jdic.dev.java.net/#demos>

Some further docs. here.
<https://jdic.dev.java.net/nonav/documentation/javadoc/0.9/org/jdesktop/jdic/browser/WebBrowser.html>

( I have no further information on it, beyond seeing
the JWS demo it on-screen - which seems to wrap
an IE window in Java controls, here. )

Andrew T.
 
O

Oliver Wong

I developed a C# desktop app with an integrated webbrowser control
because often I need to auto-fill some fields in a remote php form.

Now I would like to move to Java (rewriting the app) because I am
planning to abandon completely Windows but I have a problem with the
aforementioned feature. Does Java have something like that (maybe in
6.0) to allow me to integrate one browser (I assume Firefox on Linux)
so that I can get the webpage form, extract the fields and fill them?

Thanks in advance.

sponxe

P.S. I tried Mono on Linux but my app doesn't work and besides I
already planned to rewrite a lot of classes (time is not a problem).

If you actually want to display the HTML form as a GUI element to the
user, then you'll have to use a third party library, or Sun's Editor Pane
(http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html)
Bewarned though that the Editor Pane doesn't handle HTML very well, and
hasn't been updated since the HTML3.2 days, I think.

If you don't need to actually display the HTML form, but just auto-fill
and submit form, best bet is to just send an HTTP request with the
appropriate GET or POST headers directly.

- Oliver
 
S

sponxe

Thanks for the replies.

In effect I just need to auto-fill and submit the form so I think I am
going to use the "GET or POST" solution.

The only problem is that I never worked directly with HTTP requests so
any suggestion (links or tutorials) is greatly appreciated...

Thanks again.

sponxe
 
S

sponxe

Ah just in case I change my mind in the future do you have suggestion
for a third party library that I could get?

Thanks

sponxe
 
O

Oliver Wong

sponxe said:
Thanks for the replies.

In effect I just need to auto-fill and submit the form so I think I am
going to use the "GET or POST" solution.

The only problem is that I never worked directly with HTTP requests so
any suggestion (links or tutorials) is greatly appreciated...

If you don't already know socket programming, read
http://java.sun.com/docs/books/tutorial/networking/index.html

Once you know socket programming, you just need to learn the HTTP
protocol. The specifications for it are called "RFCs" (Request For
Comments), so google for "HTTP RFC" to find the RFCs (there are several)
that are relevant to HTTP. However, personally, I find it difficult to learn
protocols reading only the RFCs, so you might have better luck using a
packet-sniffer and intercept the packets that a "real" webbrowser (like IE
or FireFox) send out, and just reverse engineering what's going on.

- Oliver
 
S

smbear

Oliver said:
If you don't already know socket programming, read
http://java.sun.com/docs/books/tutorial/networking/index.html

Once you know socket programming, you just need to learn the HTTP
protocol. The specifications for it are called "RFCs" (Request For
Comments), so google for "HTTP RFC" to find the RFCs (there are several)
that are relevant to HTTP. However, personally, I find it difficult to learn
protocols reading only the RFCs, so you might have better luck using a
packet-sniffer and intercept the packets that a "real" webbrowser (like IE
or FireFox) send out, and just reverse engineering what's going on.

I've had similar problem. Everything I used is BufferedReader,
InputStreamReader, URL for downloading HTML pages plus URLEncoder for
posting form entries. It seems to be good enough for HTTP GET method. I
didn't need to learn HTTP protocol.

Tomek Duda
 
M

mailfootball

Thanks for all the replies.

I will settle for the GET and POST approach to the problem and now I
have all the information to perform the op and (before that) learn more
on the subject.

Thanks again!

sponxe
 
S

sponxe

Thanks for all the replies.

I will settle for the GET and POST approach to the problem and now I
have all the information to perform the op and (before that) learn more
on the subject.

Thanks again!

sponxe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,270
Messages
2,571,102
Members
48,773
Latest member
Kaybee

Latest Threads

Top