Thanks Paul, it's working like this.
The only problem is that like this, i've to copy xsd file from src/resources
to Web-inf, so i've 2 copies of this file in my projet.
Do you know if we can use the classpath variable in the web.xml?
Maybe something like this it's possible:
<init-param>
<param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
<param-value>/(classpath:xsd)/.*</param-value>
</init-param>
Thanks !
Paul Sandoz wrote:
>
> On Oct 7, 2009, at 11:23 AM, piltrafeta wrote:
>
>>
>> I've tried your modifications but is not working...
>>
>> just to check, in my application-grammar.xml:
>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>> <grammars xmlns="http://research.sun.com/wadl/2006/10"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xmlns:xi="http://www.w3.org/1999/XML/xinclude">
>> <include href="myXsdFile.xsd" />
>> </grammars>
>>
>> And in the server i'm having :
>> myproject/WEB-INF/classes/myXsdFile
>> myproject/WEB-INF/classes/application-grammars.xml
>>
>
> Try placing the XSD file so that it appears in the war as follows:
>
> myproject.war
> xsd
> myXsdFile.xsd
>
> then have a filter init param:
>
> <init-param>
> <param-
> name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
> <param-value>/xsd/.*</param-value>
> </init-param>
>
> then verify you can access it from:
>
> http://localhost:8080/myproject/xsd/myXsdFile.xsd
>
>
> Then you probably need to update the href in the pplication-
> grammar.xml, if you have issues you may have to move the XSD file to
> be at the top level, which would require changing the regex to say
> "myXsdFile\.xsd".
>
> Paul.
>
>> but when i try
>> http://localhost:8080/myproject/myXsdFile.xsd
>> i have
>> http404: ressource not available
>>
>> any ideas?
>> Thanks in advance!
>>
>
> First can you verify if you can access the myXsdFile.xsd directly?
>
>
>>
>>
>>
>> Paul Sandoz wrote:
>>>
>>> Hi,
>>>
>>> Modify the <servlet> declaration to <filter> and <servlet-mapping> to
>>> <filter-mapping>.
>>>
>>> <!-- Filter controleur Jersey Spring-->
>>> <filter>
>>> <filter-name>Jersey Spring Web Application</servlet-name>
>>> <filter-
>>> class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</
>>> servlet-class>
>>> <init-param>
>>> <param-name>com.sun.jersey.config.property.packages</param-
>>> name>
>>> <param-value>MyXsdFolder</param-value>
>>> </init-param>
>>> <init-param
>>> <param-
>>> name>com.sun.jersey.config.property.WadlGeneratorConfig</
>>> param-name>
>>> <param-value>MySampleWadlGeneratorConfig</param-value>
>>> </init-param>
>>> </filter>
>>>
>>> <!-- Jersey mapping -->
>>> <filter-mapping>
>>> <filter-name>Jersey Spring Web Application</servlet-name>
>>> <url-pattern>/*</url-pattern>
>>> </filter-mapping>
>>>
>>> Paul.
>>>
>>> On Oct 7, 2009, at 10:58 AM, piltrafeta wrote:
>>>
>>>>
>>>> Thx Paul,
>>>>
>>>> but my web.xml il like this :
>>>> <web-app>
>>>> <display-name>Archetype Created Web Application</display-name>
>>>>
>>>> <!-- Spring configuration -->
>>>> <context-param>
>>>> <param-name>contextConfigLocation</param-name>
>>>> <param-value>WEB-INF/spring/service-applicationContext.xml
>>>> WEB-INF/spring/business-applicationContext.xml
>>>> WEB-INF/spring/converter-applicationContext.xml
>>>> WEB-INF/spring/dao-applicationContext.xml</param-value>
>>>> </context-param>
>>>>
>>>> <!-- Spring listener -->
>>>> <listener>
>>>> <listener-class>
>>>> org.springframework.web.context.ContextLoaderListener
>>>> </listener-class>
>>>> </listener>
>>>> <listener>
>>>>
>>>> <listener-class>org.springframework.web.context.request.RequestContextListener
>>>> </listener-class>
>>>> </listener>
>>>>
>>>> <!-- Servlet controleur Jersey Spring-->
>>>> <servlet>
>>>> <servlet-name>Jersey Spring Web Application</servlet-name>
>>>>
>>>> <servlet-
>>>> class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</
>>>> servlet-class>
>>>> <init-param>
>>>> <param-name>com.sun.jersey.config.property.packages</param-name>
>>>> <param-value>MyXsdFolder</param-value>
>>>> </init-param>
>>>> <init-param>
>>>>
>>>> <param-name>com.sun.jersey.config.property.WadlGeneratorConfig</
>>>> param-name>
>>>> <param-value>MySampleWadlGeneratorConfig</param-value>
>>>> </init-param>
>>>> <load-on-startup>1</load-on-startup>
>>>> </servlet>
>>>>
>>>> <!-- Jersey mapping -->
>>>> <servlet-mapping>
>>>> <servlet-name>Jersey Spring Web Application</servlet-name>
>>>> <url-pattern>/*</url-pattern>
>>>> </servlet-mapping>
>>>> </web-app>
>>>>
>>>> should i have to create a filter element?
>>>> thanks
>>>> eli
>>>>
>>>>
>>>>
>>>> Paul Sandoz wrote:
>>>>>
>>>>>
>>>>> On Oct 6, 2009, at 6:03 PM, piltrafeta wrote:
>>>>>
>>>>>>
>>>>>> Hi,
>>>>>> I'm having the same problem..
>>>>>>
>>>>>> I've tried what you recomend but can't acces in a static way to my
>>>>>> xsd
>>>>>> http://localhost:8080/yourapp/ABC.xsd
>>>>>>
>>>>>> Maybe I need to configure something in the web.xml?
>>>>>>
>>>>>
>>>>> I think you need to place the ABC.xsd in a URI path location that
>>>>> is
>>>>> not served by Jersey.
>>>>>
>>>>> If you use the Jersey ServletContainer as a filter you can set the
>>>>> property:
>>>>>
>>>>> https://jersey.dev.java.net/nonav/apidocs/1.1.2-ea/jersey/com/sun/jersey/spi/container/servlet/ServletContainer.html
>>>>> #PROPERTY_WEB_PAGE_CONTENT_REGEX
>>>>>
>>>>> For example, below is the filter declaration of the bookstore
>>>>> sample:
>>>>>
>>>>> <filter>
>>>>> <filter-name>Jersey Filter</filter-name>
>>>>> <filter-
>>>>> class>com.sun.jersey.spi.container.servlet.ServletContainer</
>>>>> filter-
>>>>> class>
>>>>> <init-param>
>>>>> <param-name>com.sun.jersey.config.feature.Redirect</
>>>>> param-
>>>>> name>
>>>>> <param-value>true</param-value>
>>>>> </init-param>
>>>>> <init-param>
>>>>> <param-
>>>>> name>com.sun.jersey.config.feature.ImplicitViewables</param-name>
>>>>> <param-value>true</param-value>
>>>>> </init-param>
>>>>> <init-param>
>>>>> <param-name>com.sun.jersey.config.property.packages</
>>>>> param-
>>>>> name>
>>>>> <param-value>com.sun.jersey.samples.bookstore.resources</
>>>>> param-value>
>>>>> </init-param>
>>>>> <init-param>
>>>>> <param-
>>>>> name>com.sun.jersey.config.property.WebPageContentRegex</param-
>>>>> name>
>>>>> <param-value>/(images|css|jsp)/.*</param-value>
>>>>> </init-param>
>>>>> </filter>
>>>>>
>>>>> Notice the last init param that declares the regex "/(images|css|
>>>>> jsp)/.*", This declares that any path which matches the regex
>>>>> will be
>>>>> served by the web container and not Jersey.
>>>>>
>>>>> Hth,
>>>>> Paul.
>>>>>
>>>>>> Eli
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Martin Grotzke-2 wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> On Thu, 2009-02-05 at 11:48 +0800, wei zhou wrote:
>>>>>>>> Hi all, I am a newer to Jersey.
>>>>>>> welcome :)
>>>>>>>
>>>>>>>>
>>>>>>>> Jersery is able to add customerized documententation &
>>>>>>>> grammars to
>>>>>>>> its
>>>>>>>> WADL.
>>>>>>>>
>>>>>>>> For adding grammars to the WADL, the wadl generator reads schema
>>>>>>>> info
>>>>>>>> from file "application-grammars.xml", where I want to add local
>>>>>>>> XSD
>>>>>>>> files.
>>>>>>> Exactly. The WadlGeneratorGrammarsSupport reads some xml file and
>>>>>>> adds
>>>>>>> the grammars element to the application.wadl.
>>>>>>>
>>>>>>>>
>>>>>>>> The "application-grammars.xml" is like this:
>>>>>>>>
>>>>>>>> <grammars xmlns="http://research.sun.com/wadl/2006/10"
>>>>>>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>>>>>>> xmlns:xi="http://www.w3.org/1999/XML/xinclude">
>>>>>>>> <xsd:include schemaLocation="ABC.xsd" />
>>>>>>>> <!-- include href="ABC.xsd" -->
>>>>>>>> </grammars>
>>>>>>> You should use the
>>>>>>> <include href="ABC.xsd" />
>>>>>>>
>>>>>>> (I'm just comparing with the application-grammars.xml of the
>>>>>>> generate-wadl/extended-wadl-webapp sample... :)
>>>>>>>
>>>>>>> And perhaps you can put some
>>>>>>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>>>>>>> at the top? But I don't think that this produces issues if
>>>>>>> missing
>>>>>>> (but
>>>>>>> not sure).
>>>>>>>
>>>>>>>>
>>>>>>>> In the case, "ABC.xsd" is a local schema in my project that it
>>>>>>>> does
>>>>>>>> not have a final static url. After the project is deployed to
>>>>>>>> web
>>>>>>>> server, this "ABC.xsd" is not navigated in its WADL file.
>>>>>>> Hmm, what do you mean with "navigated"? The first thing to
>>>>>>> check is
>>>>>>> if
>>>>>>> the application.wadl contains the content of your
>>>>>>> application-grammars.xml. If so, the job of the
>>>>>>> WadlGeneratorGrammarsSupport is done.
>>>>>>>
>>>>>>> The ABC.xsd should live besides the generated application.wadl
>>>>>>> then. If
>>>>>>> you use static generation of the wadl (at build time, as shown by
>>>>>>> the
>>>>>>> generate-wadl sample), this is the same directory. If the
>>>>>>> application.wadl is generated at runtime and you access it at
>>>>>>> e.g.
>>>>>>> http://localhost:8080/yourapp/application.wadl, the ABC.xsd
>>>>>>> should be
>>>>>>> available at http://localhost:8080/yourapp/ABC.xsd I'd say.
>>>>>>>
>>>>>>> I hope this helps,
>>>>>>> cheers,
>>>>>>> Martin
>>>>>>>
>>>>>>>
>>>>>>>> For example, my project is deployed in the JBOSS where "ABC.xsd"
>>>>>>>> is
>>>>>>>> located in "myApp.war/web-inf/wsdl/ABC.xsd".
>>>>>>>>
>>>>>>>> How to make "ABC.xsd" navigated in the WADL file?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://n2.nabble.com/WADL-How-to-make-local-schema-navigated-in-WADL-grammars-tp2274188p3775964.html
>>>>>> Sent from the Jersey mailing list archive at Nabble.com.
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://n2.nabble.com/WADL-How-to-make-local-schema-navigated-in-WADL-grammars-tp2274188p3780550.html
>>>> Sent from the Jersey mailing list archive at Nabble.com.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/WADL-How-to-make-local-schema-navigated-in-WADL-grammars-tp2274188p3780661.html
>> Sent from the Jersey mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>
>
--
View this message in context: http://n2.nabble.com/WADL-How-to-make-local-schema-navigated-in-WADL-grammars-tp2274188p3780805.html
Sent from the Jersey mailing list archive at Nabble.com.