You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by "Chris Chabot (JIRA)" <ji...@apache.org> on 2008/09/15 19:07:44 UTC

[jira] Created: (SHINDIG-601) Input format detection

Input format detection
----------------------

                 Key: SHINDIG-601
                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
             Project: Shindig
          Issue Type: Bug
          Components: RESTful API (Java), RESTful API (PHP)
            Reporter: Chris Chabot


Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.

Most logical solution seems to be that we both use :

if ( content type is set)
   use content_type
else if (format query param is set)
   use query param
else
  use json

I *think* that will be what developers would expect :)

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


Re: [jira] Created: (SHINDIG-601) Input format detection

Posted by Chris Chabot <ch...@google.com>.
yep, correct

On Mon, Sep 15, 2008 at 9:14 PM, Ropu <ro...@gmail.com> wrote:

> cool
>
> so for output:
> ?format=foo or JSON as default
>
> for input:
> Check for content type (more priority than ?format=foo)
> then ?format=foo
> or JSON default.
>
> is these ok?
>
> ropu
>
> On Mon, Sep 15, 2008 at 5:06 PM, Chris Chabot <ch...@google.com> wrote:
>
> > Well no not completely.
> >
> > Right now the PHP version uses the content_type header for *input*
> format,
> > and the &format=foo for the output format. The java version uses the
> query
> > param (&format=foo) for both.
> >
> > The proposed solution would allow you to use a "Content-Type:
> > application/xml" for input (iaw xml), and format=json for output (which
> btw
> > would be silly to do, but hey it could happen, php will support this
> > anyhow,
> > the java guys might, or might not allow for the mixing).
> >
> > Only of the Content-Type header is *not* set, it looks at the &format=foo
> > for the *input* (and ofc uses the same param for output too).
> >
> > If no content type is set for input, and no format=foo is set for output,
> > it
> > will assume both to be json.
> >
> > Hope that clears it up :)
> >
> > On Mon, Sep 15, 2008 at 8:08 PM, Ropu <ro...@gmail.com> wrote:
> >
> > > This assumes that input and output will have the same format if the
> > > ?format=foo is set based on the POST/GET format?
> > >
> > >
> > > On Mon, Sep 15, 2008 at 2:07 PM, Chris Chabot (JIRA) <jira@apache.org
> > > >wrote:
> > >
> > > > Input format detection
> > > > ----------------------
> > > >
> > > >                 Key: SHINDIG-601
> > > >                 URL:
> https://issues.apache.org/jira/browse/SHINDIG-601
> > > >             Project: Shindig
> > > >          Issue Type: Bug
> > > >          Components: RESTful API (Java), RESTful API (PHP)
> > > >            Reporter: Chris Chabot
> > > >
> > > >
> > > > Currently PHP uses the content_type header to detect the input
> format.
> > On
> > > > the other hand Java uses the format query param (?format=foo) for the
> > > input
> > > > format selection.
> > > >
> > > > Most logical solution seems to be that we both use :
> > > >
> > > > if ( content type is set)
> > > >   use content_type
> > > > else if (format query param is set)
> > > >   use query param
> > > > else
> > > >  use json
> > > >
> > > > I *think* that will be what developers would expect :)
> > > >
> > > > --
> > > > This message is automatically generated by JIRA.
> > > > -
> > > > You can reply to this email to add a comment to the issue online.
> > > >
> > > >
> > >
> > >
> > > --
> > > .-. --- .--. ..-
> > > R  o  p  u
> > >
> >
>
>
>
> --
> .-. --- .--. ..-
> R  o  p  u
>

Re: [jira] Created: (SHINDIG-601) Input format detection

Posted by Ropu <ro...@gmail.com>.
cool

so for output:
?format=foo or JSON as default

for input:
Check for content type (more priority than ?format=foo)
then ?format=foo
or JSON default.

is these ok?

ropu

On Mon, Sep 15, 2008 at 5:06 PM, Chris Chabot <ch...@google.com> wrote:

