cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joanne Kubischta (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CXF-4220) After loading XSDs from links in WADL, JAX-RS get all for all resources fail with 400
Date Mon, 02 Apr 2012 16:37:23 GMT
After loading XSDs from links in WADL, JAX-RS get all for all resources fail with 400
-------------------------------------------------------------------------------------

                 Key: CXF-4220
                 URL: https://issues.apache.org/jira/browse/CXF-4220
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.5.2
         Environment: Linux
            Reporter: Joanne Kubischta


We use a CustomCXFNonSpringJaxrsServlet with one overriding method in order to use our hand
written WADL.
   @Override
   protected void setSchemasLocations(JAXRSServerFactoryBean bean, ServletConfig servletConfig)
   {
      super.setSchemasLocations(bean, servletConfig);
      
      // Set the WADL document location
      if(servletConfig.getInitParameter(JAXRSUtils.DOC_LOCATION) != null)
      {
         bean.setDocLocation(servletConfig.getInitParameter(JAXRSUtils.DOC_LOCATION));
      }
   }

In the web.xml of the user resource, the XSDs are referenced as follows - 
        <init-param>
            <param-name>jaxrs.schemaLocations</param-name>
            <param-value>
                classpath:schemas/xml.xsd
                classpath:schemas/atom.xsd
                classpath:schemas/user.xsd
                classpath:schemas/user-role.xsd
            </param-value>
        </init-param>

In the wadl file, the grammar section is as follows - 
  <grammars>
    <include href="xml.xsd" />
    <include href="atom.xsd" />
    <include href="user.xsd" />
    <include href="user-role.xsd" />
  </grammars>

Here are the steps to reproduce the error - 

1. Verify get all and get a single resource work for all resources including user.
2. Access user wadl from https://server:port/api/rest/users?_wadl successfully but the grammar
section is changed to -
  <grammars>
    <include href="https://server:8443/api/rest/users//xml.xsd" />
    <include href="https://server:8443/api/rest/users//atom.xsd" />
    <include href="https://server:8443/api/rest/users//user.xsd" />
    <include href="https://server:8443/api/rest/users//user-role.xsd" />
  </grammars>
3. Repeat step 1. Result is good.
4. Click the first link and view xml.xsd from a browser. Note xml.xsd is availale from the
internet and does not have a schemaLocation tag. 
5. Repeat step 1. Result is good.
6. Click the link to atom.xsd or any of rest of the links and the XSD loads correctly. Note
all those XSDs are only available in the classpath of user.war.
   Below is an excerpt of how schema is referenced in the XSD -
   <xs:import namespace="urn:api:rest:user-role" schemaLocation="https://server:8443/api/rest/users//"
/>
   <xs:import namespace="http://www.w3.org/2005/Atom" schemaLocation="https://server:8443/api/rest/users//"
/>
7. Do a get all request using https://server:8443/api/rest/users and get the following error
-
   400: Bad Request
   org.xml.sax.SAXParseException: Premature end of file.
8. Do a get all request to other resources and get the same 400.
9. Restart JBoss and problem goes away.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message