CS 185C/286 - Lecture 16

Cover page image

Cay S. Horstmann

Lecture 16 Quiz 1

No quiz today

Today's Lecture/Lab

REST

JAX-RS

Hello, World!

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

@Path("/hello")
public class HelloService {
   @GET
   @Path("/{name}")
   public Response getText(@PathParam("name") String name) {
      String output = "Hello " + name + "\n";
      return Response.status(200).entity(output).build();
   }
}
  

JAXB

Reading Before Next Class

Lab

A RESTful Service

Hello, World

Media Type

XML and JSON