Package nz.ac.massey.softwarec.group3.reverseAJAX

Examples of nz.ac.massey.softwarec.group3.reverseAJAX.ReverseAJAXCall


        request=context.mock(HttpServletRequest.class);
        session=context.mock(HttpSession.class);
        response=context.mock(HttpServletResponse.class);
       
        game=new Game("user@gmail.com",321);
        game.setPlaying(true);
    }
View Full Code Here


     */
    protected void processRequest(final HttpServletRequest request, final HttpServletResponse response)
            throws ServletException, IOException {
        final HttpSession session = request.getSession();
        final String email = (String) session.getAttribute("email");
        final Game game = (Game) session.getAttribute("game");
        Player player = null;
        if (game != null) {
            player = game.getPlayer(email);
        }
        final String actionType = (String) request.getParameter("action");
        final String value = (String) request.getParameter("value");
        final Action actionToPerform = new Action(player, actionType, value, game, session);
        ActionPerformer.performAction(actionToPerform);
View Full Code Here

        response.setContentType("text/html;charset=UTF-8");
        final PrintWriter out = response.getWriter();
        final String actionType = (String) request.getParameter("action");
        final HttpSession session = request.getSession();
        if ("gameData".equals(actionType)) {
            final Game game = (Game) session.getAttribute("game");
            out.print(DataGetter.getGameData(game));
        }
        if ("lobbyData".equals(actionType)) {
            out.print(DataGetter.getLobbyData());
        }
        if ("gamesData".equals(actionType)) {
            out.print(DataGetter.getGamesData());
        }
        if ("gamePlayersData".equals(actionType)) {
            final Game game = (Game) session.getAttribute("game");
            out.print(DataGetter.getGamePlayersData(game));
        }
        if ("openTokData".equals(actionType)) {
            final Game game = (Game) session.getAttribute("game");
            out.print(DataGetter.getOpenTokData(game));
        }
        if ("mapData".equals(actionType)) {
            final Game game = (Game) session.getAttribute("game");
            out.print(DataGetter.getMapData(game));
        }
    }
View Full Code Here

        try {
            if (session == null) {
                out.append("/Software_Engineering_C/Resources/JavaServerPages/login.jsp");
            }
            else {
                Game game = (Game) session.getAttribute("game");
                if (session.getAttribute("email") == null && !("login").equals(location)) {
                    out.append("/Software_Engineering_C/Resources/JavaServerPages/login.jsp");
                }
                else if (session.getAttribute("email") != null && ("login").equals(location)) {
                    out.append("/Software_Engineering_C/Resources/JavaServerPages/lobby.jsp");
                }
                else if (session.getAttribute("game") == null && (("ingame").equals(location) || ("gamewaiting").equals(location))){
                    out.append("/Software_Engineering_C/Resources/JavaServerPages/lobby.jsp");
                }
                else if (game != null && game.isFinished()) {
                    out.append("/Software_Engineering_C/Resources/JavaServerPages/lobby.jsp");
                }
            }
        } finally {           
            out.close();
View Full Code Here

     * @param String filterType - The type of filter, currently can filter to everyone in a game, or everyone in a game who is not the user who made the call.
     * @param String email - The email dress of the user who made the call (Used to get the game, and to exclude that user from an "Others" filter.
     * @return ScriptSessionFilter newFilter - the created filter.
     */
    private ScriptSessionFilter createFilter(final String filterType, final String email) {
        final Game game = SessionTracker.getSessionTracker().getGameTracker().getGameWithUserInIt(email);
        ScriptSessionFilter newFilter = null;
        if ("Game".equals(filterType)) {
            newFilter = new GameSessionFilter(game);
        } else if ("Others".equals(filterType)) {
            newFilter = new OtherPlayersInGameSessionFilter(game, email);
View Full Code Here

    /* (non-Javadoc)
     * @see org.directwebremoting.ScriptSessionFilter#match(org.directwebremoting.ScriptSession)
     */
    @Override
    public boolean match(final ScriptSession session) {
        final Game gameToMatch = (Game) session.getAttribute("game");
        return (gameToMatch != null && gameToMatch.equals(game));
    }
View Full Code Here

     * @param String creatorEmail - The name of the user who is creating the game.
     * @return Game game - The newly created game.
     */
    @Override
    public Game createNewGame(final String creatorEmail) {
        final Game game = new Game(creatorEmail, games.size() + 1);
        //game.setTokSessionId();
        games.add(game);
        return game;
    }
View Full Code Here

     * @param String creatorEmail - The email of the user who created the game.
     * @return Game creatorsGame - The game created by the user.
     */
    @Override
    public Game getGameMadeByCreator(final String creatorEmail) {
        Game creatorsGame = null;
        for (int i = 0; i < games.size(); i++) {
            if (creatorEmail.equals(games.get(i).getCreatorEmail())) {
                creatorsGame = games.get(i);
            }
        }
View Full Code Here

     * @param String email - The email of the user to find.
     * @return Game gameWithUser - The game with a given user in it.
     */
    @Override
    public Game getGameWithUserInIt(final String email) {
        Game gameWithUser = null;
        for (Game game : games) {
            final List<Player> players = game.getPlayers();
            for (Player player : players) {
                if (player.getPlayerEmail().equals(email)) {
                    gameWithUser = game;
View Full Code Here

    /* (non-Javadoc)
     * @see org.directwebremoting.ScriptSessionFilter#match(org.directwebremoting.ScriptSession)
     */
    @Override
    public boolean match(final ScriptSession session) {
        final Game gameToMatch = (Game) session.getAttribute("game");
        final String emailToMatch = (String) session.getAttribute("email");
        return (gameToMatch != null && gameToMatch.equals(game) && !(emailToMatch).equals(email));
    }
View Full Code Here

TOP

Related Classes of nz.ac.massey.softwarec.group3.reverseAJAX.ReverseAJAXCall

Copyright © 2018 www.massapicom. 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.