Go to new doc!

+49 228 5552576-0


Interceptor Configuration

Interceptors are the building blocks of the Membrane Service Proxy. This article shows the different ways how you can set up and configure an interceptor with the Membrane Service Proxy. To find out how they work, refer to Interceptors.

The Configuration File proxies.xml

The Service Proxy uses the Spring Framework to build up its object hierarchy at startup. The object hierarchy is defined in the spring configuration provided in the proxies.xml file. The interceptors are part of that object hierarchy. So to configure interceptors you have to know something about spring configurations.

Editing the Configuration File

Using the an editor which supports XML Schema editing to edit the proxies.xml file, you will automatically get documentation tooltips, auto-completion and error detection.

The Eclipse J2EE edition includes one such editor:

The content of the expandable tooltips is a relevant subset of the configuration reference here on membrane-soa.org.

Spring Configurations and Membrane's Configuration Language

There is more to know about spring configuration files than is described here. For a complete reference, visit the Spring homepage. For this tutorial we will only cover some aspects so that you are able to write basic configurations for the interceptors of Membrane Service Proxy.

Spring configuration files are XML documents. They describe an object hierarchy. The XML document structure of the configuration file reflects the structure of the object hierarchy.

In the configuration file, objects are represented by bean definitions. A bean definition is a building plan for a plain Java object. It includes a constructor or factory method reference, potentially further initialization method references, as well as parameters for all of these.

Membrane Service Proxy features its own configuration language which is embeddable within a Spring configuration file. This language simplifies Membrane's configuration. It just serves as syntactic sugar to avoid a flood of Spring syntax overhead.

For example, consinder the following example of a pure Spring configuration assembling two of Membrane's objects:

					xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

					<spring:bean id="router" class="com.predic8.membrane.core.Router">
						<spring:property name="rules">
								<spring:bean class="com.predic8.membrane.core.rules.ProxyRule">
									<spring:property name="port" value="3128" />
Listing 1: Spring Configuration

Now, to be fair, all occurences of "spring:" and ":spring" could be removed. But Membrane's language is still much briefer, especially the longer your Membrane-specific configuration becomes; even if you count the additional namespace declarations you need to activate the language:

				<spring:beans xmlns="http://membrane-soa.org/proxies/1/"
					xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
									    http://membrane-soa.org/proxies/1/ http://membrane-soa.org/schemas/proxies-1.xsd">

						<proxy port="3128" />
Listing 2: Spring Configuration using Membrane's language

Both of these versions of proxies.xml construct the same object hierarchy.

To edit the proxies.xml file while using Membrane's extension, it is highly advisable that you use an XML editor which has XML Schema autocompletion support, for example Eclipse's builtin editor.

For Membrane Service Proxy to work, the proxies.xml must define at least one router bean.