# org.omg.PortableInterceptor

***

**1. Intercepting invocation**

```java
import org.omg.PortableInterceptor.*;
import org.omg.PortableInterceptor.InterceptorOperations;
import org.omg.PortableInterceptor.Invocation;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.ExceptionList;

public class SimpleInterceptor extends InterceptorOperations {

    public String name() {
        return "SimpleInterceptor";
    }

    public void receive_request(Invocation inv) {
        System.out.println("receive_request: " + inv.operation());
    }

    public void receive_request_service_contexts(Invocation inv, ServiceContextList contexts) {
        System.out.println("receive_request_service_contexts: " + inv.operation());
    }

    public void send_request(Invocation inv) {
        System.out.println("send_request: " + inv.operation());
    }

    public void send_poll(Invocation inv) {
        System.out.println("send_poll: " + inv.operation());
    }

    public void receive_reply(Invocation inv) {
        System.out.println("receive_reply: " + inv.operation());
    }

    public void receive_exception(Invocation inv, ExceptionList exceptions) {
        System.out.println("receive_exception: " + inv.operation());
    }

    public void receive_other(Invocation inv) {
        System.out.println("receive_other: " + inv.operation());
    }

}
```

**2. Intercepting reply**

```java
import org.omg.PortableInterceptor.*;
import org.omg.PortableInterceptor.InterceptorOperations;
import org.omg.PortableInterceptor.ServerRequestInfo;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
import org.omg.CORBA.SystemException;

public class SimpleReplyInterceptor extends InterceptorOperations {

    public String name() {
        return "SimpleReplyInterceptor";
    }

    public void receive_request(ServerRequestInfo ri) {
        System.out.println("receive_request: " + ri.operation());
    }

    public void receive_reply(ServerRequestInfo ri) {
        System.out.println("receive_reply: " + ri.operation());
    }

    public void receive_exception(ServerRequestInfo ri) {
        System.out.println("receive_exception: " + ri.operation());
    }

    public void receive_other(ServerRequestInfo ri) {
        System.out.println("receive_other: " + ri.operation());
    }

}
```

**3. Intercepting exception**

```java
import org.omg.PortableInterceptor.*;
import org.omg.PortableInterceptor.InterceptorOperations;
import org.omg.PortableInterceptor.ServerRequestInfo;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
import org.omg.CORBA.SystemException;

public class SimpleExceptionInterceptor extends InterceptorOperations {

    public String name() {
        return "SimpleExceptionInterceptor";
    }

    public void receive_request(ServerRequestInfo ri) {
        System.out.println("receive_request: " + ri.operation());
    }

    public void receive_reply(ServerRequestInfo ri) {
        System.out.println("receive_reply: " + ri.operation());
    }

    public void receive_exception(ServerRequestInfo ri) {
        System.out.println("receive_exception: " + ri.operation());
    }

    public void receive_other(ServerRequestInfo ri) {
        System.out.println("receive_other: " + ri.operation());
    }

}
```

**4. Intercepting other**

```java
import org.omg.PortableInterceptor.*;
import org.omg.PortableInterceptor.InterceptorOperations;
import org.omg.PortableInterceptor.ServerRequestInfo;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
import org.omg.CORBA.SystemException;

public class SimpleOtherInterceptor extends InterceptorOperations {

    public String name() {
        return "SimpleOtherInterceptor";
    }

    public void

```
