You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wink.apache.org by "Jesse Ramos (JIRA)" <ji...@apache.org> on 2009/07/02 17:15:47 UTC

[jira] Created: (WINK-35) Entity lost when using application/x-www-form-urlencoded media type and FormParam

Entity lost when using application/x-www-form-urlencoded media type and FormParam
---------------------------------------------------------------------------------

                 Key: WINK-35
                 URL: https://issues.apache.org/jira/browse/WINK-35
             Project: Wink
          Issue Type: Bug
          Components: Server
    Affects Versions: 0.1
            Reporter: Jesse Ramos
            Priority: Minor


When using the application/x-www-form-urlencoded media type, if a resource method uses the FormParam annotation for one parameter and specifies an entity parameter, the entity parameter value is lost before being injected.  This is a sample method header:

        @POST
        @Path("withOneKeyAndEntity")
        public String getRes(@FormParam("firstkey") String firstKey,
                             MultivaluedMap<String, String> entity)

When obtaining the value for the FormParam parameter, the entity is read from the input stream.  When the input stream is later read for the entity parameter the entity is no longer on the input stream.  The read is done in the FormMultivaluedMapProvider entity provider.

This is an edge case because it's not likely that a user will use the FormParam to get the values of form parameters and also get all the parameters in the entity MultivaluedMap paramter.  However, technically it should be supported.

Will upload a patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WINK-35) Entity lost when using application/x-www-form-urlencoded media type and FormParam

Posted by "Nadav Fischer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WINK-35?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727910#action_12727910 ] 

Nadav Fischer commented on WINK-35:
-----------------------------------

I actually tried a while ago to implement this functionality but still came across some issues. 

I can't remember all of them, but one that comes to mind is how to handle the situations that the entity parameter is the first parameter of the method and the FormParam comes after it. It's fairly straightforward to handle if the FormParam comes before the entity parameter, but when it's the other way around, we'll need to add special "if form parameter" code to places that I'm not sure it belongs.

I feel that all that has to be done (code wise) to support this properly for all possible situation isn't worth the code complication right now, and I'd rather we don't support it all than support it partially.

In any case, If you still feel that it's important, how about we postpone this until after 0.1 is out? we can always add it later.

> Entity lost when using application/x-www-form-urlencoded media type and FormParam
> ---------------------------------------------------------------------------------
>
>                 Key: WINK-35
>                 URL: https://issues.apache.org/jira/browse/WINK-35
>             Project: Wink
>          Issue Type: Bug
>          Components: Common
>    Affects Versions: 0.1
>            Reporter: Jesse Ramos
>            Priority: Minor
>         Attachments: diff.txt
>
>
> When using the application/x-www-form-urlencoded media type, if a resource method uses the FormParam annotation for one parameter and specifies an entity parameter, the entity parameter value is lost before being injected.  This is a sample method header:
>         @POST
>         @Path("withOneKeyAndEntity")
>         public String getRes(@FormParam("firstkey") String firstKey,
>                              MultivaluedMap<String, String> entity)
> When obtaining the value for the FormParam parameter, the entity is read from the input stream.  When the input stream is later read for the entity parameter the entity is no longer on the input stream.  The read is done in the FormMultivaluedMapProvider entity provider.
> This is an edge case because it's not likely that a user will use the FormParam to get the values of form parameters and also get all the parameters in the entity MultivaluedMap paramter.  However, technically it should be supported.
> Will upload a patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WINK-35) Entity lost when using application/x-www-form-urlencoded media type and FormParam

Posted by "Jesse Ramos (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WINK-35?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse Ramos updated WINK-35:
----------------------------

    Attachment: diff.txt

Attaching a possible fix and additional unit tests.

> Entity lost when using application/x-www-form-urlencoded media type and FormParam
> ---------------------------------------------------------------------------------
>
>                 Key: WINK-35
>                 URL: https://issues.apache.org/jira/browse/WINK-35
>             Project: Wink
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 0.1
>            Reporter: Jesse Ramos
>            Priority: Minor
>         Attachments: diff.txt
>
>
> When using the application/x-www-form-urlencoded media type, if a resource method uses the FormParam annotation for one parameter and specifies an entity parameter, the entity parameter value is lost before being injected.  This is a sample method header:
>         @POST
>         @Path("withOneKeyAndEntity")
>         public String getRes(@FormParam("firstkey") String firstKey,
>                              MultivaluedMap<String, String> entity)
> When obtaining the value for the FormParam parameter, the entity is read from the input stream.  When the input stream is later read for the entity parameter the entity is no longer on the input stream.  The read is done in the FormMultivaluedMapProvider entity provider.
> This is an edge case because it's not likely that a user will use the FormParam to get the values of form parameters and also get all the parameters in the entity MultivaluedMap paramter.  However, technically it should be supported.
> Will upload a patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WINK-35) Entity lost when using application/x-www-form-urlencoded media type and FormParam

