Closed Hooghof closed 3 weeks ago
These 2 examples should work now on Next.
Basically we added the following options when running java:
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
Maybe in the feature we need to add more modules.
The 2 examples work fine on next now. The next new examples give an error or an unexpected response.
name: uuid value: 7cbf5a21-0e95-4df0-80c8-34f2c56d2032
def headerName = 'uuid'
def headerValue = exchange.message.getHeader(headerName, String)
int charCount = headerValue.length()
body: 36
import groovy.json.JsonSlurper
def messageBody = request.getBody(String.class)
def slurper = new JsonSlurper()
def parsedJson = slurper.parseText(messageBody)
parsedJson.each { key, value ->
exchange.in.setHeader(key, value)
}
Invalid groovy script: 'class [B cannot be cast to class [C ([B and [C are in module java.base of loader 'bootstrap')'
Example 3: Don't know what error you exactly get, but I got '36', as expected. Did you set the input header?
"uuid"="7cbf5a21-0e95-4df0-80c8-34f2c56d2032"
If there is not input header then you will get "Invalid groovy script: 'Cannot invoke method length() on null object'"
Example 4 was an dependency issue. This script can be retested.
Concerning example 3, the frontend shows the expected body. The header ''uuid' is in the incoming message. If you call the flow, the body stays empty.
The jsonslurper (example 4) works properly now.
EXAMPLE 1
Input header
name: counter value: 0
Script
Error
EXAMPLE 2
Input body
Script
Error