/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package HelloWorldResource;

import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PUT;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

/**
 * REST Web Service
 *
 * @author stephenhole
 */
@Path("/helloworld")
public class HelloStephen {

    @Context
    private UriInfo context;

    /**
     * Creates a new instance of HelloStephen
     */
    public HelloStephen() {
    }

    /**
     * Retrieves representation of an instance of HelloWorldResource.HelloStephen
     * @return an instance of java.lang.String
     */
    @GET
    @Path("/Janet")
    @Produces("text/html")
    public String getJanetXml() {
        return "<html><body><h1>Hello World and Janet</h1></body></html>";
        //throw new UnsupportedOperationException();
    }
    
    @GET
    @Path("/James")
    @Produces("text/html")
    public String getJamesXml() {
        return "<html><body><h1>Hello World and James</h1></body></html>";
        //throw new UnsupportedOperationException();
    }

    @GET
    @Path("/Name/{name}")
    @Produces("text/text")
    public String getNameXml(@PathParam("name") String nme) {
        return "Hello world and " + nme + "!";
        //return "<html><body><h1>Hello World and></h1></body></html>";
        //throw new UnsupportedOperationException();
    }
    
    @PUT
    @Path("/Name/{name}")
    @Consumes("application/text")
    public String addName(@PathParam("name") String nme, @QueryParam("lname") String lname) {
        return "Name " + nme + " Last Name " + lname + " !!";
    }
    
    /**
     * PUT method for updating or creating an instance of HelloStephen
     * @param content representation for the resource
     */
    @PUT
    @Consumes("application/xml")
    public String putXml(String content) {
        return "<html><body><h1>Hello World and</h1></body></html>";
    }
}
