Nam Nguyen wrote:
> 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?
>
The features are documented in the JavaDoc of ResourceConfig, but
unfortunately they are not documented w.r.t. the equivalent APT options
(although they can be inferred from ResourceConfig).
Since it is planned that the APT step for generation of the
ResourceConfig will be going away for 0.5 i would prefer not to waste
time on documenting the APT stuff and instead would like to document
equivalents for the initialization parameters of servlet in 0.5.
Would that be OK for you?
Paul.
> -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
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109