> Well no not completely.
>
> Right now the PHP version uses the content_type header for *input* format,
> and the &format=foo for the output format. The java version uses the query
> param (&format=foo) for both.
>
> The proposed solution would allow you to use a "Content-Type:
> application/xml" for input (iaw xml), and format=json for output (which btw
> would be silly to do, but hey it could happen, php will support this
> anyhow,
> the java guys might, or might not allow for the mixing).
>
> Only of the Content-Type header is *not* set, it looks at the &format=foo
> for the *input* (and ofc uses the same param for output too).
>
> If no content type is set for input, and no format=foo is set for output,
> it
> will assume both to be json.
>
> Hope that clears it up :)
>
> On Mon, Sep 15, 2008 at 8:08 PM, Ropu <ro...@gmail.com> wrote:
>
> > This assumes that input and output will have the same format if the
> > ?format=foo is set based on the POST/GET format?
> >
> >
> > On Mon, Sep 15, 2008 at 2:07 PM, Chris Chabot (JIRA) <jira@apache.org
> > >wrote:
> >
> > > Input format detection
> > > ----------------------
> > >
> > >                 Key: SHINDIG-601
> > >                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
> > >             Project: Shindig
> > >          Issue Type: Bug
> > >          Components: RESTful API (Java), RESTful API (PHP)
> > >            Reporter: Chris Chabot
> > >
> > >
> > > Currently PHP uses the content_type header to detect the input format.
> On
> > > the other hand Java uses the format query param (?format=foo) for the
> > input
> > > format selection.
> > >
> > > Most logical solution seems to be that we both use :
> > >
> > > if ( content type is set)
> > >   use content_type
> > > else if (format query param is set)
> > >   use query param
> > > else
> > >  use json
> > >
> > > I *think* that will be what developers would expect :)
> > >
> > > --
> > > This message is automatically generated by JIRA.
> > > -
> > > You can reply to this email to add a comment to the issue online.
> > >
> > >
> >
> >
> > --
> > .-. --- .--. ..-
> > R  o  p  u
> >
>



-- 
.-. --- .--. ..-
R  o  p  u

Re: [jira] Created: (SHINDIG-601) Input format detection

Posted by Chris Chabot <ch...@google.com>.
Well no not completely.

Right now the PHP version uses the content_type header for *input* format,
and the &format=foo for the output format. The java version uses the query
param (&format=foo) for both.

The proposed solution would allow you to use a "Content-Type:
application/xml" for input (iaw xml), and format=json for output (which btw
would be silly to do, but hey it could happen, php will support this anyhow,
the java guys might, or might not allow for the mixing).

Only of the Content-Type header is *not* set, it looks at the &format=foo
for the *input* (and ofc uses the same param for output too).

If no content type is set for input, and no format=foo is set for output, it
will assume both to be json.

Hope that clears it up :)

On Mon, Sep 15, 2008 at 8:08 PM, Ropu <ro...@gmail.com> wrote:

> This assumes that input and output will have the same format if the
> ?format=foo is set based on the POST/GET format?
>
>
> On Mon, Sep 15, 2008 at 2:07 PM, Chris Chabot (JIRA) <jira@apache.org
> >wrote:
>
> > Input format detection
> > ----------------------
> >
> >                 Key: SHINDIG-601
> >                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
> >             Project: Shindig
> >          Issue Type: Bug
> >          Components: RESTful API (Java), RESTful API (PHP)
> >            Reporter: Chris Chabot
> >
> >
> > Currently PHP uses the content_type header to detect the input format. On
> > the other hand Java uses the format query param (?format=foo) for the
> input
> > format selection.
> >
> > Most logical solution seems to be that we both use :
> >
> > if ( content type is set)
> >   use content_type
> > else if (format query param is set)
> >   use query param
> > else
> >  use json
> >
> > I *think* that will be what developers would expect :)
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > You can reply to this email to add a comment to the issue online.
> >
> >
>
>
> --
> .-. --- .--. ..-
> R  o  p  u
>

Re: [jira] Created: (SHINDIG-601) Input format detection

Posted by Ropu <ro...@gmail.com>.
This assumes that input and output will have the same format if the
?format=foo is set based on the POST/GET format?


On Mon, Sep 15, 2008 at 2:07 PM, Chris Chabot (JIRA) <ji...@apache.org>wrote:

> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java), RESTful API (PHP)
>            Reporter: Chris Chabot
>
>
> Currently PHP uses the content_type header to detect the input format. On
> the other hand Java uses the format query param (?format=foo) for the input
> format selection.
>
> Most logical solution seems to be that we both use :
>
> if ( content type is set)
>   use content_type
> else if (format query param is set)
>   use query param
> else
>  use json
>
> I *think* that will be what developers would expect :)
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>


-- 
.-. --- .--. ..-
R  o  p  u

Re: [jira] Commented: (SHINDIG-601) Input format detection

Posted by Cassie <do...@google.com>.
On Wed, Sep 24, 2008 at 10:50 AM, Rajdeep Dua <ra...@google.com> wrote:

> Does this mean application/xml, and application/atom+xml are now supported?
> xml for BeanXmlConverter and atom+xml for atomConverter


i think this is correct.


> Regarding the tests,
> I will have the create an instance for HttpServletRequest -- what is the
> easiest way of doing this? Do I use jetty's implementation class of this
> interface to create a Mock


In DataServiceServlet line 194 you will see the test that already exists.
The current test method does not access the servletRequest yet but there are
a bunch of other examples in that class which do and they use easy mock. So
you can just get the req defined on line 49 and follow the format of the
other tests.



>
> Thanks
> Rajdeep
>
>
> On Wed, Sep 24, 2008 at 11:09 PM, Cassie Doll (JIRA) <jira@apache.org
> >wrote:
>
> >
> >    [
> >
> https://issues.apache.org/jira/browse/SHINDIG-601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634213#action_12634213
> ]
> >
> > Cassie Doll commented on SHINDIG-601:
> > -------------------------------------
> >
> > A couple of comments on this patch -
> >
> > - watch your spacing. if statements should look like this "if
> (contentType
> > != null) {"  space before open paren, no space after open paren. space
> > between close paren and bracket
> > - make sure you aren't using any tab chars
> > - unfortunately, your patch just got out of sync because of another patch
> > which added a BeanAtomConverter... so now atom and xml are separate
> > - this method has a test in DataServiceServletTest. make sure you are
> > running it with mvn test and add new test cases to it.
> > - the "CONTENT_TYPE" string and all other strings should be pulled into
> > constants at the top of the file (next to FORMAT_PARAM and the others)
> >
> > And one last overall comment. I don't think Chris's original description
> on
> > this bug was clear enough. Once we add this content type detection code
> in
> > we really need to use two separate converters. One to parse the incoming
> > post data and one to format our output. So then if you posted xml with
> > format=json things would work as they should. (Seems silly, but it
> shouldn't
> > be hard to do it right I suppose)
> >
> > This shouldn't be too hard to change in the DataServiceServlet - are you
> up
> > for it?
> >
> > Sorry for the large amount of comments and thanks for your help!
> >
> > > Input format detection
> > > ----------------------
> > >
> > >                 Key: SHINDIG-601
> > >                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
> > >             Project: Shindig
> > >          Issue Type: Bug
> > >          Components: RESTful API (Java), RESTful API (PHP)
> > >            Reporter: Chris Chabot
> > >            Priority: Blocker
> > >         Attachments: fix-601-bug.patch, inputContentType.patch
> > >
> > >
> > > Currently PHP uses the content_type header to detect the input format.
> On
> > the other hand Java uses the format query param (?format=foo) for the
> input
> > format selection.
> > > Most logical solution seems to be that we both use :
> > > if ( content type is set)
> > >    use content_type
> > > else if (format query param is set)
> > >    use query param
> > > else
> > >   use json
> > > I *think* that will be what developers would expect :)
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > You can reply to this email to add a comment to the issue online.
> >
> >
>

Re: [jira] Commented: (SHINDIG-601) Input format detection

Posted by Rajdeep Dua <ra...@google.com>.
Does this mean application/xml, and application/atom+xml are now supported?
xml for BeanXmlConverter and atom+xml for atomConverterRegarding the tests,
I will have the create an instance for HttpServletRequest -- what is the
easiest way of doing this? Do I use jetty's implementation class of this
interface to create a Mock

Thanks
Rajdeep


On Wed, Sep 24, 2008 at 11:09 PM, Cassie Doll (JIRA) <ji...@apache.org>wrote:

