Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
-
Konstantin
- Posts: 61
- Joined: Tue Oct 27, 2015 11:49 am
Post
by Konstantin » Wed Apr 27, 2016 3:56 pm
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 ?
-
cristi_talau
- Posts: 310
- Joined: Thu Sep 04, 2014 4:22 pm
Post
by cristi_talau » Wed Apr 27, 2016 4:26 pm
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
-
Konstantin
- Posts: 61
- Joined: Tue Oct 27, 2015 11:49 am
Post
by Konstantin » Wed Apr 27, 2016 5:01 pm
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 ?
-
cristi_talau
- Posts: 310
- Joined: Thu Sep 04, 2014 4:22 pm
Post
by cristi_talau » Fri Apr 29, 2016 2:23 pm
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