package com.ntlab.irisserver.resources; import com.ntlab.irisserver.entities.Drawing; import com.ntlab.irisserver.entities.Game; import com.ntlab.irisserver.entities.Room; import com.ntlab.irisserver.models.RoomManager; import com.ntlab.irisserver.utils.Base64Decode; import org.apache.catalina.core.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.beans.BeansException; import org.springframework.stereotype.Component; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import java.io.IOException; @Component @Path("/rooms") public class DrawingsRest { private ApplicationContext applicationContext; public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } // お絵描きの終了判定 @GET @Path("/{rid}/game/drawings") public String getDrawings(@PathParam("rid") String rid) { // 絵のデータ取得 return null; } // 絵のデータ取得 @GET @Path("/{rid}/game/drawings/{dno}") @Produces(MediaType.APPLICATION_JSON) public Drawing getDrawing(@PathParam("rid") String rid, @PathParam("dno") int dno ) { RoomManager roomManager = RoomManager.getInstance(); Room room = roomManager.getRoom(rid); Game game = room.getGame(); // まだgameのメソッドが出来ていないのでコメントアウト // Drawing drawing = game.getDrawing(dno); // return drawing; return null; } // 描いた絵を送る @PUT @Path("/{rid}/game/drawings/{dno}") public String putDrawing(@PathParam("rid") String rid, @PathParam("dno") int dno, @FormParam("drawing") String drawing ) { RoomManager roomManager = RoomManager.getInstance(); Room room = roomManager.getRoom(rid); Game game = room.getGame(); // まだgameのメソッドが出来ていないのでコメントアウト // game.putDrawing(dno, drawing); String path1 = ""; String path = ""; // いったんnullにしとく return null; } }