>
>    [
> https://issues.apache.org/jira/browse/SHINDIG-601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634213#action_12634213]
>
> Cassie Doll commented on SHINDIG-601:
> -------------------------------------
>
> A couple of comments on this patch -
>
> - watch your spacing. if statements should look like this "if (contentType
> != null) {"  space before open paren, no space after open paren. space
> between close paren and bracket
> - make sure you aren't using any tab chars
> - unfortunately, your patch just got out of sync because of another patch
> which added a BeanAtomConverter... so now atom and xml are separate
> - this method has a test in DataServiceServletTest. make sure you are
> running it with mvn test and add new test cases to it.
> - the "CONTENT_TYPE" string and all other strings should be pulled into
> constants at the top of the file (next to FORMAT_PARAM and the others)
>
> And one last overall comment. I don't think Chris's original description on
> this bug was clear enough. Once we add this content type detection code in
> we really need to use two separate converters. One to parse the incoming
> post data and one to format our output. So then if you posted xml with
> format=json things would work as they should. (Seems silly, but it shouldn't
> be hard to do it right I suppose)
>
> This shouldn't be too hard to change in the DataServiceServlet - are you up
> for it?
>
> Sorry for the large amount of comments and thanks for your help!
>
> > Input format detection
> > ----------------------
> >
> >                 Key: SHINDIG-601
> >                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
> >             Project: Shindig
> >          Issue Type: Bug
> >          Components: RESTful API (Java), RESTful API (PHP)
> >            Reporter: Chris Chabot
> >            Priority: Blocker
> >         Attachments: fix-601-bug.patch, inputContentType.patch
> >
> >
> > Currently PHP uses the content_type header to detect the input format. On
> the other hand Java uses the format query param (?format=foo) for the input
> format selection.
> > Most logical solution seems to be that we both use :
> > if ( content type is set)
> >    use content_type
> > else if (format query param is set)
> >    use query param
> > else
> >   use json
> > I *think* that will be what developers would expect :)
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

[jira] Updated: (SHINDIG-601) Input format detection

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

bruno rovagnati updated SHINDIG-601:
------------------------------------

    Attachment: inputContentType.patch

This patch should add the ?format=foo for the input type second choice in the PHP version

> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java), RESTful API (PHP)
>            Reporter: Chris Chabot
>         Attachments: inputContentType.patch
>
>
> Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.
> Most logical solution seems to be that we both use :
> if ( content type is set)
>    use content_type
> else if (format query param is set)
>    use query param
> else
>   use json
> I *think* that will be what developers would expect :)

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


[jira] Commented: (SHINDIG-601) Input format detection

Posted by "Kevin Brown (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634229#action_12634229 ] 

Kevin Brown commented on SHINDIG-601:
-------------------------------------

You could summarize that by just pointing to http://cwiki.apache.org/SHINDIGxSITE/java-style.html :)

> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java), RESTful API (PHP)
>            Reporter: Chris Chabot
>            Priority: Blocker
>         Attachments: fix-601-bug.patch, inputContentType.patch
>
>
> Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.
> Most logical solution seems to be that we both use :
> if ( content type is set)
>    use content_type
> else if (format query param is set)
>    use query param
> else
>   use json
> I *think* that will be what developers would expect :)

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


[jira] Updated: (SHINDIG-601) Input format detection

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

rajdeep dua updated SHINDIG-601:
--------------------------------

    Attachment:     (was: fix-601-bug.patch)

> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java), RESTful API (PHP)
>            Reporter: Chris Chabot
>            Priority: Blocker
>         Attachments: inputContentType.patch
>
>
> Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.
> Most logical solution seems to be that we both use :
> if ( content type is set)
>    use content_type
> else if (format query param is set)
>    use query param
> else
>   use json
> I *think* that will be what developers would expect :)

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


[jira] Commented: (SHINDIG-601) Input format detection

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12641217#action_12641217 ] 

Ian Boston commented on SHINDIG-601:
------------------------------------

I will look at it,

I think there may be some formatting to fix and it might need some massaging to get it to work with the new atom bean... but I will have a go.

Ian

> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java)
>            Reporter: Chris Chabot
>            Assignee: Ian Boston
>            Priority: Blocker
>         Attachments: fix-601-bug.patch, inputContentType.patch
>
>
> Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.
> Most logical solution seems to be that we both use :
> if ( content type is set)
>    use content_type
> else if (format query param is set)
>    use query param
> else
>   use json
> I *think* that will be what developers would expect :)

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