Posted by "Nadav Fischer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WINK-35?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nadav Fischer reassigned WINK-35:
---------------------------------

    Assignee: Nadav Fischer

> Entity lost when using application/x-www-form-urlencoded media type and FormParam
> ---------------------------------------------------------------------------------
>
>                 Key: WINK-35
>                 URL: https://issues.apache.org/jira/browse/WINK-35
>             Project: Wink
>          Issue Type: Bug
>          Components: Common
>    Affects Versions: 0.1
>            Reporter: Jesse Ramos
>            Assignee: Nadav Fischer
>            Priority: Minor
>         Attachments: diff.txt
>
>
> When using the application/x-www-form-urlencoded media type, if a resource method uses the FormParam annotation for one parameter and specifies an entity parameter, the entity parameter value is lost before being injected.  This is a sample method header:
>         @POST
>         @Path("withOneKeyAndEntity")
>         public String getRes(@FormParam("firstkey") String firstKey,
>                              MultivaluedMap<String, String> entity)
> When obtaining the value for the FormParam parameter, the entity is read from the input stream.  When the input stream is later read for the entity parameter the entity is no longer on the input stream.  The read is done in the FormMultivaluedMapProvider entity provider.
> This is an edge case because it's not likely that a user will use the FormParam to get the values of form parameters and also get all the parameters in the entity MultivaluedMap paramter.  However, technically it should be supported.
> Will upload a patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WINK-35) Entity lost when using application/x-www-form-urlencoded media type and FormParam

Posted by "Nadav Fischer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WINK-35?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727414#action_12727414 ] 

Nadav Fischer commented on WINK-35:
-----------------------------------

The solution looks ok, but I'm not sure we want to handle this at all. I mean, this handles only the case where the entity parameter is a MultivaluedMap, but what about an entity of a different type, such as String? Do we want to go there?

I think we should keep this as simple as we can instead of complicating the code to handle such a special case. What do you think?

> Entity lost when using application/x-www-form-urlencoded media type and FormParam
> ---------------------------------------------------------------------------------
>
>                 Key: WINK-35
>                 URL: https://issues.apache.org/jira/browse/WINK-35
>             Project: Wink
>          Issue Type: Bug
>          Components: Common
>    Affects Versions: 0.1
>            Reporter: Jesse Ramos
>            Priority: Minor
>         Attachments: diff.txt
>
>
> When using the application/x-www-form-urlencoded media type, if a resource method uses the FormParam annotation for one parameter and specifies an entity parameter, the entity parameter value is lost before being injected.  This is a sample method header:
>         @POST
>         @Path("withOneKeyAndEntity")
>         public String getRes(@FormParam("firstkey") String firstKey,
>                              MultivaluedMap<String, String> entity)
> When obtaining the value for the FormParam parameter, the entity is read from the input stream.  When the input stream is later read for the entity parameter the entity is no longer on the input stream.  The read is done in the FormMultivaluedMapProvider entity provider.
> This is an edge case because it's not likely that a user will use the FormParam to get the values of form parameters and also get all the parameters in the entity MultivaluedMap paramter.  However, technically it should be supported.
> Will upload a patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WINK-35) Entity lost when using application/x-www-form-urlencoded media type and FormParam

Posted by "Nick Gallardo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WINK-35?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727538#action_12727538 ] 

Nick Gallardo commented on WINK-35:
-----------------------------------

Nadav,

I see what you're saying.  The only reason I can come up with for someone wanting the whole entity AND individual form params would be to do logging of some sort.

That said, it is an edge case.  I'll have to go back and look at the binding providers, but I'm wondering if we can even support a broader type given that you can only drain the inbound stream once.  


> Entity lost when using application/x-www-form-urlencoded media type and FormParam
> ---------------------------------------------------------------------------------
>
>                 Key: WINK-35
>                 URL: https://issues.apache.org/jira/browse/WINK-35
>             Project: Wink
>          Issue Type: Bug
>          Components: Common
>    Affects Versions: 0.1
>            Reporter: Jesse Ramos
>            Priority: Minor
>         Attachments: diff.txt
>
>
> When using the application/x-www-form-urlencoded media type, if a resource method uses the FormParam annotation for one parameter and specifies an entity parameter, the entity parameter value is lost before being injected.  This is a sample method header:
>         @POST
>         @Path("withOneKeyAndEntity")
>         public String getRes(@FormParam("firstkey") String firstKey,
>                              MultivaluedMap<String, String> entity)
> When obtaining the value for the FormParam parameter, the entity is read from the input stream.  When the input stream is later read for the entity parameter the entity is no longer on the input stream.  The read is done in the FormMultivaluedMapProvider entity provider.
> This is an edge case because it's not likely that a user will use the FormParam to get the values of form parameters and also get all the parameters in the entity MultivaluedMap paramter.  However, technically it should be supported.
> Will upload a patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (WINK-35) Entity lost when using application/x-www-form-urlencoded media type and FormParam

