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

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

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

JAX-RS resource for accessing & manipulating flight information.

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

Constructor Summary
FlightsResource()
           
 
Method Summary
 String book(String flightId)
           
 org.glassfish.jersey.server.mvc.Viewable bookAsHtml(String flightId)
           
 Flight create(Integer aircraftId)
           
 String delete(String flightId)
           
 Flight get(String flightId)
           
 Flight getAsHtml(String flightId)
           
 Collection<Flight> list()
           
 org.glassfish.jersey.server.mvc.Viewable listAsCsv()
           
 Collection<Flight> listAsHtml()
           
 String listAsString()
           
 Collection<Flight> listAsYaml()
           
 Collection<Flight> listOpen()
           
 String listOpenAsString()
           
 String updateStatus(String flightId, String newStatus)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlightsResource

public FlightsResource()
Method Detail

list

@GET
public Collection<Flight> list()

listAsHtml

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

listAsCsv

@GET
@Produces(value="text/csv")
public org.glassfish.jersey.server.mvc.Viewable listAsCsv()

listAsYaml

@GET
@Produces(value="application/x-yaml")
public Collection<Flight> listAsYaml()

listAsString

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

get

@GET
@Path(value="{id}")
@Detail
public Flight get(@PathParam(value="id")
                                  String flightId)

getAsHtml

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

book

@POST
@Path(value="{id}/new-booking")
@Produces(value="text/plain")
public String book(@PathParam(value="id")
                                      String flightId)

bookAsHtml

@POST
@Path(value="{id}/new-booking")
@Produces(value="text/html")
public org.glassfish.jersey.server.mvc.Viewable bookAsHtml(@PathParam(value="id")
                                                                              String flightId)

create

@POST
@Consumes(value="application/x-www-form-urlencoded")
@RolesAllowed(value="admin")
@Detail
public Flight create(@FormParam(value="aircraftId")
                                                       Integer aircraftId)

delete

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

updateStatus

@POST
@Path(value="{id}/status")
@Consumes(value="application/x-www-form-urlencoded")
@Produces(value="text/plain")
@RolesAllowed(value="admin")
public String updateStatus(@PathParam(value="id")
                                                                    String flightId,
                                                                    @FormParam(value="status")
                                                                    String newStatus)

listOpen

@GET
@Path(value="open")
public Collection<Flight> listOpen()

listOpenAsString

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


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