[jira] Assigned: (SHINDIG-601) Input format detection

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

Ian Boston reassigned SHINDIG-601:
----------------------------------

    Assignee: Ian Boston

> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java)
>            Reporter: Chris Chabot
>            Assignee: Ian Boston
>            Priority: Blocker
>         Attachments: fix-601-bug.patch, inputContentType.patch
>
>
> Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.
> Most logical solution seems to be that we both use :
> if ( content type is set)
>    use content_type
> else if (format query param is set)
>    use query param
> else
>   use json
> I *think* that will be what developers would expect :)

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


[jira] Updated: (SHINDIG-601) Input format detection

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

rajdeep dua updated SHINDIG-601:
--------------------------------

    Attachment: DataServiceServlet.java

Updated DataServiceServlet to support
HttpRequest Headers : 
   Key - CONTENT_TYPE, 
   value - application/atom+xml 
                application/json

    Choose BeanXmlConverter for atom+xml and json otherwise
    If content type is not set then check format parameter.



> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java), RESTful API (PHP)
>            Reporter: Chris Chabot
>            Priority: Blocker
>         Attachments: DataServiceServlet.java, inputContentType.patch
>
>
> Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.
> Most logical solution seems to be that we both use :
> if ( content type is set)
>    use content_type
> else if (format query param is set)
>    use query param
> else
>   use json
> I *think* that will be what developers would expect :)

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


[jira] Updated: (SHINDIG-601) Input format detection

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

rajdeep dua updated SHINDIG-601:
--------------------------------

    Attachment: fix-601-bug.patch

Made the relevant changes

Now we have 3 different converters, two ways of specifying : format and content_type.
Also added new test cases which check for content_type related scenarios.
also updated code according to the style guidelines

> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java), RESTful API (PHP)
>            Reporter: Chris Chabot
>            Priority: Blocker
>         Attachments: fix-601-bug.patch, inputContentType.patch
>
>
> Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.
> Most logical solution seems to be that we both use :
> if ( content type is set)
>    use content_type
> else if (format query param is set)
>    use query param
> else
>   use json
> I *think* that will be what developers would expect :)

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


[jira] Commented: (SHINDIG-601) Input format detection

Posted by "Cassie Doll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634213#action_12634213 ] 

Cassie Doll commented on SHINDIG-601:
-------------------------------------

A couple of comments on this patch - 

- watch your spacing. if statements should look like this "if (contentType != null) {"  space before open paren, no space after open paren. space between close paren and bracket
- make sure you aren't using any tab chars
- unfortunately, your patch just got out of sync because of another patch which added a BeanAtomConverter... so now atom and xml are separate
- this method has a test in DataServiceServletTest. make sure you are running it with mvn test and add new test cases to it. 
- the "CONTENT_TYPE" string and all other strings should be pulled into constants at the top of the file (next to FORMAT_PARAM and the others)

And one last overall comment. I don't think Chris's original description on this bug was clear enough. Once we add this content type detection code in we really need to use two separate converters. One to parse the incoming post data and one to format our output. So then if you posted xml with format=json things would work as they should. (Seems silly, but it shouldn't be hard to do it right I suppose)

This shouldn't be too hard to change in the DataServiceServlet - are you up for it?

Sorry for the large amount of comments and thanks for your help!

> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java), RESTful API (PHP)
>            Reporter: Chris Chabot
>            Priority: Blocker
>         Attachments: fix-601-bug.patch, inputContentType.patch
>
>
> Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.
> Most logical solution seems to be that we both use :
> if ( content type is set)
>    use content_type
> else if (format query param is set)
>    use query param
> else
>   use json
> I *think* that will be what developers would expect :)

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


[jira] Closed: (SHINDIG-601) Input format detection

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

Ian Boston closed SHINDIG-601.
------------------------------

    Resolution: Fixed

Patch applied, formatting corrected and verified build

> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java)
>            Reporter: Chris Chabot
>            Assignee: Ian Boston
>            Priority: Blocker
>         Attachments: fix-601-bug.patch, inputContentType.patch
>
>
> Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.
> Most logical solution seems to be that we both use :
> if ( content type is set)
>    use content_type
> else if (format query param is set)
>    use query param
> else
>   use json
> I *think* that will be what developers would expect :)

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


