Reputation: 1217
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:
web.xml
present since I am using org.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.
Upvotes: 1
Views: 1535
Reputation:
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.WebServlet
and @javax.ws.rs.ApplicationPath
are used to configure Servlets and REST applications.
But if you want to have a web.xml
, you can create one in the directory web/WEB-INF
. A minimal web.xml
looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
</web-app>
Upvotes: 1