+49 228 5552576-0


info@predic8.com

groovy

Description

Can be used in

spring:beans, if, proxy, registration, request, response, serviceProxy, soapProxy, stompProxy, swaggerProxy and transport

Syntax

				<groovy>[groovy script]</groovy>

Sample

				<serviceProxy port="2000">
					<request>
						<groovy>
							exc.request.header.add("X-Groovy", "Groovy interceptor")
							println "X-Groovy header added." 				
							CONTINUE
						</groovy>						
					</request>
					<target host="www.predic8.de" />		
				</serviceProxy>
Listing 1: A Groovy interceptor which adds an X-Groovy header to the request.

You can find a fully working example in %MEMBRANE_HOME%/examples/groovy.

Imports

The following imports are automatically added to your script.

        import static com.predic8.membrane.core.interceptor.Outcome.*
        import com.predic8.membrane.core.http.*
These provide access to the static members of the Outcome enum and the classes contained in the http package.

Variables

The following variables are provided by the GroovyInterceptor and can be accessed within your script.

Name Class Description
exc com.predic8.membrane.core.exchange.Exchange The Exchange class provides, among others, access to the Request, Response and their corresponding Headers.
spring org.springframework.context.ApplicationContext The Spring application context hosting the router instance (or null, if the router is not hosted by Spring).

Copyright © 2008-2015 predic8 GmbH
Moltkestr. 40, 53173 Bonn, Tel. +49 (228) 555 25 76-0