Examples of BasicRequestHandler


Examples of com.gadglet.core.BasicRequestHandler

      GadgletResponse gadgletResponse, HttpServletResponse response) {

   
    String gadgetName = null;
    ReqActionTypes actionType = null;
    BasicRequestHandler handler = null;
    String requestHandlerPackageName = null;
   
    gadgletResponse.setUserContainer(request.getOpenSocialConsumerKey());
   
   
   
    try {
      actionType = request.getGadgetActionType();

      gadgetName = request.getGadgetName();
     
      Gadget g = request.getRequestedGadget();
     
      String contentName = request.getContentName();
         
      if(g!=null)
        requestHandlerPackageName = g.getHandlerPackageName();
     
      handler = RequestHandlerFactory.getGadgetRequestHandler(gadgetName,gadgetsRootPackageName,requestHandlerPackageName,contentName);

      if (actionType.equals(ReqActionTypes.CONFIG))
        handler.doConfig(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.VIEW))
        handler.doView(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.DELETE))
        handler.doDelete(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.ADD))
        handler.doAdd(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.UPDATE))
        handler.doUpdate(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.SEARCH))
        handler.doSearch(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.INVITE_FRIEND))
        handler.doInvite(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.ACCEPT_FRIEND))
        handler.doAcceptFriend(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.REJECT_FRIEND))
        handler.doRejectFriend(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.GET_FRIENDS))
        handler.doGetFriends(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.GET_DOMAIN_USERS))
        handler.doGetDomainUsers(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.GET_INVITATIONS))
        handler.doGetInvitations(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.SHARE))
        handler.doShare(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.SHARED_LIST))
        handler.doSharedList(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.ADD_PROFILE))
        handler.addProfile(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.REMOVE_FRIEND))
        handler.doRemoveFriend(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.UPDATE_PROFILE))
        handler.updateProfile(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.GET_PROFILE))
        handler.getProfile(request, gadgletResponse);
      else if (actionType.equals(ReqActionTypes.CUSTOM) && request.getCustomAction() != null){
       
        // will try custom action, using reflection ......
       
        Class<?> args[] = new Class[2];

        args[0] = GadgletRequestWrapper.class;
        args[1] = GadgletResponse.class;

        Method method = handler.getClass().getMethod(
            request.getCustomAction(), args);
       
        Object[] params = new Object[2];
        params[0] = request;
        params[1] = gadgletResponse;
View Full Code Here

Examples of org.jboss.as.web.session.mocks.BasicRequestHandler

        assertFalse(id1.equals(id2));

        // Ensure replication of session 2 has occurred
        boolean found = false;
        for (int i = 0; i < 10; i++) {
            BasicRequestHandler getHandler = new BasicRequestHandler(attrs.keySet(), false);
            SessionTestUtil.invokeRequest(managers[1], getHandler, id2);
            if (getHandler.getCheckedAttributes() != null && value.equals(getHandler.getCheckedAttributes().get("count"))) {
                found = true;
                break;
            }
            Thread.sleep(50);
        }
View Full Code Here

Examples of org.jboss.as.web.session.mocks.BasicRequestHandler

        }

        @Override
        public void run() {
            try {
                BasicRequestHandler getHandler = new BasicRequestHandler(attributeKeys, false);
                concurrentHandler.registerHandler(getHandler);
                Request request = SessionTestUtil.setupRequest(manager, sessionId);
                startingGun.countDown();
                startingGun.await();

                SessionTestUtil.invokeRequest(pipelineHead, request);
                this.checkedAttributes = getHandler.getCheckedAttributes();
            } catch (Exception e) {
                e.printStackTrace(System.err);
            } finally {
                finishedSignal.countDown();
                concurrentHandler.unregisterHandler();
View Full Code Here

Examples of org.jboss.as.web.session.mocks.BasicRequestHandler

        assertEquals(0, Attribute.attributeCount());
        assertNull(session0B.get());
        assertNull(session1A.get());

        // Reactivate
        BasicRequestHandler getHandler = new BasicRequestHandler(KEYS, false);
        log.info("activate node 1");
        SessionTestUtil.invokeRequest(managers[1], getHandler, sessionId);

        WeakReference<Session> session1B = new WeakReference<Session>(managers[1].findSession(sessionId));
        SessionTestUtil.cleanupPipeline(managers[1]);
        assertNotNull(session1B.get());
        assertEquals(1, Attribute.attributeCount());

        // Fail back
        getHandler = new BasicRequestHandler(KEYS, false);
        log.info("fail back request");
        SessionTestUtil.invokeRequest(managers[0], getHandler, sessionId);

        WeakReference<Session> session0C = new WeakReference<Session>(managers[0].findSession(sessionId));
        SessionTestUtil.cleanupPipeline(managers[0]);
View Full Code Here

Examples of org.jboss.as.web.session.mocks.BasicRequestHandler

        Thread.sleep(250);

        // Now make a request that will not trigger replication but keeps the
        // jbcm0 session alive
        BasicRequestHandler getHandler = new BasicRequestHandler(immutables.keySet(), false);
        SessionTestUtil.invokeRequest(managers[0], getHandler, setHandler.getSessionId());

        validateExpectedAttributes(immutables, getHandler);

        // Sleep long enough that the session will be expired on other server
        // if it doesn't have a maxUnreplicatedInterval grace period
        Thread.sleep(2800);

        // jbcm1 considers the session unmodified for > 3 sec
        // maxInactiveInterval.
        // Try to drive the session out of the jbcm1 cache
        managers[1].backgroundProcess();

        // Replicate just one attribute; see if the other is still in jbcm1
        SetAttributesRequestHandler modifyHandler = new SetAttributesRequestHandler(mutables, false);
        SessionTestUtil.invokeRequest(managers[0], modifyHandler, setHandler.getSessionId());

        // Fail over and confirm all is well. If the session was removed,
        // the last replication of just one attribute won't restore all
        // attributes and we'll have a failure
        getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managers[1], getHandler, setHandler.getSessionId());

        validateExpectedAttributes(allAttributes, getHandler);
    }
