Page 1 of 1
WebApp Response Message
Posted: Wed Apr 27, 2016 3:56 pm
by Konstantin
Hello !!!
I use WebApp 18.0.0
I made Save for documents (I use servlet for saving on custom datesource site) and now I need handle different error messages.
When I spend:
Code: Select all
protected void doPut(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
resp.sendError(404, "Error message");
}
I get message:
Error saving document: 404 Not Found for: http://localhost:8888/webapp_editor?sou ... tId=111111
How can I show my messages in webapp ?
Re: WebApp Response Message
Posted: Wed Apr 27, 2016 4:26 pm
by cristi_talau
Hello,
To be sure I understand your context: you are using oXygen XML Web Author 18.0.0 (as part of the SDK) and using the "http" or "webdav" protocol to load and save document. Right?
In Web Author we currently ignore the server response on HTTP requests since sometimes it contains an entire HTML page that is not suitable to display in an error message. I registered an improvement request to display the server response if it is plain-text or just contain inline markup link <a> or <b>.
If that turns out to be a showstopper for you, we can try to find a workaround until the fix is released.
Best,
Cristian
Re: WebApp Response Message
Posted: Wed Apr 27, 2016 5:01 pm
by Konstantin
To be sure I understand your context: you are using oXygen XML Web Author 18.0.0 (as part of the SDK) and using the "http" or "webdav" protocol to load and save document. Right?
You right, we use http protocol.
We need use custom messages in response.
Could you help ?
Re: WebApp Response Message
Posted: Fri Apr 29, 2016 2:23 pm
by cristi_talau
We are going to make this change in the next version of oXygen XML Web Author.
If you want this functionality in 18.0 you will need to patch our WebDAV plugin available on GitHub [1] and install it in Web Author [2]. You will have to use
webdav-http instead of
http when passing the URL to the Web Author.
Basically you should insert a code snippet like below in the WebdavUrlConnection class [3].
Code: Select all
if (this.delegateConnection instanceof HttpURLConnection) {
InputStream is = ((HttpURLConnection)this.delegateConnection).getErrorStream();
String message = null;
try {
message = IOUtils.toString(is, "UTF-8");
} catch (IOException e) {
} finally {
IOUtils.closeQuietly(is);
}
if (message != null) {
throw new IOException(message, e);
}
}
Best,
Cristian
[1]
https://github.com/oxygenxml/webapp-webdav-integration
[2]
https://www.oxygenxml.com/doc/versions/ ... ugins.html
[3]
https://github.com/oxygenxml/webapp-web ... .java#L101
Re: WebApp Response Message
Posted: Mon May 02, 2016 4:56 pm
by Konstantin
Big thanks !