Examples of HandlerAdapter


Examples of ch.unifr.nio.framework.HandlerAdapter

                    }
                    for (SelectionKey key : selectedKeys) {
                        if (key.isValid()) {
                            Object attachment = key.attachment();
                            if (attachment instanceof HandlerAdapter) {
                                HandlerAdapter adapter =
                                        (HandlerAdapter) attachment;
                                // caches some states in the adapter so that
                                // they can be restored when it is done
                                adapter.cacheOps();
                                // remove all interestOps to stop further
                                // selection on channel (will be restored by the
                                // adapter when it is done)
                                key.interestOps(0);
                                // run adapter by executor
View Full Code Here

Examples of com.google.code.hs4j.network.core.impl.HandlerAdapter

  }

  @Test
  public void testAutoReconnect() throws Exception {
    TCPController server = new TCPController();
    server.setHandler(new HandlerAdapter());
    server.bind(new InetSocketAddress(7171));

    this.hsClient.shutdown();
    this.hsClient = new HSClientImpl(new InetSocketAddress(7171), 5);

    Thread.sleep(1000);
    assertEquals(5, server.getSessionSet().size());
    server.stop();
    Thread.sleep(5000);
    server = new TCPController();
    server.setHandler(new HandlerAdapter());
    server.bind(new InetSocketAddress(7171));

    Thread.sleep(10000);
    assertEquals(5, server.getSessionSet().size());
View Full Code Here

Examples of com.google.code.yanf4j.core.impl.HandlerAdapter

        Configuration configuration = new Configuration();
        configuration.setReadThreadCount(10);
        configuration.setWriteThreadCount(1);
        configuration.setDispatchMessageThreadCount(11);
        this.controller = new TCPController(configuration);
        this.controller.setHandler(new HandlerAdapter());
        Assert.assertEquals(10, this.controller.getReadThreadCount());
        Assert.assertEquals(1, this.controller.getWriteThreadCount());
        Assert.assertEquals(11, this.controller.getDispatchMessageThreadCount());

        this.controller.setReadThreadCount(0);
View Full Code Here

Examples of com.google.code.yanf4j.core.impl.HandlerAdapter


    @Test
    public void testNoCodecFactory() throws Exception {
        this.controller = new TCPController(new Configuration());
        this.controller.setHandler(new HandlerAdapter());
        Assert.assertNull(this.controller.getCodecFactory());
        this.controller.start();
        Assert.assertTrue(this.controller.getCodecFactory() instanceof ByteBufferCodecFactory);
    }
View Full Code Here

Examples of com.google.code.yanf4j.core.impl.HandlerAdapter

    TCPController controller;
    AtomicInteger sessionCounter = new AtomicInteger(0);

    public void start() {
      controller = new TCPController();
      controller.setHandler(new HandlerAdapter() {

        @Override
        public void onSessionClosed(Session session) {
          sessionCounter.decrementAndGet();
        }
View Full Code Here

Examples of com.google.code.yanf4j.core.impl.HandlerAdapter

    TCPController controller;
    AtomicInteger sessionCounter = new AtomicInteger(0);

    public void start() {
      controller = new TCPController();
      controller.setHandler(new HandlerAdapter() {

        @Override
        public void onSessionClosed(Session session) {
        }
View Full Code Here

Examples of com.google.code.yanf4j.core.impl.HandlerAdapter

    assertEquals("1.28", decodedCommand.getResult());
  }

  public MemcachedTCPSession buildSession() {
    NioSessionConfig sessionConfig = new NioSessionConfig(null,
        new HandlerAdapter(), null, new ByteBufferCodecFactory(), null,
        null, null, true, 0, 0);
    return new MemcachedTCPSession(sessionConfig, 16 * 1024, null, 0,
        new TextCommandFactory());
  }
View Full Code Here

Examples of org.springframework.web.servlet.HandlerAdapter

          noHandlerFound(processedRequest, processedResponse);
          return;
        }

        // Determine handler adapter for the current request.
        HandlerAdapter ha = getHandlerAdapter(mappedHandler.getHandler());
       
        // Widget check
        processedRequest = checkWidget(request, mappedHandler.getHandler());
        processedResponse = checkWidget(response, mappedHandler.getHandler());

                // Process last-modified header, if supported by the handler.
        String method = request.getMethod();
        boolean isGet = "GET".equals(method);
        if (isGet || "HEAD".equals(method)) {
          long lastModified = ha.getLastModified(request, mappedHandler.getHandler());
          if (logger.isDebugEnabled()) {
            String requestUri = urlPathHelper.getRequestUri(request);
            logger.debug("Last-Modified value for [" + requestUri + "] is: " + lastModified);
          }
          if (new ServletWebRequest(request, response).checkNotModified(lastModified) && isGet) {
            return;
          }
        }

        // Apply preHandle methods of registered interceptors.
        HandlerInterceptor[] interceptors = mappedHandler.getInterceptors();
        if (interceptors != null) {
          for (int i = 0; i < interceptors.length; i++) {
            HandlerInterceptor interceptor = interceptors[i];
            if (!interceptor.preHandle(processedRequest, processedResponse, mappedHandler.getHandler())) {
              triggerAfterCompletion(mappedHandler, interceptorIndex, processedRequest, response, null);
              return;
            }
            interceptorIndex = i;
          }
        }

        // Actually invoke the handler.
        mv = ha.handle(processedRequest, response, mappedHandler.getHandler());

        // Do we need view name translation?
        if (mv != null && !mv.hasView()) {
          mv.setViewName(getDefaultViewName(request));
        }
View Full Code Here

Examples of org.springframework.web.servlet.HandlerAdapter

        if (log.isDebugEnabled())
        {
            log.debug("handler is " + handler);
        }

        HandlerAdapter handlerAdaptor = new SimpleControllerHandlerAdapter();
        handlerAdaptor.handle(request, wrapper, handler);

        ExportDelegate.writeExport(response, request, wrapper);

        return false;
    }
View Full Code Here

Examples of org.springframework.web.servlet.HandlerAdapter

        if (log.isDebugEnabled())
        {
            log.debug("handler is " + handler);
        }

        HandlerAdapter handlerAdaptor = new SimpleControllerHandlerAdapter();
        handlerAdaptor.handle(request, wrapper, handler);

        ExportDelegate.writeExport(response, request, wrapper);

        return false;
    }
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.