Concept for custom java interaction
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
Concept for custom java interaction
Hi,
I'm using quite some custom implementations of AuthorOperationWithResult to be called by the ActionsManager form the js code.
The documentation of ActionsManager.invokeOperation() claims that on an exception the user will see an error message. Actually this doesn't happen for me. I find the exception i nthe server log but on the client side I get error and result both as null.
So how do I more complex results to the client without parsing a string? For instance a list of objects (in my case a list of key-value-pairs) or an error message?
Thanks and regards,
Patrik
I'm using quite some custom implementations of AuthorOperationWithResult to be called by the ActionsManager form the js code.
The documentation of ActionsManager.invokeOperation() claims that on an exception the user will see an error message. Actually this doesn't happen for me. I find the exception i nthe server log but on the client side I get error and result both as null.
So how do I more complex results to the client without parsing a string? For instance a list of objects (in my case a list of key-value-pairs) or an error message?
Thanks and regards,
Patrik
-
- Posts: 496
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Concept for custom java interaction
Post by cristi_talau »
The documentation is a bit misleading the exception has to be an instance of "AuthorOpertionException" and its "isOperationRejectedOnPurpose" should return true to be displayed on the client.
Unfortunately, only strings can be passed to the client-side code. Then, as you thought you have to parse it to extract the status of the operation.
Unfortunately, only strings can be passed to the client-side code. Then, as you thought you have to parse it to extract the status of the operation.
Re: Concept for custom java interaction
Hi,
thanks. I've created my own class AuthorOperationOnPurposeException with setOperationRejectedOnPurpose(true) in the constructor and it behaves as expected.
In case anybody else has a similiar problem: I also found a comfortable way to pass my key-value-map to my JS code:
Java:
JS code:
Regards,
Patrik
thanks. I've created my own class AuthorOperationOnPurposeException with setOperationRejectedOnPurpose(true) in the constructor and it behaves as expected.
In case anybody else has a similiar problem: I also found a comfortable way to pass my key-value-map to my JS code:
Java:
Code: Select all
import org.codehaus.jackson.map.ObjectMapper;
[...]
final String result= new ObjectMapper().writeValueAsString(map.entrySet().toArray());
Code: Select all
[...]
var list = JSON.parse(result);
var length = list.length;
for (var i = 0; i < length; ++i) {
var entry = list[i];
[...]
}
Patrik
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service