Package web.servlets

Source Code of web.servlets.GetPlayerPosition

package web.servlets;

import javax.servlet.http.HttpServletRequest;

import org.scotlandyard.engine.Game;
import org.scotlandyard.engine.json.JsonFactory;
import org.scotlandyard.impl.engine.GameEngine;

public class GetPlayerPosition extends AbstractServlet implements
    IRequestProcessor {

  @Override
  public Object getOutput(HttpServletRequest request, GameEngine engine)
      throws Exception {

    final String playerEmail = engine.getUsers().get(getSessionId()).getEmail();
    final String gameId=request.getParameter("gameId");

    final Game game = engine.getLobby().getGame(gameId);

    String position = game.getPlayerPosition(playerEmail);

    return JsonFactory.toJson(position);
  }

  @Override
  public void validateRequest(HttpServletRequest request, GameEngine engine)
      throws Exception {

  }

}
TOP

Related Classes of web.servlets.GetPlayerPosition

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.