How to use Spring Boot Activity Rest api in Activity App Ui - java

I am new to Activity process. I want to used the Activity with spring boot application. So, I want to used the rest api in spring boot and that rest api will be used by activiti-admin.war and activiti-app.war.
So, when I have deployed process from spring boot that will be available in UI and add some Listener while assigning task will be called in my spring boot app.
Can any one help.
Thanks in advance.

It sounds like you are using the version 6 Activiti build.
Both the activiti-app and admin-app already use "a" REST API to communicate to the backend, however it is not the community REST API that will be deployed with your Spring boot application (I assume you are using the Activiti spring boot starter rest).
It is not actually going to be trivial to separate the activiti-app and admin-app UI from the service layer as they are quite tightly coupled, but it is certainly possible.
While I haven't actually attempted it, it may be easiest to take the activiti-app build module (activiti-ui/activiti-app) and separate the client and server portions since the client is now a regular AngularJS application.
Is this what you are looking for?
Thanks,
Greg

I hope you are looking for something like this. It seems they are planning to support activiti app with your own spring boot application in Activiti 7.
If you are able to solve the case, please help with the sample structure. I am bit stuck with same usecase.

Related

Java Spring Boot MVC and CLI API in the same project

Java Spring Boot MVC and CLI API in the same project
I have implemented a web app using Spring Boot MVC and I now I need to add an API whose functions can be called from a cronjob.
I would like to use Entity and Repository classes implemented in my Web app. I was thinking about creating a new main class which implements
CommandLineRunner interface and then create separate JARS for Web and CLI applications and run them independently. Is this a good approach?
Do you have any suggestion about the architecture?
Thanks
Concur with comment from #jb-nizet - cron is really just another client of your application, and using a (bash,etc.) script wrapping curl, httpie, or wget to call the controller is a good solution.
Advantages include:
can be called remotely
doesn't add complexity to the application
application boundary/interface remains the same
doesn't add a new application (except a relatively trivial script)
not tied to cron - could be almost any other application
Considerations:
authentication (if needed) and the management of credentials in the script/cron
if all methods/actions needed for cron are new and different to existing functions in the web app, do they make sense to be encoded in the webapp?

Adding spring mvc to a spring java "desktop" application

I have a Java desktop application which uses spring framework and I need to replace the Swing UI with a web front end. I understand that I will need to adapt many things to make things work with the MVC architecture.
My concrete question is the following:
Will my application now have to run entirely in the application server?
I would appreciate if anyone could point me to some documentation that goes through a similar process.
Thanks!
Technically yes, but Spring Boot makes it trivial to set up an embedded servlet container and package your entire application as a runnable jar. This is how we're deploying our applications to production; the only thing we need is a JRE on the server VM, and java -jar takes care of all of it.
I recommend using Maven with the Spring Boot plugin (there's also a Gradle plugin) with the repackage goal, and using the lightweight Undertow servlet engine instead of the default Tomcat.

Self contained jar with Camel and Web Interface?

I have had lots of trobule trying to get my head around how to solve this scenario:
We have an integration application that uses Camel for integration. This application also has a REST Api that exposes some services providing information about the application, for instance listing the active routes etc.
I have created a user interface for this using AngularJS that connects to these rest services. My main problem is how can I package this application as a self contained jar-file that provides the user interface and all the camel integration.
My working theory: Use a separate Jetty server to serve the Angular JS files and let Camel expose the REST services. The problem with this is CORS since the REST services reside on another port than the jetty server serving the Web UI.
Some requirements for the solution:
Must be a single self contained jar-file.
The camel integration is the main purpose, the Web UI is secondary
and only used for trouble shooting. No need for a high performance
web container since the Web ui is used by only a handful of users.
I have been struggling with this for a couple of days now and it feels like I am over complicating the solution. Help on how to solve this is greatly appreciated.
You could take a look at hawtio
http://hawt.io/
as that is how we do that, hawtio is a web console for java, and has plugins for Camel. Its built using angularjs, and uses REST to communicate with the local or remote Java JVMs. To make the REST calls easier we use Jolokia.
Jolokia requires an agent to be embedded in the JVM, eg where Camel runs. Then that helps with CORS et all. http://jolokia.org/reference/html/security.html#d0e2490

Where is Spring 3 MVC in REST web-app example download?

I saw springsource.org had not spring 3 in rest web-app sample,where is download?
All Spring samples are on the official SVN repository. The MVC Showcase application should get you started on REST web applications with spring mvc:
svn co https://src.springframework.org/svn/spring-samples/mvc-showcase/ mvc-showcase
If you want to work on the client side, Spring provides RestTemplates for accessing other rest services from your application.
If you use maven you can simply add it to your pom. If not, you can manually download whichever sub-project you need from here.
I haven't found any rest example with spring MVC 3. The #SessionAttributes annotation breaks REST idea.
vn co https://src.springframework.org/svn/spring-samples/mvc-showcase/ mvc-showcase
It's not rest application cause it uses #SessiontAttributes annotation. But REAST requires transfer state via URL
They are now only on github afaik :
https://github.com/SpringSource/spring-mvc-showcase

Restlet vs Spring MVC for Restful web service

I'm researching how best to create a Restful web service on Google app engine. My end goal is to have an Android application call a web service on GAE to post and get data. At this point I not sure what the best approach is.
What I know at this point is Spring MVC 3 provide the ability to create web service but it does not provide a full implementation of JAX-RS. I also have read a few blog that talk about how Spring and Restlet can be integrated together. On the other side I have read that I could only use Restlet in GAE. I would also like provide a light web interface for users to view their posted data
So my questions are the following.
1. Should I just use Restlet.
2. Should I just use Spring MVC to provide my Restful web service.
3. Should I use Spring and Restlet together.
At this point I think I should invest my time in Restlet because that seems to be the best approach for calling web services in Android. I'm also debating if Spring MVC is just over kill.
Any thoughts would be helpful.
Have a look at the following similar questions:
Easiest frameworks to implement Java REST web services and Can anyone recommend a Java web framework that is based on MVC and supports REST?
I recently set up RESTlet on GAE and it was an absolute breeze! There are docs outlining the procedure on the RESTlet website and I was up and running RESTlet on GAE using the Google datastore within two hours.
The major downside is that performance of the Google data store for low volume apps is atrocious. Timeouts are not uncommon. (Google mandates a maximum 30 second request time and your app can easily take up half of that in coming out of hibernation if it hasn't been accessed recently)
Right now I am building another RESTful app and chose to go the Spring 3 MVC / Hibernate / MYSQL route. I am not new to Spring DI or MySQL, but I am new to Spring MVC and it is taking me days to work through all the issues I am encountering. I am disappointed in the quality of available documentation and I have not been able to find a reasonable and complete Spring 3 MVC RESTful CRUD tutorial anywhere. Argh.
I don't have experience with Restlet but Spring MVC 3.0 is quite powerful for building restful webservice AND webapps. So if you also plan for your service to be accessible through browsers then it is a great solution since your controllers can serve both apps and browsers.
Perhaps this is also possible with Restlet but I have not heard of its capabilities for building webapps.
Just beware that Spring has a high loading time. This means that you have to be careful to avoid slow responses from cold starts.

Categories