Some foundation facts:

Development environment using NetBeans 8.0.2, Tomcat 8.0.32, Java
jdk1.8.0_121 and Postman.

The code:

I have a simple hello world servlet for testing (in production, the
service will serve as an endpoint for information from another
organization):

package com.tsr.webservices;

import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.json.JSONObject;

/**
  *
  * @author Carl
  */
@WebService(serviceName = "helloWorld")
@Path("/helloWorld")
public class AnoviaWebService {

/**
      * Retrieves representation of an instance of helloWorld.HelloWorld
      * @return an instance of java.lang.String
      */
     @GET
     @Produces("text/html")
     public String getHtml() {
         return "<html><body><h1>Hello, World!!</body></h1></html>";
     }
}

The web.xml contains these fragments:

...

     <servlet>
         <servlet-name>AnoviaWebService</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
         <init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.tsr.webservice</param-value>
         </init-param>
         <load-on-startup>1</load-on-startup>
     </servlet>

...

     <servlet-mapping>
         <servlet-name>AnoviaWebService</servlet-name>
         <url-pattern>/helloWorld/*</url-pattern>
     </servlet-mapping>

...

Tomcat starts properly with no errors.  Using Postman with either

http://192.168.0.117:8080/prod2test/helloWorld/getHtml

or

http://192.168.0.117:8080/prod2test/helloWorld

the first request after a rebuild/redeploy (we use a request filter and
I can see the request hitting the filter) returns a 200 OK but the jsp
that is displayed is the jsp that is displayed when the request failed
to pass the filter requirements.  Subsequent requests return a 404, not
found error and I can see the request never hits the filter after that
first request.

Additional notes.

1.  I am attempting to add this service to an existing application that
is quite large because, at some time in the not too distant future, the
entire application will be changed to run as a sevice so the client and
server sides can be decoupled.

2.  I have successfully created/deployed/run a REST service using the
NetBeans templates but it has no web.xml and uses the
'ApplicationConfig' process to expose the service.

If anyone has any ideas, I would certainly appreciate them.

Thanks,

Carl



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to