03-21-2017 02:03 PM
Hello,
I am trying to make activiti-rest returning process variable of json type.
For this I understood I needed to add a JsonRestVariableConverter and register it in a CustomRestResponseFactory.
I use spring to configure my web application but when I try to override the RestResponseFactory, my class is not found at server startup, although it is on classpath.
<bean id="restResponseFactory" class="mycompany.activiti.rest.CustomRestResponseFactory" />
I have read a post from 2014 which says :
If you want to customise RestResponseFactory the best way is too clone the REST application and change the RestConfiguration class:
Is it still true, is there no way to configure it via Spring ?
Thank you !
Stephane
03-22-2017 02:30 PM
Stephane,
It is possible to 'overwrite' a java class, via including it in the classpath - load ordering depends on the server being used. For Tomcat, the load order is:
Search around a bit and make sure you're attempting this in the right manner; it's going to vary per server, as I said earlier - and I imagine there are some that it's not possible.
I'm not sure I would recommend this as an approach - although there are plenty of StackOverflow comments and blogs that do similar things. I'm sure it's plausible, but our resources were not able to make this work and moved on to a different method.
The only way I've personally seen this done successfully, is to remove the bean declaration of RestResponseFactory from the RestConfiguration, and establish it elsewhere - which still requires modifying the RestResponseFactory directly. I would recommend this, which is basically an endorsement of the clone+edit method.
Hope this helps,
-JEarles
03-22-2017 02:30 PM
Stephane,
It is possible to 'overwrite' a java class, via including it in the classpath - load ordering depends on the server being used. For Tomcat, the load order is:
Search around a bit and make sure you're attempting this in the right manner; it's going to vary per server, as I said earlier - and I imagine there are some that it's not possible.
I'm not sure I would recommend this as an approach - although there are plenty of StackOverflow comments and blogs that do similar things. I'm sure it's plausible, but our resources were not able to make this work and moved on to a different method.
The only way I've personally seen this done successfully, is to remove the bean declaration of RestResponseFactory from the RestConfiguration, and establish it elsewhere - which still requires modifying the RestResponseFactory directly. I would recommend this, which is basically an endorsement of the clone+edit method.
Hope this helps,
-JEarles
03-23-2017 08:54 PM
Hello Jonathan,
Thank you for the clear answer, I have done it overriding RestResponseFactory and it works fine.
Thanks !
Explore our Alfresco products with the links below. Use labels to filter content by product module.