ExternalResource with method post

Hi everybody !

Is this possible to use ExternalResource and send data by Post method.
Actually I’m using get method to build the url :

String url = base+"?var1="+value1...;
getApplication().getMainWindow().open(new ExternalResource(url));

If someone have an idea it will be great !
Thanks in advance.

Delphin.

You could try
the FormSender addon
. And let me know if you have any problems with it, haven’t tested it in a while.

It doesn’t work, i’m not redirected to the target url.

I tested the addon with Vaadin 6.6.4, and it at least seemed to work ok. Could you post the code you are using to construct the POST? And did you remember to recompile your widgetset?

Hi,
I am new here.

I want to send data from VAADIN UI to the spring security checker with something like this:

FormSender sender = new FormSender();
sender.setFormTarget(“/appPath/j_spring_security_check”);
sender.addValue(“j_username”, userData.getUsername());
sender.addValue(“j_password”, userData.getPassword());
sender.submit();

It is probably obvious but “submit” does not redirect me to the specified formTarget. Could you please post here an example of how to use FormSender?

Sure! And sorry for the late reply. You can view the demo at
http://risto.virtuallypreinstalled.com/formsender/app
and the source of that demo at
http://dev.vaadin.com/browser/incubator/formsender/src/org/vaadin/risto/formsender/FormsenderApplication.java
.

If you’re having troubles, please remember that the FormSender is a client-side component, so you’ll need to
compile your widgetset
.

Great, thank you. I will play with it.

Hello,

I have tried to use the FormSender but it does not seem to work.
I have a conformation dialog box in whose button click event I execute:


FormSender formSender = new FormSender();
formSender.setFormMethod(FormSender.Method.POST);
Map<String, String> parameters = baseURLData(userId, moduleId, appId, accessLevel);
for (Iterator it = parameters.keySet().iterator(); it.hasNext():wink: {
String key = (String) it.next();
if (! key.equals(Parameters.url.toString())) // just the parameters, not the base URL
{
String value = parameters.get(key);
formSender.addValue( key, value );
}
}
url = parameters.get( Parameters.url.toString() );
formSender.submit();

where url is

http://localhost:8080/manutencao_1/module1

I have also tried:

formSender.setFormTarget( “localhost:8080/manutencao_1/module1” );

and

formSender.setFormTarget( “/manutencao_1/module1” );

But noting works. Note that I know the url is correct because I can test it directly on the browser.
I also set breakpoints in the code and the init() and handleParameters() methods are not
invoked so it seems that HTTP is not even executed.

Can anyone see what is wrong? How can I diagnose this further?

TIA,
Hugo Ferreira.

Neglected to mention the following. I have 2 applications.
In application 1 I create and use the FormSender.
The URL I use is the url of another application, application 2.
I am also only interested in sending data, not redirecting the
application. Is this possible with FormSender?

TIA

You could either use
FireBug
to track if the client-side is making the HTTP-request to your second application, or use the
debug mode
to view if the client-side actually has the correct implementation (in other words, if you have recompiled the widgetset).

Thanks for the head-up Risto.

I did try using the debug mode, but could not see anything.
BTW, I am using the Eclipse plug-in and the it did compile the widget.
Have to look closer at the debug output.

No solution to this? I really need to POST data and be redirected to the target… how to do it?

Hi.

The FormSender add-on should do the trick. If you’re having problems, you could start by looking at the sample application at
GitHub
and checking if that works for you, and editing from there.

Hi,

I want to submit a url in new window using form-sender. please help regarding this.

Hi,

Is it possible to set post parameters to embedded url in vaadin using FormSender without being redirected to the target url.

how to call dopost method from vaadin application?
BrowserWindowOpener component always call doGet() of servlet. I want to call dopost method so that parameter is not shown at the browser addressbar if I redirect to another url. Will it be ok to use Form Sender add-on??.. If it is ok, then How to use it?.. Please reply soon…

@Sukanta Gain :

FormSender formSender;
formSender = new FormSender();
formSender.setFormMethod(Method.POST);
formSender.setFormAction(url);
formSender.setFormTarget(“_blank”);
formSender.extend(UI.getCurrent());
formSender.addValue(parameter1 name, parameter1 value);
formSender.addValue(parameter2 name, parameter2 value);
formSender.submit();

Hope this answers your question.

I am having issues with FormSender Add on.
I am able to succesfully compile the widgetset and I see the output in \src\main\webapp\VAADIN\widgetsets.
I see the compiled files in my war as well.

However still when I run the application which has the FormSender add-on I get the error :

Widgetset does not contain implementation for org.vaadin.risto.formsender.FormSender. Check its component connector’s @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.

Any ideas where it would be going wrong

@Sneha : Have you have specified the widgetset.gwt.xml path in web.xml file ?

Yes I have specified widgetset.gwt.xml in the web.xml


Application widgetset
widgetset
com.widgetset.CustomWidgetset

1

And this is the contents of the CustomWidgetset.gwt.xml

<?xml version="1.0" encoding="UTF-8"?>