In this section, we will run the jaxrsclient.jsp
file. Before we run the JSP client, we need to make a slight modification in the root resource class to output an XML string. Modify the getXMLMessage()
method as follows:
@GET @Produces("text/xml") public String getXMLMessage() { return "<?xml version="1.0"?>" + "<hello>Hello JAX-RS" + "</hello>"; }
Start WildFly 8.1.1 if not already started. With all the resource methods uncommented in the root resource class and all the out.println
statements for the different acceptable media types uncommented in the JSP client, clean and redeploy/reinstall the Maven project. Invoke the URL http://localhost:8080/jboss-jaxrs/jaxrsclient.jsp
in a browser. All the resource methods get invoked and three different media types get an output, as shown here: