Search in sources :

Example 1 with ServerRequestInterceptor

use of org.omg.PortableInterceptor.ServerRequestInterceptor in project Payara by payara.

the class GlassFishORBInitializer method post_init.

/**
 * This method is called during ORB initialization.
 *
 * @param info object that provides initialization attributes
 *            and operations by which interceptors are registered.
 */
@Override
public void post_init(org.omg.PortableInterceptor.ORBInitInfo info) {
    Codec codec = null;
    fineLog("J2EE Initializer post_init");
    fineLog("Creating Codec for CDR encoding");
    CodecFactory cf = info.codec_factory();
    byte major_version = 1;
    byte minor_version = 2;
    Encoding encoding = new Encoding(ENCODING_CDR_ENCAPS.value, major_version, minor_version);
    try {
        codec = cf.create_codec(encoding);
        IIOPUtils iiopUtils = IIOPUtils.getInstance();
        Collection<IIOPInterceptorFactory> interceptorFactories = iiopUtils.getAllIIOPInterceptrFactories();
        for (IIOPInterceptorFactory factory : interceptorFactories) {
            fineLog("Processing interceptor factory: {0}", factory);
            ClientRequestInterceptor clientReq = factory.createClientRequestInterceptor(info, codec);
            ServerRequestInterceptor serverReq = factory.createServerRequestInterceptor(info, codec);
            if (clientReq != null) {
                fineLog("Registering client interceptor: {0}", clientReq);
                info.add_client_request_interceptor(clientReq);
            }
            if (serverReq != null) {
                fineLog("Registering server interceptor: {0}", serverReq);
                info.add_server_request_interceptor(serverReq);
            }
        }
    } catch (Exception e) {
        if (_logger.isLoggable(Level.WARNING)) {
            _logger.log(Level.WARNING, "Exception registering interceptors", e);
        }
        throw new RuntimeException(e.getMessage(), e);
    }
}
Also used : Codec(org.omg.IOP.Codec) ClientRequestInterceptor(org.omg.PortableInterceptor.ClientRequestInterceptor) IIOPInterceptorFactory(org.glassfish.enterprise.iiop.api.IIOPInterceptorFactory) Encoding(org.omg.IOP.Encoding) CodecFactory(org.omg.IOP.CodecFactory) IIOPUtils(org.glassfish.enterprise.iiop.util.IIOPUtils) ServerRequestInterceptor(org.omg.PortableInterceptor.ServerRequestInterceptor)

Example 2 with ServerRequestInterceptor

use of org.omg.PortableInterceptor.ServerRequestInterceptor in project Payara by payara.

the class SecurityIIOPInterceptorFactory method createServerRequestInterceptor.

@Override
public ServerRequestInterceptor createServerRequestInterceptor(ORBInitInfo info, Codec codec) {
    ServerRequestInterceptor ret = null;
    try {
        if (!penv.getProcessType().isServer()) {
            return null;
        }
        if (altSecFactory != null || (interceptorFactory != null && createAlternateSecurityInterceptorFactory())) {
            ret = altSecFactory.getServerRequestInterceptor(codec);
        } else {
            ret = getServerInterceptorInstance(codec);
        }
        // also register the IOR Interceptor here
        if (info instanceof com.sun.corba.ee.spi.legacy.interceptor.ORBInitInfoExt) {
            com.sun.corba.ee.spi.legacy.interceptor.ORBInitInfoExt infoExt = (com.sun.corba.ee.spi.legacy.interceptor.ORBInitInfoExt) info;
            IORInterceptor secIOR = getSecIORInterceptorInstance(codec, infoExt.getORB());
            info.add_ior_interceptor(secIOR);
        }
    } catch (DuplicateName ex) {
        _logger.log(Level.SEVERE, null, ex);
        throw new RuntimeException(ex);
    }
    return ret;
}
Also used : DuplicateName(org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName) ServerRequestInterceptor(org.omg.PortableInterceptor.ServerRequestInterceptor) IORInterceptor(org.omg.PortableInterceptor.IORInterceptor)

Aggregations

ServerRequestInterceptor (org.omg.PortableInterceptor.ServerRequestInterceptor)2 IIOPInterceptorFactory (org.glassfish.enterprise.iiop.api.IIOPInterceptorFactory)1 IIOPUtils (org.glassfish.enterprise.iiop.util.IIOPUtils)1 Codec (org.omg.IOP.Codec)1 CodecFactory (org.omg.IOP.CodecFactory)1 Encoding (org.omg.IOP.Encoding)1 ClientRequestInterceptor (org.omg.PortableInterceptor.ClientRequestInterceptor)1 IORInterceptor (org.omg.PortableInterceptor.IORInterceptor)1 DuplicateName (org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName)1