You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (Commented) (JIRA)" <ji...@apache.org> on 2012/04/03 12:00:28 UTC
[jira] [Commented] (CXF-4220) After loading XSDs from links in
WADL, JAX-RS get all for all resources fail with 400
[ https://issues.apache.org/jira/browse/CXF-4220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13245096#comment-13245096 ]
Sergey Beryozkin commented on CXF-4220:
---------------------------------------
r1308794 in 2.5.3-SNAPSHOT should fix it. Please verify.
The problem seemed to do with WADLGenerator creating bogus references for empty schemaLocations, now there are just ignored.
I also added a "jaxrs.docLocation" servlet parameter for you to avoid overriding the CXF servlet
> 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
> Assignee: Sergey Beryozkin
> Fix For: 2.5.3, 2.6
>
>
> 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