johnstok
16 Feb 2009, 7:53 AM
I am using a FormPanel to perform a file upload.
I have set the relevant properties and everything is working ok:
panel.setEncoding(FormPanel.Encoding.MULTIPART);
panel.setMethod(FormPanel.Method.POST);I have an event listener to handle the result of the form submission:
panel.addListener(
Events.Submit,
new Listener<FormEvent>() {
public void handleEvent(final FormEvent be) {
// Use be.resultHtml to report success
}
}
);However, if the upload fails I need to report an error. I would like to set the status code of the HTTP response to be 500 and provide an error report as JSON in the response body.
Does anyone know how I can check the HTTP response code from the FormEvent?
I have set the relevant properties and everything is working ok:
panel.setEncoding(FormPanel.Encoding.MULTIPART);
panel.setMethod(FormPanel.Method.POST);I have an event listener to handle the result of the form submission:
panel.addListener(
Events.Submit,
new Listener<FormEvent>() {
public void handleEvent(final FormEvent be) {
// Use be.resultHtml to report success
}
}
);However, if the upload fails I need to report an error. I would like to set the status code of the HTTP response to be 500 and provide an error report as JSON in the response body.
Does anyone know how I can check the HTTP response code from the FormEvent?