cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti REST development issues

manusoftar
Champ in-the-making
Champ in-the-making
First of all i apologize for my english but it is not my first language, being said that ill go to the point now.

We are trying to use Activiti-REST to develop our tickets system (between other things) but right now we are stucked trying to actually be able to consume the REST service because we are facing CORS problems.

We are using GlassFish Server because the company was already using it and don't want to switch to another web server just for this app.

The thing is that GlassFish runs Activiti-Rest on  http://localhost:8080 or https://localhost:8181 and the web page that should consume it on http://localhost:8383 so even though the domain is the same -> localhost, the mere fact that the server listens on different ports fires the CORS exception (to call it somehow).

After doing some research we found that the REST Api should implement a ContainerResponseFilter that will return the needed headers to allow cross domain ajax calls…

We tried adding the class ourselves and also updating the web.xml but it doesn't work, either it rises an exception at deployment time that it doesn't find a root resource package or it just wont do a thing if the @Path annotattion is written ot that class.

Also we tried to compile the sources from your github to make our own activiti-rest.war but it compiles to jar (the activiti-rest module) the master project Activiti, is set to packaging pom…

We really need some help from you people we are totally stucked at this point, we even tried using a proxy within GlassFish but since the services are running on the SAME domain but different ports it doesn't seem to work at all whatsoever.

Thanks in advance for any help you can give us.

Carlos Manuel Fernandez Ravelli.-
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
Indeed, CORS is about domain + port

Haven't done it on Glassfish, but on Tomcat I had success in the past using https://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#CORS_Filter_and_HttpServletRequest_attri...

Another solution, is adding a proxy in front of the rest server and the UI. You can then do something like
- localhost:1234 is the proxy address
- localhost:1234/ui -> localhost:8383
- localhost:1234/rest -> localhost:8080

I've used Apache for that in the past with success.