cancel
Showing results for 
Search instead for 
Did you mean: 

Where did the ActivitiRestApplication class go in 5.16.4?

mjustin
Champ in-the-making
Champ in-the-making
I just attempted to upgrade my version of activiti-common-rest in my application from 5.16.3 to 5.16.4, and I see that the org.activiti.rest.common.application.ActivitiRestApplication class no longer exists in activiti-common-rest.  We were extending the class, but using our own "AlwaysPassRestAuthenticator".

Looking at the internals of ActivitiRestServicesApplication, it doesn't look like it's doing too much, and we can certainly replicate the pieces of it that we care about.  I'm mostly wondering why it was removed, and whether replicating the functionality I want from ActivitiRestServicesApplication is the best approach.  As a side note, it looks like RestAuthenticator still exists, but is no longer used by any of the remaining Activiti code.  I wonder if that interface was also intended to be removed at the same time.
7 REPLIES 7

mjustin
Champ in-the-making
Champ in-the-making
Edit: This also applies to org.activiti.rest.service.application.ActivitiRestServicesApplication in activiti-rest.

mjustin
Champ in-the-making
Champ in-the-making
Upon further investigation into the 5.16.4 code, it looks like the way things are wired and such has been rewritten and changed in a lot of ways.  Is there documentation somewhere that says how to make use of things post-rewrite?  Specifically, what I need to be able to do to maintain feature parity with my 5.16.3 version:

  • Be able to access the REST resource without any authentication being passed in, and setting the user to a specific hardcoded user ID ("system")
  • Be able to set my servlet mapping to be under /bpm-rest. We are currently achieving this with the following web.xml fragment (where MyAppActivitiRestApplication is our custom subclass of ActivitiRestServicesApplication):
  • <servlet> 
      <servlet-name>RestletServlet</servlet-name> 
      <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
      <init-param>
        <param-name>org.restlet.application</param-name>
        <param-value>my.organization.appname.MyAppActivitiRestApplication</param-value>
      </init-param>
    </servlet>

    <servlet-mapping>
      <servlet-name>RestletServlet</servlet-name>
      <url-pattern>/bpm-rest/*</url-pattern>
    </servlet-mapping>
  • Add my own custom variable converters to the RestResponseFactory. We are currently achieving this by usng the following RestResponseFactory within our custom subclass of ActivitiRestServicesApplication:
  • public class MyAppRestResponseFactory extends RestResponseFactory {
        @Override
        protected void initializeVariableConverters() {
            super.initializeVariableConverters();
            super.variableConverters.add(new MyFirstObjectTypeConverter());
            super.variableConverters.add(new MySecondObjectTypeConverter());
        }
    }

trademak
Star Contributor
Star Contributor
This change was announced in the 5.16.4 release notes and this blogpost:

http://bpmn20inaction.blogspot.nl/2014/10/activiti-5164-released.html

We moved to Spring MVC away from Restlet.
To changed the security you can override the SecurityConfiguration implementation. The easiest way to do this is to create a new custom web application, using the activiti-webapp-rest2 module as a foundation. This project only contains the configuration of the webapp and the REST resources are imported from the activiti-rest module.

Changing the servlet mapping can be done by overriding the WebConfigurer class.

The RestResponseFactory can be defined in the RestConfiguration class.

We'll add more support for overriding the default configuration in an easier way in the 5.17 release coming up in a few weeks.

Best regards,

penusila611621
Champ in-the-making
Champ in-the-making
I have downloaded Activiti 5.17.0 and need to customize WebConfigurer  and other classes. I've tried to find jar files of these classes and no luck.

Would anybody please let me know where to find jar files of these classes and also how to override these classes.

solanki
Champ in-the-making
Champ in-the-making
The configuration classes are not in Jar .. You can find them on GITHUB -> https://github.com/Activiti/Activiti/blob/master/modules/activiti-webapp-rest2/src/main/java/org/act...

penusila611621
Champ in-the-making
Champ in-the-making
To customize the rest api's, earlier I had extended the ActivitiRestServicesApplication class and adding the my customized rest urls in the method public synchronized Restlet createInboundRoot() { CPSRestServicesInit.attachResources(router); } . I have no clue how to achieve the same in latet version through WebConfigurer class.

Anyhelp is appreciated 

jbarrez
Star Contributor
Star Contributor
The clue would be to look into Spring MVC. Resources are discovered using component scanning. if you create a resource in the same package as activiti resources and put it on the classpath, it will be found and used at runtime.