View Full Code Here

Examples of org.jboss.as.web.session.mocks.BasicRequestHandler

        SessionTestUtil.invokeRequest(managers[0], modifyHandler, setHandler.getSessionId());

        Thread.sleep(1760);

        // Fail over and confirm all is well
        BasicRequestHandler getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managers[1], getHandler, setHandler.getSessionId());

        validateExpectedAttributes(allAttributes, getHandler);
    }
View Full Code Here

Examples of org.jboss.as.web.session.mocks.BasicRequestHandler

        setHandler = new SetAttributesRequestHandler(allAttributes, false);
        SessionTestUtil.invokeRequest(managersB[0], setHandler, null);
        validateNewSession(setHandler);
        String idB = setHandler.getSessionId();

        BasicRequestHandler getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managersA[1], getHandler, idA);

        validateExpectedAttributes(allAttributes, getHandler);

        getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managersB[1], getHandler, idB);

        validateExpectedAttributes(allAttributes, getHandler);

        // Undeploy one webapp on node 1
        managersB[1].stop();
        log.info("jbcmB1 stopped");

        // Deploy again
        managersB[1] = this.startManager(warnameB, cacheContainers[1]);

        log.info("jbcmB1 started");

        getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managersA[1], getHandler, idA);

        validateExpectedAttributes(allAttributes, getHandler);

        getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managersB[1], getHandler, idB);

        validateExpectedAttributes(allAttributes, getHandler);
    }
View Full Code Here

Examples of org.jboss.as.web.session.mocks.BasicRequestHandler

        Thread.sleep(1050);

        // Now make a request that will not trigger replication unless the
        // interval is exceeded
        BasicRequestHandler getHandler = new BasicRequestHandler(immutables.keySet(), false);
        SessionTestUtil.invokeRequest(managers[0], getHandler, setHandler.getSessionId());

        validateExpectedAttributes(immutables, getHandler);

        // Sleep long enough that the session will be expired on other server
        // if previous request didn't keep it alive
        Thread.sleep(2000);

        // Fail over and confirm all is well
        getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managers[1], getHandler, setHandler.getSessionId());

        validateExpectedAttributes(allAttributes, getHandler);
    }
View Full Code Here

Examples of org.jboss.as.web.session.mocks.BasicRequestHandler

        // trigger timestamp repl
        Thread.sleep(500);

        // Now make a request that will not trigger replication unless the
        // interval is exceeded
        BasicRequestHandler getHandler = new BasicRequestHandler(immutables.keySet(), false);
        SessionTestUtil.invokeRequest(managers[0], getHandler, setHandler.getSessionId());

        validateExpectedAttributes(immutables, getHandler);

        // Sleep long enough that the session will be expired on other server
        // if previous request didn't keep it alive
        Thread.sleep(2600);

        // Fail over and confirm the session was expired
        getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managers[1], getHandler, setHandler.getSessionId());

        validateNewSession(getHandler);
    }
View Full Code Here

Examples of org.jboss.as.web.session.mocks.BasicRequestHandler

        assertNotNull(data1);
        assertNotNull(data2);

        // Access one to prove it gets expired once the manager can see its real
        // timestamp
        BasicRequestHandler getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managers[1], getHandler, setHandler1.getSessionId());
        validateNewSession(getHandler);

        // Sleep past the grace period
        Thread.sleep(2010);
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.