Skip to content

gravitee-io/gravitee-policy-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript

Gravitee.io License Releases CircleCI

Overview

This policy lets you execute custom JavaScript scripts at any stage of request or response processing through the Gravitee gateway. It is powered by GraalJS, providing full ES6+ support, secure sandboxed execution, and modern JavaScript engine capabilities.

It replaces the legacy Nashorn-based gravitee-policy-javascript policy, which has been deprecated due to Nashorn's removal from recent JDKs. This is a new policy built from scratch — not a migration — and existing scripts may require adjustments.

Errors

These templates are defined at the API level, in the "Entrypoint" section for v4 APIs, or in "Response Templates" for v2 APIs. The error keys sent by this policy are as follows:

Key Parameters
JS_EXECUTION_FAILURE Interrupted with a 500 status. Occurs when the JavaScript script throws an error or exceeds the execution timeout.

Phases

The js policy can be applied to the following API types and flow phases.

Compatible API types

  • PROXY
  • MESSAGE

Supported flow phases:

  • Request
  • Response
  • Publish
  • Subscribe

Compatibility matrix

Strikethrough text indicates that a version is deprecated.

Plugin version APIM Java version
1.0.0 and after 4.10.x and after 21

Configuration options

Name
json name
Type
constraint
Mandatory Default Description
Override content
overrideContent
boolean Enable to override the content with the value returned by your script.
Read content
readContent
boolean Enable to read the content of the request or response in your script.
Script
script
string JavaScript script to evaluate.

Examples

Changelog

Changelog

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages