Examples of Interceptor


Examples of org.apache.tomcat.Interceptor

     */
    public void removeInterceptor(Interceptor interceptor) {

  synchronized (interceptors) {
      boolean found = false;
      Interceptor temp[] = new Interceptor[interceptors.length - 1];
      for (int i = 0; i < interceptors.length; i++) {
    if (!found) {
        if (interceptors[i] == interceptor) {
      found = true;
      try {
View Full Code Here

Examples of org.apache.tuscany.core.wire.Interceptor

    /**
     * Dispatches a client request made on a proxy
     */
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        Interceptor headInterceptor = null;
        ConfigHolder holder = configuration.get(method);
        if (holder == null) {
            TargetException e = new TargetException("Operation not configured");
            e.setIdentifier(method.getName());
            throw e;
        }
        InvocationConfiguration config = holder.config;
        if (config != null) {
           headInterceptor = config.getHeadInterceptor();
        }

        TargetInvoker invoker;

        if (holder.cachedInvoker == null) {
            assert config != null;
            if(config.getTargetInvoker() == null){
                TargetException e= new TargetException("No target invoker configured for operation");
                e.setIdentifier(config.getMethod().getName());
                throw e;
            }
            if (config.getTargetInvoker().isCacheable()) {
                // clone and store the invoker locally
                holder.cachedInvoker = (TargetInvoker) config.getTargetInvoker().clone();
                invoker = holder.cachedInvoker;
            } else {
                invoker = config.getTargetInvoker();
            }
        } else {
            assert config != null;
            invoker = config.getTargetInvoker();
        }
        if (headInterceptor == null) {
            try {
                // short-circuit the dispatch and invoke the target directly
                if (config.getTargetInvoker() == null) {
                    throw new AssertionError("No target invoker [" + method.getName() + "]");
                }
                return config.getTargetInvoker().invokeTarget(args);
            } catch (InvocationTargetException e) {
                // the cause was thrown by the target so throw it
                throw e.getCause();
            }
        } else {
            Message msg = messageFactory.createMessage();
            msg.setTargetInvoker(invoker);
            msg.setBody(args);
            // dispatch the wire down the chain and get the response
            Message resp = headInterceptor.invoke(msg);

            Object body = resp.getBody();
            if (body instanceof Throwable) {
                throw (Throwable) body;
            }
View Full Code Here

Examples of org.apache.tuscany.sca.invocation.Interceptor

    public void configure() {

        InvocationChain bindingChain = endpoint.getBindingInvocationChain();

        if (wfProvider != null) {
            Interceptor interceptor = wfProvider.createInterceptor();
            if (interceptor != null) {
                bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, interceptor);
            }
        }

        if (wfResponseProvider != null) {
            Interceptor interceptor = wfResponseProvider.createInterceptor();
            if (interceptor != null) {
                bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, interceptor);
            }

        }

        if (osProvider != null) {
            Interceptor interceptor = osProvider.createInterceptor();
            if (interceptor != null) {
                bindingChain.addInterceptor(Phase.SERVICE_BINDING_OPERATION_SELECTOR, interceptor);
            }
        }
View Full Code Here

Examples of org.apache.tuscany.spi.wire.Interceptor

            }
        });
        replay(scheduler);
        WorkContext context = createMock(WorkContext.class);
        Message msg = new MessageImpl();
        Interceptor next = EasyMock.createMock(Interceptor.class);
        EasyMock.expect(next.invoke(EasyMock.eq(msg))).andReturn(msg);
        EasyMock.replay(next);
        Interceptor interceptor = new NonBlockingBridgingInterceptor(scheduler, context, next);
        interceptor.invoke(msg);
        verify(next);
    }
View Full Code Here

Examples of org.drools.core.command.Interceptor

          ((SingleSessionCommandService) commandService).
            addInterceptor(new ManualPersistInterceptor((SingleSessionCommandService) commandService));
          try {
            Class<?> clazz = Class.forName("org.jbpm.persistence.ManualPersistProcessInterceptor");
            Constructor<?> c = clazz.getConstructor(SingleSessionCommandService.class);
            Interceptor interceptor = (Interceptor) c.newInstance(commandService);
            ((SingleSessionCommandService) commandService).addInterceptor(interceptor);
          } catch (ClassNotFoundException e) {
            //Expected of non-jbpm based projects
          } catch (Exception e) {
            //something unexpected happened
View Full Code Here

Examples of org.eweb4j.mvc.interceptor.Interceptor

      cls = Class.forName(clsName);

      if (cls == null)
        return false;

      Interceptor interAnn = cls.getAnnotation(Interceptor.class);
      if (interAnn == null)
        return false;
      Uri[] uris = interAnn.uri();
      if (uris == null || uris.length == 0)
        return false;
     
      InterConfigBean inter = new InterConfigBean();
      String name = "".equals(interAnn.name()) ? cls.getSimpleName() : interAnn.name();
      inter.setName(name);
      inter.setClazz(cls.getName());
      inter.setMethod(interAnn.method());
      String[] except = interAnn.except();
      if (except != null && except.length > 0){
        List<String> list = Arrays.asList(except);
        inter.setExcept(new ArrayList<String>(list));
      }
     
      inter.setPolicy(interAnn.policy());
      inter.setType(interAnn.type());
      inter.setPriority(String.valueOf(interAnn.priority()));
      Singleton sin = cls.getAnnotation(Singleton.class);
      if (sin != null)
        inter.setScope("singleton");
      else
        inter.setScope("prototype");
View Full Code Here

Examples of org.exoplatform.container.spi.Interceptor

            if (chain == null)
            {
               List<Interceptor> staticInts = getStaticInterceptors(holder, parent);
               List<Interceptor> dynamicInts = getDynamicInterceptors(holder, parent);
               List<Interceptor> interceptors = resolve(staticInts, dynamicInts);
               Interceptor result = null;
               List<Class<? extends Interceptor>> chain = new LinkedList<Class<? extends Interceptor>>();
               StringBuilder sb = null;
               boolean isDevelopping = PropertyManager.isDevelopping();
               if (isDevelopping)
               {
                  sb = new StringBuilder();
               }
               for (int i = 0, length = interceptors.size(); i < length; i++)
               {
                  Interceptor it = interceptors.get(i);
                  it.setSuccessor(result);
                  chain.add(it.getClass());
                  if (isDevelopping)
                  {
                     sb.insert(0, "-> " + it.getClass().getName() + " ");
                  }
                  result = it;
               }
               if (isDevelopping)
               {
                  System.out.println("The interceptor chain used is " + sb); //NOSONAR
               }
               this.chain = chain;
               return result;
            }
         }
      }
      Interceptor result = null;
      for (Iterator<Class<? extends Interceptor>> iter = chain.iterator(); iter.hasNext();)
      {
         Class<? extends Interceptor> iClass = iter.next();
         try
         {
            Interceptor it = iClass.cast(iClass.newInstance());
            it.setHolder(holder);
            it.setParent(parent);
            it.setSuccessor(result);
            result = it;
         }
         catch (Exception e)
         {
            System.out.println("ERROR: Cannot instantiate inteceptor of class " + iClass + ": "
View Full Code Here

Examples of org.hibernate.Interceptor

      // Handle mappings....
      handleMappings( cfg );

      // Handle interceptor....
      Interceptor interceptorInstance = generateInterceptorInstance();
      if ( interceptorInstance != null )
      {
         cfg.setInterceptor( interceptorInstance );
      }
View Full Code Here

Examples of org.hornetq.api.core.Interceptor

      class Committer extends Thread
      {
         @Override
         public void run()
         {
            Interceptor interceptor = new DelayInterceptor3();

            try
            {
               liveServer.addInterceptor(interceptor);
View Full Code Here

Examples of org.infoglue.cms.entities.management.Interceptor

   
    List<InterceptorVO> result = new ArrayList<InterceptorVO>();
    QueryResults results = oql.execute();
    while (results.hasMore())
    {
      Interceptor interceptor = (Interceptor)results.next();
      result.add(interceptor.getValueObject());
    }

    results.close();
    oql.close();
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.