mirror of https://github.com/alibaba/arthas.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.5 KiB
Plaintext
60 lines
1.5 KiB
Plaintext
ognl
|
|
===
|
|
|
|
> Execute ognl expression.
|
|
|
|
Since 3.0.5.
|
|
|
|
### Parameters
|
|
|
|
|Name|Specification|
|
|
|---:|:---|
|
|
|*express*|expression to be executed|
|
|
|`[c:]`| The hashcode of the ClassLoader that executes the expression, default ClassLoader is SystemClassLoader. |
|
|
|[x]|Expand level of object (1 by default).|
|
|
|
|
|
|
### Usage
|
|
|
|
* [Special usages](https://github.com/alibaba/arthas/issues/71)
|
|
* [OGNL official guide](https://commons.apache.org/proper/commons-ognl/language-guide.html)
|
|
|
|
Call static method:
|
|
|
|
```bash
|
|
$ ognl '@java.lang.System@out.println("hello")'
|
|
null
|
|
```
|
|
|
|
Get static field:
|
|
|
|
```bash
|
|
$ ognl '@demo.MathGame@random'
|
|
@Random[
|
|
serialVersionUID=@Long[3905348978240129619],
|
|
seed=@AtomicLong[125451474443703],
|
|
multiplier=@Long[25214903917],
|
|
addend=@Long[11],
|
|
mask=@Long[281474976710655],
|
|
DOUBLE_UNIT=@Double[1.1102230246251565E-16],
|
|
BadBound=@String[bound must be positive],
|
|
BadRange=@String[bound must be greater than origin],
|
|
BadSize=@String[size must be non-negative],
|
|
seedUniquifier=@AtomicLong[-3282039941672302964],
|
|
nextNextGaussian=@Double[0.0],
|
|
haveNextNextGaussian=@Boolean[false],
|
|
serialPersistentFields=@ObjectStreamField[][isEmpty=false;size=3],
|
|
unsafe=@Unsafe[sun.misc.Unsafe@28ea5898],
|
|
seedOffset=@Long[24],
|
|
]
|
|
```
|
|
|
|
Execute a multi-line expression, and return a list:
|
|
|
|
```bash
|
|
$ ognl '#value1=@System@getProperty("java.home"), #value2=@System@getProperty("java.runtime.name"), {#value1, #value2}'
|
|
@ArrayList[
|
|
@String[/opt/java/8.0.181-zulu/jre],
|
|
@String[OpenJDK Runtime Environment],
|
|
]
|
|
``` |