/*
 * 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 TestAppResource;

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

/**
 * REST Web Service
 *
 * @author stephenhole
 */
@Path("/TestAppResource")
public class TestApp {

    @Context
    private UriInfo context;

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

    /**
     * Retrieves representation of an instance of TestAppResource.TestApp
     * @return an instance of java.lang.String
     */
    @GET
    @Produces(MediaType.TEXT_HTML)
    public String getHtml() {
        //TODO return proper representation object
        //throw new UnsupportedOperationException();
        return "Hello World Yet Again";
    }
    
    @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("/Andrew")
    @Produces("text/html")
    public String getAndrewXml() {
        return "<html><body><h1>Hello World and Andrew</h1></body></html>";
        //throw new UnsupportedOperationException();
    }
    
    @GET
    @Path("/James/{lname}")
    @Produces("text/html")
    public String getParamXml(@PathParam("lname") String lastName ) {
        return "<html><body><h1>Hello World and James " + lastName + "</h1></body></html>";
        //throw new UnsupportedOperationException();
    }

    @GET
    @Path("/Alyson/{midname}/{lname}")
    @Produces("text/html")
    public String getParamPlusXml(@PathParam("lname") String lastName, @PathParam("midname") String middleName ) {
        return "<html><body><h1>Hello World and Alyson " + middleName + " " + lastName + "</h1></body></html>";
        //throw new UnsupportedOperationException();
        
        //http://localhost:8080/TestingApp/webresources/TestAppResource/Alyson/Joan/Amour
    }
    
    /**
     * PUT method for updating or creating an instance of TestApp
     * @param content representation for the resource
     */
    @PUT
    @Consumes(MediaType.TEXT_HTML)
    public void putHtml(String content) {
    }
}

//http://localhost:8080/TestingApp/webresources/TestAppResource

