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
Solved! Go to Solution.
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
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
Hello Jonathan,
Thank you for the clear answer, I have done it overriding RestResponseFactory and it works fine.
Thanks !
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.