Reputation: 12594
I've written a simple REST service class, and I need to deploy and run it under glassfish server, installed on my eclipse.
What steps have I to do in order to put this restlet service online and reach it from my browser?
This is the code:
import javax.ws.rs.*;
import javax.ws.rs.core.*;
@Path("/myApplication")
public class MailRestlet {
@SuppressWarnings("unused")
@Context
private UriInfo context;
/**
* Default constructor.
*/
public MyRestlet() {
// TODO Auto-generated constructor stub
}
@GET
@Produces("text/html")
public String getHtml() {
return "<html><body><h1>Hello World!!</h1>The service is online!!</body></html>";
}
}
Upvotes: 1
Views: 4796
Reputation: 76
As an alternative to configuring the end point using the web.xml file, you can extend the Application class as described here.
From in Eclipse, you can deploy on the server by:
Upvotes: 0
Reputation: 196
You also need to configure the web.XML file, for example, as in http://download.oracle.com/docs/cd/E19776-01/820-4867/ggrby/index.html
There is also a way to avoid web.XML change, by extending the Application class from jaxrs...
Upvotes: 2