Posted by "Nadav Fischer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WINK-35?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nadav Fischer closed WINK-35.
-----------------------------


> Entity lost when using application/x-www-form-urlencoded media type and FormParam
> ---------------------------------------------------------------------------------
>
>                 Key: WINK-35
>                 URL: https://issues.apache.org/jira/browse/WINK-35
>             Project: Wink
>          Issue Type: Bug
>          Components: Common
>    Affects Versions: 0.1
>            Reporter: Jesse Ramos
>            Assignee: Nadav Fischer
>            Priority: Minor
>             Fix For: 0.1
>
>         Attachments: diff.txt
>
>
> When using the application/x-www-form-urlencoded media type, if a resource method uses the FormParam annotation for one parameter and specifies an entity parameter, the entity parameter value is lost before being injected.  This is a sample method header:
>         @POST
>         @Path("withOneKeyAndEntity")
>         public String getRes(@FormParam("firstkey") String firstKey,
>                              MultivaluedMap<String, String> entity)
> When obtaining the value for the FormParam parameter, the entity is read from the input stream.  When the input stream is later read for the entity parameter the entity is no longer on the input stream.  The read is done in the FormMultivaluedMapProvider entity provider.
> This is an edge case because it's not likely that a user will use the FormParam to get the values of form parameters and also get all the parameters in the entity MultivaluedMap paramter.  However, technically it should be supported.
> Will upload a patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WINK-35) Entity lost when using application/x-www-form-urlencoded media type and FormParam

Posted by "Jesse Ramos (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WINK-35?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse Ramos updated WINK-35:
----------------------------

    Component/s:     (was: Server)
                 Common

> Entity lost when using application/x-www-form-urlencoded media type and FormParam
> ---------------------------------------------------------------------------------
>
>                 Key: WINK-35
>                 URL: https://issues.apache.org/jira/browse/WINK-35
>             Project: Wink
>          Issue Type: Bug
>          Components: Common
>    Affects Versions: 0.1
>            Reporter: Jesse Ramos
>            Priority: Minor
>         Attachments: diff.txt
>
>
> When using the application/x-www-form-urlencoded media type, if a resource method uses the FormParam annotation for one parameter and specifies an entity parameter, the entity parameter value is lost before being injected.  This is a sample method header:
>         @POST
>         @Path("withOneKeyAndEntity")
>         public String getRes(@FormParam("firstkey") String firstKey,
>                              MultivaluedMap<String, String> entity)
> When obtaining the value for the FormParam parameter, the entity is read from the input stream.  When the input stream is later read for the entity parameter the entity is no longer on the input stream.  The read is done in the FormMultivaluedMapProvider entity provider.
> This is an edge case because it's not likely that a user will use the FormParam to get the values of form parameters and also get all the parameters in the entity MultivaluedMap paramter.  However, technically it should be supported.
> Will upload a patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WINK-35) Entity lost when using application/x-www-form-urlencoded media type and FormParam

Posted by "Nadav Fischer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WINK-35?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nadav Fischer resolved WINK-35.
-------------------------------

       Resolution: Invalid
    Fix Version/s: 0.1

I'm closing this bug for now for the reasons mentioned in earlier comments. 

If you feel it's important to handle, please reopen.

> Entity lost when using application/x-www-form-urlencoded media type and FormParam
> ---------------------------------------------------------------------------------
>
>                 Key: WINK-35
>                 URL: https://issues.apache.org/jira/browse/WINK-35
>             Project: Wink
>          Issue Type: Bug
>          Components: Common
>    Affects Versions: 0.1
>            Reporter: Jesse Ramos
>            Assignee: Nadav Fischer
>            Priority: Minor
>             Fix For: 0.1
>
>         Attachments: diff.txt
>
>
> When using the application/x-www-form-urlencoded media type, if a resource method uses the FormParam annotation for one parameter and specifies an entity parameter, the entity parameter value is lost before being injected.  This is a sample method header:
>         @POST
>         @Path("withOneKeyAndEntity")
>         public String getRes(@FormParam("firstkey") String firstKey,
>                              MultivaluedMap<String, String> entity)
> When obtaining the value for the FormParam parameter, the entity is read from the input stream.  When the input stream is later read for the entity parameter the entity is no longer on the input stream.  The read is done in the FormMultivaluedMapProvider entity provider.
> This is an edge case because it's not likely that a user will use the FormParam to get the values of form parameters and also get all the parameters in the entity MultivaluedMap paramter.  However, technically it should be supported.
> Will upload a patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.