Class GraphicsRestService
Object
GraphicsRestService
@DeclareRoles("player")
@RolesAllowed("player")
@Path("/graphics")
public class GraphicsRestService
extends Object
Contains all rest calls used by the graphical client, with
authentication and authorization. You can find them at
/karchangame/resources/graphics.
- Author:
- maartenl
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Response
protected EntityManager
Returns the entity manager of JPA.Retrieved the room by room number.Retrieved the room number where a person is.getRooms()
getTransform
(String name) Returns the transform of a person.void
setLogService
(LogService logService) void
setPlayerAuthenticationService
(PlayerAuthenticationService playerAuthenticationService) Response
Adds or updates your current characters room.Response
setTransform
(String name, String json) Adds or updates your current character transform (position, rotation, scale).
-
Constructor Details
-
GraphicsRestService
public GraphicsRestService()
-
-
Method Details
-
getEntityManager
protected EntityManager getEntityManager()Returns the entity manager of JPA. This is defined in build/web/WEB-INF/classes/META-INF/persistence.xml.- Returns:
- EntityManager
-
getTransform
-
setTransform
@PUT @Path("persons/{name}/transform") @Consumes("application/json") public Response setTransform(@PathParam("name") String name, String json) Adds or updates your current character transform (position, rotation, scale).- Parameters:
name
- the name of the userjson
- the object containing the new stuff to update.- Returns:
- Response.ok if everything is okay.
- Throws:
WebApplicationException
- UNAUTHORIZED, if the authorisation failed. BAD_REQUEST if an unexpected exception crops up.
-
getRoom
-
getRoom
-
setRoom
@PUT @Path("persons/{name}/room") @Consumes("application/json") public Response setRoom(@PathParam("name") String name, String json) Adds or updates your current characters room.- Parameters:
name
- the name of the userjson
- the object containing the new stuff to update.- Returns:
- Response.ok if everything is okay.
- Throws:
WebApplicationException
- UNAUTHORIZED, if the authorisation failed. BAD_REQUEST if an unexpected exception crops up.
-
getRooms
- Returns:
- list of room ids, including coordinates.
-
createResponse
protected Response createResponse() -
setLogService
-
setPlayerAuthenticationService
-