package com.javahonk;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/user")
public class HelloWorld {

	//HTML Request
	@GET
	@Path("/helloWorld")
	@Produces(MediaType.TEXT_HTML)
	public String helloWorld() {
		return "<html> " + "<title>" + "Hello World!" + "</title>"+ "<body><h1>" + "Hello World!" + "</body></h1>" + "</html> ";
	}

	// XML request
	@GET
	@Path("/helloWorld")
	@Produces(MediaType.TEXT_XML)
	public String sayXMLHello() {
		return "<?xml version=\"1.0\"?>" + "<hello> Hello World from RESTful. It is TEXT_XML request." + "</hello>";
	}

	// XML request
	@GET
	@Path("/helloWorld")
	@Produces(MediaType.APPLICATION_XML)
	public String sayApplicationXMLHello() {
		return "<?xml version=\"1.0\"?>"
				+ "<hello> Hello World from RESTful. It is APPLICATION_XML request."
				+ "</hello>";
	}
	
	// JASON request
	@GET
	@Path("/helloWorld")
	@Produces(MediaType.APPLICATION_JSON)
	public String sayJASONHello() {
		return "<?xml version=\"1.0\"?>"
				+ "<hello> Hello World from RESTful. It is APPLICATION_JSON request."
				+ "</hello>";
	}
	
	// TEXT_PLAIN request
	@GET
	@Path("/helloWorld")
	@Produces(MediaType.TEXT_PLAIN)
	public String sayPlainTextHello() {
		return "Hello World from RESTful. It is TEXT_PLAIN request.";
	}

}