add case-ognl-practise-cn

pull/1746/head^2
hengyunabc
parent 1a809d2a96
commit 5c606a62f3

@ -0,0 +1,25 @@
# Katacoda Hello World
This is an example repository. Starting building your own scenario by editing the files in this directory. Create additional scenarios by adding additional directories to the top level folder.
## index.json
The file _index.json_ contains all the information about the scenario. It has the title, description and a heading for each step.
The file also contains an imageid. This refers to the Katacoda environment. Here are some environment image IDs you may find useful:
| **Environment** | **Image ID** |
|------------------|---------------|
| Docker | docker |
| Kubernetes | kubernetes |
| CoreOS | coreos |
| Node.js v6 | node6 |
| Go | go |
| C# | c# |
| Java | java8 |
| Bash | bash |
## Pro Author Accounts
Interested in metrics, private repositories and environments for classroom teaching? Update to become a Pro Author at https://katacoda.com/teach
## Interactive Developer Portals
Want to take your scenarios to the next level? Visit https://katacoda.com/embed

@ -0,0 +1,20 @@
我们演示如何调试Arthas的`ognl`表达式。如果有更多的技巧或者使用疑问欢迎在Issue里提出。
更多参考:
* 特殊用法请参考:[https://github.com/alibaba/arthas/issues/71](https://github.com/alibaba/arthas/issues/71)
* OGNL表达式官网[https://commons.apache.org/proper/commons-ognl/language-guide.html](https://commons.apache.org/proper/commons-ognl/language-guide.html)
---
* Issues: https://github.com/alibaba/arthas/issues
* 文档: https://arthas.aliyun.com/doc
如果您在使用Arthas请让我们知道。您的使用对我们非常重要[查看](https://github.com/alibaba/arthas/issues/111)
欢迎关注公众号获取Arthas项目的信息、源码分析、案例实践。
![Arthas公众号](/arthas/scenarios/common-resources/assets/qrcode_gongzhonghao.jpg)

@ -0,0 +1,32 @@
{
"noindex": true,
"title": "调试 Arthas 的 ognl 表达式",
"description": "调试 Arthas 的 ognl 表达式",
"details": {
"steps": [
{
"text": "step1.md",
"code": "setup.sh"
}
],
"intro": {
"text": "intro.md",
"credits": ""
},
"finish": {
"text": "finish.md"
}
},
"files": [
],
"environment": {
"hidefinish": true,
"hideHiddenFiles": true,
"uilayout": "editor-terminal",
"uisettings": "javascript",
"uieditorpath": "/root/example/ognl-demo"
},
"backend": {
"imageid": "openjdk:15"
}
}

@ -0,0 +1,9 @@
![Arthas](https://arthas.aliyun.com/doc/_images/arthas.png)
`Arthas` 是Alibaba开源的Java诊断工具深受开发者喜爱。在线排查问题无需重启动态跟踪Java代码实时监控JVM状态。
本教程会以一个简单的应用为例,演示如果调试`ognl`表达式。
* Github: https://github.com/alibaba/arthas
* 文档: https://arthas.aliyun.com/doc/

@ -0,0 +1 @@
mkdir -p example; cd example/; git clone https://github.com/hengyunabc/ognl-demo.git ; cd ognl-demo

@ -0,0 +1,41 @@
演示Arthas里`watch`命令中`ognl`表达式的工作流程。用户可以自己修改`Demo.java`里的表达式,再执行验证。
项目地址: https://github.com/hengyunabc/ognl-demo
# 打开Demo.java文件
`src/main/java/com/example/ognl/Demo.java`{{open}}
# 编译运行代码
`mvn compile exec:java`{{execute}}
代码里的表达式:
```java
String watchExpress = "{target, params, returnObj, #cost}";
String conditionExpress = "params[0] > 1 && #cost > 0.1";
```
结果类似下面的表达式:
```bash
watch com.example.ognl.TestService test "{target, params, returnObj, #cost}" "params[0] > 1 && #cost > 0.1" -x 3
```
# 查看函数抛出异常时的表达式结果
`mvn compile exec:java -DexceptionCase=true`{{execute}}
代码里的表达式:
```java
String watchExpress = "{target, params, throwExp}";
String conditionExpress = "params[0] > 1";
```
结果类似下面的表达式:
```bash
watch com.example.ognl.TestService test "{target, params, throwExp}" "params[0] > 1" -e -x 2
```
Loading…
Cancel
Save