[
https://issues.jboss.org/browse/JBIDE-10645?page=com.atlassian.jira.plugi...
]
Xavier Coulon commented on JBIDE-10645:
---------------------------------------
Hello Viacheslav,
The Section 2.3.2 of the JAX-RS Spec version 1.1 ([link
here|http://download.oracle.com/otn-pub/jcp/jaxrs-1.0-fr-eval-oth-JSpec/j...])
stipulates that
{quote}
When using a JAX-RS aware servlet container, the servlet-class element of the web.xml
descriptor SHOULD name the application-supplied subclass of Application.
When using a non-JAX-RS aware servlet container, the servlet-class element of the web.xml
descriptor SHOULD name the JAX-RS implementation-supplied Servlet class. The
application-supplied subclass of Application is identified using an init-param with a
param-name of javax.ws.rs.Application.
{quote}
From JBoss Central, you can have a look at the 'HTML5' project
example.
The web.xml is as follow:
{code}
<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">
<!-- One of the way of activating REST Servises is adding these lines, the server
is responsible for adding the corresponding servlet automatically. If the src folder,
org.jboss.as.quickstarts.poh5helloworld.HelloWorld class has the Annotations to receive
REST invocation-->
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/hello/*</url-pattern>
</servlet-mapping>
</web-app>
{code}
and the index.html contains the following javascript code:
{code}
var jqxhr = $.getJSON('hello/json/'+ name, function(data) {
console.log("success: " + data.result);
$('#result').text(data.result);
})
{code}
BTW, the spec looks a bit confusing IMO: the servlet init-param must be
{code}javax.ws.rs.Application{code} but the application-supplied subclass must extend
{code}javax.ws.rs.core.Application{code}.
Validate servlet name 'javax.ws.rs.core.Application' or any
subtype
-------------------------------------------------------------------
Key: JBIDE-10645
URL:
https://issues.jboss.org/browse/JBIDE-10645
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: JSF
Affects Versions: 3.3.0.M5
Reporter: Xavier Coulon
Assignee: Viacheslav Kabanovich
Labels: jax-rs, validation, web, web_xml
Fix For: 3.3.0.Beta1
The 'JAX-RS Application' is the top level fragment of the URI Path Templates of
the JAX-RS Endpoints.
One way to configure it is in the webapp's deployment descriptor, with something like
this:
{code}
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
{code}
see [JBossAS 7 / JAX-RS docs
here|https://docs.jboss.org/author/display/AS7/Java+API+for+RESTful+Web+S...]
Hélas, the web.xml validator reports an error (or a warning) with the following message
{quote}
servlet-name references to javax.ws.rs.core.Application that is not a servlet
{quote}
For sure, the validation level could be set to ignore, but could this JAX-RS specific
rule be implemented by default ?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira