diff --git a/site/src/site/sphinx/en/http-api.md b/site/src/site/sphinx/en/http-api.md
index 247aa6137..e052ae5bb 100644
--- a/site/src/site/sphinx/en/http-api.md
+++ b/site/src/site/sphinx/en/http-api.md
@@ -26,9 +26,9 @@ http api.
```json
{
"action": "exec",
- "requestId": "req112"
- "sessionId": "94766d3c-8b39-42d3-8596-98aee3ccbefb"
- "consumerId": "955dbd1325334a84972b0f3ac19de4f7_2"
+ "requestId": "req112",
+ "sessionId": "94766d3c-8b39-42d3-8596-98aee3ccbefb",
+ "consumerId": "955dbd1325334a84972b0f3ac19de4f7_2",
"command": "version",
"execTimeout": "10000"
}
@@ -614,7 +614,48 @@ receive this `enhancer` result. It may happen that the result of
`enhancer` is successful, but there is no hit method. The client can
prompt the user according to the result of `enhancer`.
-### Others
+### Cases
+
+#### Get classpath of Java application
+
+Get system properties of the Java application through Http api and
+extract the value of `java.class.path`.
+
+```bash
+json_data=$(curl -Ss -XPOST http://localhost:8563/api -d '
+{
+ "action":"exec",
+ "command":"sysprop"
+}')
+```
+
+* Extract value with `sed`:
+
+```bash
+class_path=$(echo $json_data | tr -d '\n' | sed 's/.*"java.class.path":"\([^"]*\).*/\1/')
+echo "classpath: $class_path"
+```
+
+* Extract value with `json_pp/awk`:
+
+```bash
+class_path=$(echo $json_data | tr -d '\n' | json_pp | grep java.class.path | awk -F'"' '{ print $4 }')
+echo "classpath: $class_path"
+```
+
+Output:
+
+```
+classpath: demo-arthas-spring-boot.jar
+```
+
+NOTE:
+
+* `echo $json_data | tr -d '\n'` : Delete line breaks (the value of
+ `line.separator`) to avoid affecting the processing of `sed`/`json_pp`
+ commands.
+* `awk -F'"' '{ print $4 }'` : Use double quote as delimiter
+
#### Make watch command output a map object
diff --git a/site/src/site/sphinx/http-api.md b/site/src/site/sphinx/http-api.md
index 778785e94..8119915cb 100644
--- a/site/src/site/sphinx/http-api.md
+++ b/site/src/site/sphinx/http-api.md
@@ -20,9 +20,9 @@ Http API接口地址为:`http://ip:port/api`,必须使用POST方式提交请
```json
{
"action": "exec",
- "requestId": "req112"
- "sessionId": "94766d3c-8b39-42d3-8596-98aee3ccbefb"
- "consumerId": "955dbd1325334a84972b0f3ac19de4f7_2"
+ "requestId": "req112",
+ "sessionId": "94766d3c-8b39-42d3-8596-98aee3ccbefb",
+ "consumerId": "955dbd1325334a84972b0f3ac19de4f7_2",
"command": "version",
"execTimeout": "10000"
}
@@ -537,7 +537,47 @@ curl -Ss -XPOST http://localhost:8563/api -d '''
`trace/watch/jad/tt`等命令需要对类进行增强,会接收到这个`enhancer`结果。可能出现`enhancer`结果成功,但没有命中方法的情况,客户端可以根据`enhancer`结果提示用户。
-### 其它
+### 案例
+
+#### 获取Java应用的Classpath
+
+通过Http api查询Java应用的System properties,提取`java.class.path`的值。
+
+
+```bash
+json_data=$(curl -Ss -XPOST http://localhost:8563/api -d '
+{
+ "action":"exec",
+ "command":"sysprop"
+}')
+```
+
+* 使用`sed`提取值:
+
+```bash
+class_path=$(echo $json_data | tr -d '\n' | sed 's/.*"java.class.path":"\([^"]*\).*/\1/')
+echo "classpath: $class_path"
+```
+
+* 使用`json_pp/awk`提取值
+
+```bash
+class_path=$(echo $json_data | tr -d '\n' | json_pp | grep java.class.path | awk -F'"' '{ print $4 }')
+echo "classpath: $class_path"
+```
+
+输出内容:
+
+```
+classpath: demo-arthas-spring-boot.jar
+```
+
+注意:
+
+* `echo $json_data | tr -d '\n'` : 删除换行符(`line.separator`的值),避免影响`sed`/`json_pp`命令处理。
+* `awk -F'"' '{ print $4 }'` : 使用双引号作为分隔符号
+
+
#### watch命令输出map对象
@@ -629,4 +669,6 @@ Http api 执行结果:
}
```
-可以看到watch结果的value变成map对象,程序可以通过key读取结果。
\ No newline at end of file
+可以看到watch结果的value变成map对象,程序可以通过key读取结果。
+
+