[jira] Commented: (SHINDIG-601) Input format detection

Posted by "Bob Evans (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639961#action_12639961 ] 

Bob Evans commented on SHINDIG-601:
-----------------------------------

Can someone apply this patch so that we can mark this bug closed - It's a blocker for finishing 0.8.1

Thanks,
Bob Evans

> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java), RESTful API (PHP)
>            Reporter: Chris Chabot
>            Priority: Blocker
>         Attachments: fix-601-bug.patch, inputContentType.patch
>
>
> Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.
> Most logical solution seems to be that we both use :
> if ( content type is set)
>    use content_type
> else if (format query param is set)
>    use query param
> else
>   use json
> I *think* that will be what developers would expect :)

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


[jira] Commented: (SHINDIG-601) Input format detection

Posted by "Chris Chabot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12640003#action_12640003 ] 

Chris Chabot commented on SHINDIG-601:
--------------------------------------

this has been implemented in the php version, so once the java version catches up feel free to close the issue

> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java)
>            Reporter: Chris Chabot
>            Priority: Blocker
>         Attachments: fix-601-bug.patch, inputContentType.patch
>
>
> Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.
> Most logical solution seems to be that we both use :
> if ( content type is set)
>    use content_type
> else if (format query param is set)
>    use query param
> else
>   use json
> I *think* that will be what developers would expect :)

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


[jira] Updated: (SHINDIG-601) Input format detection

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

rajdeep dua updated SHINDIG-601:
--------------------------------

    Attachment:     (was: DataServiceServlet.java)

> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java), RESTful API (PHP)
>            Reporter: Chris Chabot
>            Priority: Blocker
>         Attachments: inputContentType.patch
>
>
> Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.
> Most logical solution seems to be that we both use :
> if ( content type is set)
>    use content_type
> else if (format query param is set)
>    use query param
> else
>   use json
> I *think* that will be what developers would expect :)

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


[jira] Updated: (SHINDIG-601) Input format detection

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

Chris Chabot updated SHINDIG-601:
---------------------------------

    Component/s:     (was: RESTful API (PHP))

> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java)
>            Reporter: Chris Chabot
>            Priority: Blocker
>         Attachments: fix-601-bug.patch, inputContentType.patch
>
>
> Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.
> Most logical solution seems to be that we both use :
> if ( content type is set)
>    use content_type
> else if (format query param is set)
>    use query param
> else
>   use json
> I *think* that will be what developers would expect :)

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


[jira] Updated: (SHINDIG-601) Input format detection

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

rajdeep dua updated SHINDIG-601:
--------------------------------

    Attachment: fix-601-bug.patch

removed java file -- added .patch file

Updated DataServiceServlet to support
HttpRequest Headers :
  Key - CONTENT_TYPE,
  value - application/atom+xml
               application/json

   Choose BeanXmlConverter for atom+xml and json otherwise
   If content type is not set then check format parameter.

> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java), RESTful API (PHP)
>            Reporter: Chris Chabot
>            Priority: Blocker
>         Attachments: fix-601-bug.patch, inputContentType.patch
>
>
> Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.
> Most logical solution seems to be that we both use :
> if ( content type is set)
>    use content_type
> else if (format query param is set)
>    use query param
> else
>   use json
> I *think* that will be what developers would expect :)

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


[jira] Updated: (SHINDIG-601) Input format detection

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

Cassie Doll updated SHINDIG-601:
--------------------------------

    Priority: Blocker  (was: Major)

> Input format detection
> ----------------------
>
>                 Key: SHINDIG-601
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-601
>             Project: Shindig
>          Issue Type: Bug
>          Components: RESTful API (Java), RESTful API (PHP)
>            Reporter: Chris Chabot
>            Priority: Blocker
>         Attachments: inputContentType.patch
>
>
> Currently PHP uses the content_type header to detect the input format. On the other hand Java uses the format query param (?format=foo) for the input format selection.
> Most logical solution seems to be that we both use :
> if ( content type is set)
>    use content_type
> else if (format query param is set)
>    use query param
> else
>   use json
> I *think* that will be what developers would expect :)

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