Flowable 6.6.0 BPMN使用者指南-(1)入門 - 1.4.1 設定REST應用程式

月滿閒庭發表於2020-12-26

1.4 開始使用Flowable REST API

This section shows the same example as the previous section: deploying a process definition, starting a process instance, getting a task list and completing a task. If you haven’t read that section, it might be good to skim through it to get an idea of what is done there.
This time, the Flowable REST API is used rather than the Java API. You’ll soon notice that the REST API closely matches the Java API, and knowing one automatically means that you can find your way around the other.
To get a full, detailed overview of the Flowable REST API, check out the REST API chapter.

本節展示了與上一節相同的示例:部署流程定義、啟動流程例項、獲取任務列表和完成任務。如果你還沒讀過那一節,不妨瀏覽一下,瞭解一下那裡做了些什麼。
這一次,使用的是Flowable REST API,而不是Java API。您很快就會注意到REST API與Java API非常匹配,知道其中一種API的方法就意味著您可以找到另一種API的方法。
要獲取完整、詳細的Flowable REST API的概述,請參閱REST API一章( REST API chapter)。

1.4.1 設定REST應用程式

When you download the .zip file from the flowable.org website, the REST application can be found in the wars folder. You’ll need a servlet container, such as Tomcat, Jetty, and so on, to run the WAR file.
When using Tomcat the steps are as follows:

當您從flowable.org網站上下載.zip檔案時,可以在wars資料夾中找到REST應用程式。您還需要一個servlet容器來執行WAR檔案,例如Tomcat、Jetty等。

使用Tomcat時,步驟如下:

  • Download and unzip the latest and greatest Tomcat zip file (choose the ‘Core’ distribution from the Tomcat website).

  • Copy the flowable-rest.war file from the wars folder of the unzipped Flowable distribution to the webapps folder of the unzipped Tomcat folder.

  • On the command line, go to the bin folder of the Tomcat folder.

  • Execute ‘./catalina run’ to boot up the Tomcat server.

  • 下載並解壓最新和最好的Tomcat zip檔案(從Tomcat網站選擇“Core”發行版(distribution)。

  • 從解壓後的Flowable發行版的wars資料夾拷貝flowable-rest.war到解壓後的Tomcat資料夾的webapps資料夾。

  • 在命令列中,轉到Tomcat的bin資料夾。

  • 執行’./catalina run’以啟動Tomcat伺服器。

During the server boot up, you’ll notice some Flowable logging messages passing by. At the end, a message like ‘INFO [main] org.apache.catalina.startup.Catalina.start Server startup in xyz ms’ indicates that the server is ready to receive requests. Note that by default an in-memory H2 database instance is used, which means that data won’t survive a server restart.

在伺服器啟動期間,您會注意到一些Flowable的日誌資訊閃過。最後,會有一條類似“INFO [main] org.apache.catalina.startup.Catalina.start Server startup in xyz ms”的資訊,表示伺服器已準備好接收請求。注意,預設情況下使用H2記憶體資料庫例項,這意味著資料在伺服器重新啟動後將不在存在。

In the following sections, we’ll use cURL to demonstrate the various REST calls. All REST calls are by default protected with basic authentication. The user ‘rest-admin’ with password ‘test’ is used in all calls.
After boot up, verify the application is running correctly by executing

後續章節中,我們將使用cURL來演示各種REST呼叫。預設情況下,所有REST呼叫都得到基本身份驗證(basic authentication)的預設保護。所有呼叫採用使用者’rest-admin’和密碼’test’。
啟動後,通過執行以下命令來驗證應用程式是否正確執行:

curl --user rest-admin:test http://localhost:8080/flowable-rest/service/management/engine

If you get back a proper json response, the REST API is up and running.
如果您得到正確的json響應,REST API就已啟動並執行。

相關文章