Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Problem with Mozilla and Post Requests
Problem with Mozilla and Post Requests [message #437499] Sun, 06 June 2004 12:02 Go to next message
Eclipse UserFriend
Originally posted by: hs.cybertec.at

I have successfully integrated Mozilla into my GTK/SWT application (by
the way; SWT is REALLY COOL! ).
My problem now is: I can tell the browser to open a certain URL but I
have no idea how to handle post requests and links.

Here is my code:

final Browser browser = new Browser(shell, SWT.NONE);
browser.setSize(640, 400);
browser.setUrl("http://80.78.255.19");

browser.addLocationListener(new LocationListener()
{
public void changed(LocationEvent event)
{
Elog.Elog("an event has occurred: " +
event.location);
Elog.Elog(" doit: " + event.doit);
Elog.Elog(" top: " + event.top);
/* location.setText(event.location); */
// browser.setUrl(event.location);
}
public void changing(LocationEvent event)
{
Elog.Elog("an event has occurred 2: " +
event.location);
Elog.Elog(" doit: " +
event.doit);
Elog.Elog(" top: " + event.top);
browser.setUrl(event.location);
}
});

Button quit = new Button(shell, SWT.PUSH);
quit.setSize(100, 50);
quit.setText("Quit");
quit.setLocation(50, 420);
quit.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
Elog.Elog("Calling quit");
shell.dispose();
}
});



The problem now is ...


[Jun 6, 2004 2:00:32 PM] - 0 - NOTICE: The Administration interface will
be started
[Jun 6, 2004 2:00:34 PM] - 0 - NOTICE: an event has occurred:
http://80.78.255.19/
[Jun 6, 2004 2:00:34 PM] - 0 - NOTICE: doit: false
[Jun 6, 2004 2:00:34 PM] - 0 - NOTICE: top: true

[Jun 6, 2004 2:00:39 PM] - 0 - NOTICE: an event has occurred 2:
javascript:fSubmit('1','de')
[Jun 6, 2004 2:00:39 PM] - 0 - NOTICE: doit: true
[Jun 6, 2004 2:00:39 PM] - 0 - NOTICE: top: false
[Jun 6, 2004 2:00:39 PM] - 0 - NOTICE: an event has occurred 2:
javascript:fSubmit('1','de')
[Jun 6, 2004 2:00:39 PM] - 0 - NOTICE: doit: true
[Jun 6, 2004 2:00:39 PM] - 0 - NOTICE: top: false
[Jun 6, 2004 2:00:39 PM] - 0 - NOTICE: an event has occurred 2:
javascript:fSubmit('1','de')
[Jun 6, 2004 2:00:39 PM] - 0 - NOTICE: doit: true
[Jun 6, 2004 2:00:39 PM] - 0 - NOTICE: top: false
[Jun 6, 2004 2:00:39 PM] - 0 - NOTICE: an event has occurred 2:
javascript:fSubmit('1','de')
[Jun 6, 2004 2:00:39 PM] - 0 - NOTICE: doit: true
[Jun 6, 2004 2:00:39 PM] - 0 - NOTICE: top: false


An endless loop is started. As you can see the script function is said
to be the target of my click (I am hitting a link which is supposed to
call a JScript function).
How can I solve my problem and how can I make this (= navigation and
submit) work?

Best regards,

Hans
Re: Problem with Mozilla and Post Requests [message #437576 is a reply to message #437499] Mon, 07 June 2004 21:19 Go to previous message
Christophe Cornu is currently offline Christophe CornuFriend
Messages: 304
Registered: July 2009
Senior Member
Hi Hans-Juergen,

> by the way SWT is REALLY COOL!
:-)

> My problem now is:
The Browser takes care of the links within itself. You usually don't have
to worry about the LocationListener. In your code below, if I remove the
LocationListener code, the app seems to correctly connect to the website.

LocationListener is typically used in two situations.
1. To update the Location text entry in a browser app - using
LocationListener.changed when event.top is true
2. To filter/redirect to another browser/trigger an SWT UI action in
response to a URL navigation request. Use LocationListener.changing.
Determine if Event.location refers to the URL pattern you are interested
in. Set Event.doit to false to block the current request from being
further processed. And do your own action. If you do nothing, the URL will
be loaded (event.doit should be true by default).

Hope this helps,
Chris
Previous Topic:Using the Browser widget
Next Topic:Question about Swing and SWT
Goto Forum:
  


Current Time: Thu Apr 25 07:49:51 GMT 2024

Powered by FUDForum. Page generated in 0.03001 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top