I wanted to make a simple Jersey-based REST app without using Maven in NetBeans. I followed the following steps and now I am stuck:
- Created a simple web app using NetBeans (or any other development IDE).
- Added JAX-RS libraries to my project.
- I don’t have
web.xmlpresent since I am usingorg.netbeans.rest.application.config.
I am stuck now. I want to use web.xml. Is there any alternative?
P.S. – I am trying to use JSON as input without using Maven.
Since in your third step you’ve created the configuration class to expose your JAX-RS Resource classes, you don’t need the functionality in
web.xml. Your application should be ready to run, at least on Glassfish or another Java server.The whole idea of Java EE 6 is to get rid of XML configuration files like the
web.xml. New annotations like@javax.servlet.annotation.WebServletand@javax.ws.rs.ApplicationPathare used to configure Servlets and REST applications.But if you want to have a
web.xml, you can create one in the directoryweb/WEB-INF. A minimalweb.xmllooks like this: