Commit ae1af53c by Tuomas Riihimäki

Add map background rest-function

1 parent 318f78fb
package fi.codecrew.moya.rest.placemap.v1; package fi.codecrew.moya.rest.placemap.v1;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import javax.ejb.EJB; import javax.ejb.EJB;
...@@ -12,6 +13,8 @@ import javax.ws.rs.Path; ...@@ -12,6 +13,8 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -45,7 +48,7 @@ public class PlacemapRestViewV1 { ...@@ -45,7 +48,7 @@ public class PlacemapRestViewV1 {
@POST @POST
@Path("/place/{id}/reserve") @Path("/place/{id}/reserve")
public void reservePlace() { public void reservePlace() {
logger .warn("Reserving not yet implemented"); logger.warn("Reserving not yet implemented");
} }
@GET @GET
...@@ -59,6 +62,18 @@ public class PlacemapRestViewV1 { ...@@ -59,6 +62,18 @@ public class PlacemapRestViewV1 {
} }
@GET @GET
@Path("{id}/background")
public Response getBackground(@PathParam("id") Integer id) {
EventMap map = placebean.findMap(id);
byte[] data = map.getMapData();
ResponseBuilder ret = Response.ok(data, "image/png");
ret.expires(new Date(System.currentTimeMillis() + 6*60*60*1000));
return ret.build();
}
@GET
@Path("{id}/places") @Path("{id}/places")
public SimplePlacelistRoot getPlaces(@PathParam("id") Integer mapId) public SimplePlacelistRoot getPlaces(@PathParam("id") Integer mapId)
{ {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!