I have a FormPanel that submits 1 (or more) files to an upload servlet. I
have confirmed that the servlet is sending the expected message in the
response both on my local environment and on the deployed server. However,
when I look at those results on the deployed server, my logic is displaying
the error message instead of a success. Any help would be greatly
appreciated here.
So here is the important servlet code (commented):
....
classLogger.info(String.format("%s:Drawings submitted successfully for
quote - %s", AppController.DRAWING_SUCCESS_MSG, submission.getQuoteNumber
()));
//I see this message in my server log files
response.getWriter().format("%s:Drawings submitted successfully for quote
- %s", AppController.DRAWING_SUCCESS_MSG, submission.getQuoteNumber());
//I see this message when I inspect the response using firebug (see
screenshot below)
} catch (Exception e) {
classLogger.error(String.format("Failed to submit drawings for quote - %s",
submission.getQuoteNumber()));
classLogger.error(e);
response.getWriter().format("%s:Failed to submit drawings for quote - %s",
"fail", submission.getQuoteNumber());
} finally {
for (FileItem item : submission.getDrawingFiles()) {
if (item != null && false == item.isFormField()) {
webSession.removeUploadFile(item.getName());
}
}
response.getWriter().flush();
response.getWriter().close();
}
}
} else {
throw new ServletException("Invalid Request Received!");
}
}
When I inspect the response from the deployed server, I see the expected
message:
<https://lh3.googleusercontent.com/-eLY5HPR9QVA/VzIoCHqQc8I/AAAAAAAAJEQ/qMg0METs-gQ8qWox8bM7ECFofIu2Uad3gCLcB/s1600/success.jpg>
When I process the response message from the deployed server, it does not
appear see "success" as the first part of the string. It does when I run
the code locally but it does not when I run the code from the deployed
server. This is the code that parses/handles the response (pertinent line
has been highlighted and commented).
view.getPnlForm().addSubmitCompleteHandler(new FormPanel.
SubmitCompleteHandler() {
@Override public void onSubmitComplete(SubmitCompleteEvent event) {
AlertWindow.displayAlert((event.getResults().startsWith(AppController.
DRAWING_SUCCESS_MSG)) ? ERRORS.UPLOAD_DRAWING_SUCCESS : ERRORS.
UPLOAD_DRAWING_FAIL);
//Note that I am using the same constant to refer to the "success" string
from my appcontroller object
//When I watch
"event.getResults().startsWith(AppController.DRAWING_SUCCESS_MSG" locally,
I see it evaluates as true and shows the proper "ERROR" message constant
//However the remote server fails this check and displays the fail message
AppController.getEventBus().fireEvent(new DisplayQuoteViewEvent(quoteDTO.
getOrder().getId()));
DialogBox db = (DialogBox) view.getParent().getParent();
db.hide();
}
});
Does anyone have ANY ideas as to why I would be getting the same, expected
response from both environments but one environment is behaving
differently? I cannot figure this out. Please help!
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.