org.glassfish.jersey.examples.flight.resources
Class AircraftsResource

java.lang.Object
  extended by org.glassfish.jersey.examples.flight.resources.AircraftsResource

@Path(value="aircrafts")
@Produces(value={"application/xml","application/json"})
public class AircraftsResource
extends Object

JAX-RS resource for accessing & manipulating flight information.

Author:
Marek Potociar (marek.potociar at oracle.com)

Constructor Summary
AircraftsResource()
           
 
Method Summary
 Aircraft create(String manufacturer, String type, Integer capacity, Integer x, Integer y)
           
 String delete(Integer id)
           
 Aircraft get(Integer aircraftId)
           
 Aircraft getAsHtml(Integer id)
           
 Collection<Aircraft> list()
           
 Collection<Aircraft> listAsHtml()
           
 String listAsString()
           
 Collection<Aircraft> listAvailable()
           
 String listAvailableAsString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AircraftsResource

public AircraftsResource()
Method Detail

list

@GET
public Collection<Aircraft> list()

listAsHtml

@GET
@Produces(value="text/html")
public Collection<Aircraft> listAsHtml()

listAsString

@GET
@Produces(value="text/plain;qs=0.5")
public String listAsString()

get

@GET
@Path(value="{id}")
@Detail
public Aircraft get(@PathParam(value="id")
                                    Integer aircraftId)

getAsHtml

@GET
@Path(value="{id}")
@Produces(value="text/html")
@ErrorTemplate(name="/errors/404")
public Aircraft getAsHtml(@PathParam(value="id")
                                                          Integer id)

delete

@DELETE
@Path(value="{id}")
@Produces(value="text/plain")
@RolesAllowed(value="admin")
public String delete(@PathParam(value="id")
                                                       Integer id)

create

@POST
@Consumes(value="application/x-www-form-urlencoded")
@RolesAllowed(value="admin")
@Detail
public Aircraft create(@FormParam(value="manufacturer")
                                                         String manufacturer,
                                                         @FormParam(value="type")
                                                         String type,
                                                         @FormParam(value="capacity")
                                                         Integer capacity,
                                                         @DefaultValue(value="0")@FormParam(value="x-pos")
                                                         Integer x,
                                                         @DefaultValue(value="0")@FormParam(value="y-pos")
                                                         Integer y)

listAvailable

@GET
@Path(value="available")
public Collection<Aircraft> listAvailable()

listAvailableAsString

@GET
@Path(value="available")
@Produces(value="text/plain;qs=0.5")
public String listAvailableAsString()


Copyright © 2007-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.