This is my bug in the generated ant build script setting up wrong value
for the default.
I have checked in the fix into NetBeans code.
By the way, where I can get the description of these APT options?
-Nam
Paul Sandoz wrote:
> Hi Ayub,
>
> The reason why you are getting a 404 when the matrix parameter present
> in the URI is due to the setting of the features in the WebResources
> you attached.
>
> DefaultResourceConfig does this:
>
> public DefaultResourceConfig() {
> this((Set<Class>)null);
> }
>
> public DefaultResourceConfig(Class... resources) {
> this(new HashSet<Class>(Arrays.asList(resources)));
> }
>
> public DefaultResourceConfig(Set<Class> resources) {
> this.features.put(ResourceConfig.FEATURE_CANONICALIZE_URI_PATH,
> true);
> this.features.put(ResourceConfig.FEATURE_IGNORE_MATRIX_PARAMS,
> true);
> this.features.put(ResourceConfig.FEATURE_NORMALIZE_URI, true);
> this.features.put(ResourceConfig.FEATURE_REDIRECT, true);
> if (null != resources) {
> this.resources.addAll(resources);
> }
> }
>
> In the constructor of WebResources you are overriding and setting all
> the features to false.
>
> Specifically the IgnoreMatrixParams feature when set to true (the
> default value) will strip matrix parameters from the path before
> matching on the path occurs.
>
> Paul.
>
> Ayub Khan wrote:
>> Hi Paul,
>>
>> comments inline...
>>
>> Paul Sandoz wrote:
>>> Hi Ayub,
>>>
>>> Can you access the URI:
>>>
>>> http://localhost:8080/CustomerDB/resources/hello3
>>>
>>> ?
>> This url worked fine.
>>
>> I tried http://localhost:8080/CustomerDB/resources/hello3?name=test
>>
>> The result is same
>>
>> <b>Hello null</b>
>>
>> I guess Matrix Param annotation is just ignored for following code
>>
>> @HttpMethod("GET")
>> @ProduceMime("application/xml")
>> public String getXml(@MatrixParam("name") String name) {
>> return "<?xml version='1.0' encoding='UTF-8'?>\n<b>Hello
>> "+name+"</b>";
>> }
>>>
>>> I just did a quick check by modifying the SimpleServlet example and
>>> adding a matrix parameter:
>>>
>>> public InputStream doGet(@MatrixParam("name") String name) {
>>> System.out.println(name);
>>> return this.getClass().getResourceAsStream("index.html");
>>> }
>>>
>>> and it worked fine with or without a matrix parameter present on the
>>> URI.
>>>
>>> What is the source code for the class whose name is the value of the
>>> servlet init-parameter webresourceclass ?
>> This file WebResources.java is attached.
>>>
>>> IIRC Matrix parameters are not supported by the WADL generation.
>>>
>>> Paul.
>> Thanks
>> Ayub
>>>
>>> Ayub Khan wrote:
>>>> Hi Paul,
>>>>
>>>> With 0.4ea jersey available in REST modules of NB6.0 trunk.
>>>>
>>>> I was trying MatrixParam annotation.
>>>>
>>>>
>>>> /**
>>>> * Retrieves representation of an instance of
>>>> hello.HelloWorldResource
>>>> * @return an instance of java.lang.String
>>>> */
>>>> @HttpMethod("GET")
>>>> @ProduceMime("application/xml")
>>>> public String getXml(@MatrixParam("name") String name) {
>>>> return "<?xml version='1.0' encoding='UTF-8'?>\n<b>Hello
>>>> "+name+"</b>";
>>>> }
>>>>
>>>> After deploying the app, if I try the URL
>>>> http://localhost:8080/CustomerDB/resources/hello3;name=test
>>>> I get 404 error on the browser.
>>>>
>>>> Also checked the wadl, it does not have a param element
>>>> (I was expecting this element also to have a style="matrix"
>>>> attribute) for the resource hello3.
>>>>
>>>> application.wadl
>>>> ---------------------
>>>> ...
>>>> <resource path="hello3">
>>>> <method name="GET">
>>>> <request>
>>>> <representation/>
>>>> </request>
>>>> <response>
>>>> <representation mediaType="application/xml"/>
>>>> </response>
>>>> </method>
>>>> ...
>>>> ----------------------
>>>>
>>>>
>>>> Can you please provide a sample and how to test it.
>>>>
>>>> Thanks
>>>> Ayub
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
>>>> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>>>>
>>>
>>
>> ------------------------------------------------------------------------
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>