I have a servlet:
<servlet>
<servlet-name>UploadServlet</servlet-name>
<servlet-class>com.timelessmind.ttms.server.UploadServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>UploadServlet</servlet-name>
<url-pattern>/attachment</url-pattern>
</servlet-mapping>
And in the code, I have a submit FormPanel with a FileUpload:
form.setAction("/attachment");
form.setEncoding(FormPanel.ENCODING_MULTIPART);
form.setMethod(FormPanel.METHOD_POST);
And submit button:
submitButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
form.submit();
}
});
SubmitCompleteHandler:
Window.alert(event.getResults());
And the response is like:
HTTP Status 404 -
type Status report
message
description The requested resource () is not available.
The requested source is an empty bracket, which I could not figure out why?
Please check your firebug network console to see where exactly is the form submitted.
It is most certainly submitting in
http://yoururl:8080/attachmentinstead ofhttp://yoururl:8080/MyApp/attachmentTo solve your problem, try removing the slash at the beginning:
Otherwise, add your application context: