Re: RequestBuilder + POST + multipart/form-data

2008-10-23 Thread Lothar Kimmeringer

Alex Rice schrieb:
 Can anyone confirm whether RequestBuilder actually works for POSTs
 setRequestData() and with multipart/form-data content type?

I can't confirm it for RequestBuilder, but can do it for
FormPanel, because there are constants that can be used to
set the encoding to mulitpart/form-data.

So you should give it a try, use the widget instead or
do the request on the server-side inside a RemoteServiceServlet.
There are a couple of examples out there using FormPanel
especially when the topic is upload a file using GWT where
this panel is in general used.


Regards, Lothar

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: RequestBuilder + POST + multipart/form-data

2008-10-23 Thread Alex Rice

(sorry if this double posts- I think I messed up my last reply)

On Oct 23, 4:40 am, Thomas Broyer [EMAIL PROTECTED] wrote:
 The best advice I could give you is to use application/x-www-form-
 urlencoded with your Alfresco Web Script ;-)

Thomas, thanks for your insights into Alfresco, and pointing out the
problems with my code!  I am trying x-www-form-urlencoded data now
with Alfresco 2.1.6E - Tomcat, but can't get it to work- no data
appears in args and argsM. Is this how you are doing it? This seems
like it would be easier than messing with multipart , for sure.

String jsonUrlEncodedStr = json=+
URL.encodeComponent(json.toString());
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url);
rb.setRequestData(jsonUrlEncodedStr);
rb.setHeader(Content-Type, application/x-www-form-urlencoded
data);
rb.setCallback(new RequestCallback()...);
rb.send();

BTW when I append guest=true to my url, then that appears in args and
argM, which I actually need do for both GET and POST submissions to my
webscripts.

Thanks again

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: RequestBuilder + POST + multipart/form-data

2008-10-23 Thread Alex Rice

On Oct 23, 4:40 am, Thomas Broyer [EMAIL PROTECTED] wrote:

 The best advice I could give you is to use application/x-www-form-
 urlencoded with your Alfresco Web Script ;-)

Thomas, thanks for pointing out my code errors, and your valuable
insights about Alfresco! I would like to use x-www-form-urlencoded
data, and not muck about with multipart encoding, but can't seem to
get it to work. Running Alfresco 2.1.6 w/ Tomcat. I think
RequestBuilder.GET is working fine, POST is the problem.

Is this how you are doing it? In GWT:

RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url);
String jsonUrlEncodedStr = json=+
URL.encodeComponent(json.toString());
rb.setRequestData(jsonUrlEncodedStr);
rb.setHeader(Content-Type, application/x-www-form-urlencoded
data);
rb.setCallback(new RequestCallback()... );
rb.send();

In Alfresco web script:

var sResult = ;
for (arg in args)
sResult += arg + = + args[arg] + br/;

for (arg in argsM)
{
  for each (val in argsM[arg])
 sResult += arg + = + val + br/;
}
model.response = sResult;

What I get back from Alfresco is empty, unless I append guest=true to
my URL, which is actually needed for both GET and POST because I am
running web scripts with guest authentication. In that case I do see
guest=true in args and argsM.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---