Newer
Older
IrisServer / src / main / java / com / ntlab / irisserver / resources / RoomsRest.java
package com.ntlab.irisserver.resources;
import org.springframework.stereotype.Component;
import com.ntlab.irisserver.entities.Room;
import com.ntlab.irisserver.models.RoomManager;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

@Component
@Path("/rooms")
@Produces(MediaType.APPLICATION_JSON)

public class RoomsRest {

    @POST
    @Path("/")
    public Room makeRooms(@FormParam("nickname") String ownername){
        RoomManager rm = RoomManager.getInstance();
        Room room = rm.createRoom(ownername);

        return room;
    }

    @GET
    @Path("/{rid}")
    public Room getRoomMenber(@PathParam("rid") String rid){
        RoomManager rm = RoomManager.getInstance();
        Room room = rm.getRoom(rid);

        return room;
    }

}