You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by "Dolan Halbrook (JIRA)" <no...@atlassian.com> on 2007/06/08 23:04:55 UTC

[Roller-JIRA] Created: (ROL-1444) Output JSON from FeedServlet

Output JSON from FeedServlet
----------------------------

                 Key: ROL-1444
                 URL: http://opensource.atlassian.com/projects/roller/browse/ROL-1444
             Project: Roller
          Issue Type: Improvement
          Components: Newsfeed Syndication
    Affects Versions: 3.1.1, 3.2
         Environment: n/a
            Reporter: Dolan Halbrook
            Assignee: Roller Unassigned


It would be useful to me to have a JSON view of the feeds generated from FeedServlet.  I'd be willing to do the work to make this happen and donate it back, but as it is to make this happen I'd have to sublcass virtually all of the FeedServlet and I'm trying to avoid too much customization -- it would be much nicer to roll this back into Roller.

Basically as I see it this would involve modifying the FeedServlet and creating several .vm files (such as weblog-entries-json.vm) for the JSON views.  Not sure how to handle the XSLT view yet.

Does anyone see any good reason not to do this?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/roller/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[Roller-JIRA] Commented: (ROL-1444) Output JSON from FeedServlet

Posted by "Allen Gilliland (JIRA)" <no...@atlassian.com>.
    [ http://opensource.atlassian.com/projects/roller/browse/ROL-1444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_13803 ] 

Allen Gilliland commented on ROL-1444:
--------------------------------------

I like the idea of having support for JSON as an output format for weblog data.  I don't think this really has to have anything to do with the feeds though since JSON isn't so much about feeds as it is just another data output format (other than html or xml).

I think the best approach would be to create a new JSONServlet which can use its own templates for doing JSON output and we would probably set it up so that it would allow for grabbing entry data and comment data.  I suppose we could provide access to other data such as bookmark data, referrer data, etc, but i'm not sure what the use case would be for that stuff.

Urls might be something like ...

/<weblog>/json/entries
/<weblog>/json/entries?anchor=<anchor>
/<weblog>/json/entries?category=<category>
/<weblog>/json/comments
/<weblog>/json/comments?anchor=<anchor>

I'm not much of a JSON expert, so if someone wants to come up with the JSON formatting I would be willing to do the JSONServlet and all the other stuff.


> Output JSON from FeedServlet
> ----------------------------
>
>                 Key: ROL-1444
>                 URL: http://opensource.atlassian.com/projects/roller/browse/ROL-1444
>             Project: Roller
>          Issue Type: Improvement
>          Components: Newsfeed Syndication
>    Affects Versions: 3.1.1, 3.2
>         Environment: n/a
>            Reporter: Dolan Halbrook
>            Assignee: Roller Unassigned
>
> It would be useful to me to have a JSON view of the feeds generated from FeedServlet.  I'd be willing to do the work to make this happen and donate it back, but as it is to make this happen I'd have to sublcass virtually all of the FeedServlet and I'm trying to avoid too much customization -- it would be much nicer to roll this back into Roller.
> Basically as I see it this would involve modifying the FeedServlet and creating several .vm files (such as weblog-entries-json.vm) for the JSON views.  Not sure how to handle the XSLT view yet.
> Does anyone see any good reason not to do this?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/roller/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[Roller-JIRA] Commented: (ROL-1444) Output JSON from FeedServlet

Posted by "Allen Gilliland (JIRA)" <no...@atlassian.com>.
    [ http://opensource.atlassian.com/projects/roller/browse/ROL-1444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_13810 ] 

Allen Gilliland commented on ROL-1444:
--------------------------------------

Using a JSON library sounds interesting and would definitely cut into the work load a bit, but my fear would be that the libraries don't give you enough control over the output format and if they do something wrong you SOL.  Looking at the Xstream stuff it doesn't look like you get to make many choices, you basically just say turn object WeblogEntry into JSON and hope it comes out correctly, so that would make me a little nervous.

My preference would probably be to just use a velocity template so that we can control the format ourselves, make sure only the appropriate data is included, and also make sure that when things change from version to version that they remain backwards compatible.

If you are willing to do that part then I can do the rest.  So if can put together some velocity templates which would be able to accept an entry or collection of entries and comment or collection of comments and output them in json format then that should give me enough to get started.

> Output JSON from FeedServlet
> ----------------------------
>
>                 Key: ROL-1444
>                 URL: http://opensource.atlassian.com/projects/roller/browse/ROL-1444
>             Project: Roller
>          Issue Type: Improvement
>          Components: Newsfeed Syndication
>    Affects Versions: 3.1.1, 3.2
>         Environment: n/a
>            Reporter: Dolan Halbrook
>            Assignee: Roller Unassigned
>
> It would be useful to me to have a JSON view of the feeds generated from FeedServlet.  I'd be willing to do the work to make this happen and donate it back, but as it is to make this happen I'd have to sublcass virtually all of the FeedServlet and I'm trying to avoid too much customization -- it would be much nicer to roll this back into Roller.
> Basically as I see it this would involve modifying the FeedServlet and creating several .vm files (such as weblog-entries-json.vm) for the JSON views.  Not sure how to handle the XSLT view yet.
> Does anyone see any good reason not to do this?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/roller/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[Roller-JIRA] Commented: (ROL-1444) Output JSON from FeedServlet

Posted by "Dolan Halbrook (JIRA)" <no...@atlassian.com>.
    [ http://opensource.atlassian.com/projects/roller/browse/ROL-1444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_13811 ] 

Dolan Halbrook commented on ROL-1444:
-------------------------------------

Hi Allen,

Have a look at this link:

http://xstream.codehaus.org/manual-tweaking-output.html

XStream offers quite a few options in tweaking XML output -- I'll do some work to see how much this applies to the JSONOutputStream, since I have to do this for another project anyways.

I just like the fact that we could essentially expose an XStream instance as a Velocity tool and not worry about the model change too much in the future, but I'm ok with going the straight Velocity route also, since I've used both kinds of solutions in the past.

> Output JSON from FeedServlet
> ----------------------------
>
>                 Key: ROL-1444
>                 URL: http://opensource.atlassian.com/projects/roller/browse/ROL-1444
>             Project: Roller
>          Issue Type: Improvement
>          Components: Newsfeed Syndication
>    Affects Versions: 3.1.1, 3.2
>         Environment: n/a
>            Reporter: Dolan Halbrook
>            Assignee: Roller Unassigned
>
> It would be useful to me to have a JSON view of the feeds generated from FeedServlet.  I'd be willing to do the work to make this happen and donate it back, but as it is to make this happen I'd have to sublcass virtually all of the FeedServlet and I'm trying to avoid too much customization -- it would be much nicer to roll this back into Roller.
> Basically as I see it this would involve modifying the FeedServlet and creating several .vm files (such as weblog-entries-json.vm) for the JSON views.  Not sure how to handle the XSLT view yet.
> Does anyone see any good reason not to do this?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/roller/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[Roller-JIRA] Commented: (ROL-1444) Output JSON from FeedServlet

Posted by "Dolan Halbrook (JIRA)" <no...@atlassian.com>.
    [ http://opensource.atlassian.com/projects/roller/browse/ROL-1444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_13808 ] 

Dolan Halbrook commented on ROL-1444:
-------------------------------------

Hi Allen,

Thanks for responding.  There are several ways of creating data using the JSON syntax.  The most straightforward is probably to use the libraries available here:

http://www.json.org/java/index.html

Even easier might be to  use the latest version of XStream, which has some JSON support:

http://xstream.codehaus.org/

Finally, one could just create the JSON in Velocity, similar to the way the feeds are created.

The best source of JSON documentation is really here:

http://www.json.org/

... and it looks like there are quite a few other libraries available besides the ones I've mentioned.

As I said before, I'd be happy to help work on this -- just let me know which parts you'd like me to take care of.





> Output JSON from FeedServlet
> ----------------------------
>
>                 Key: ROL-1444
>                 URL: http://opensource.atlassian.com/projects/roller/browse/ROL-1444
>             Project: Roller
>          Issue Type: Improvement
>          Components: Newsfeed Syndication
>    Affects Versions: 3.1.1, 3.2
>         Environment: n/a
>            Reporter: Dolan Halbrook
>            Assignee: Roller Unassigned
>
> It would be useful to me to have a JSON view of the feeds generated from FeedServlet.  I'd be willing to do the work to make this happen and donate it back, but as it is to make this happen I'd have to sublcass virtually all of the FeedServlet and I'm trying to avoid too much customization -- it would be much nicer to roll this back into Roller.
> Basically as I see it this would involve modifying the FeedServlet and creating several .vm files (such as weblog-entries-json.vm) for the JSON views.  Not sure how to handle the XSLT view yet.
> Does anyone see any good reason not to do this?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/roller/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[Roller-JIRA] Commented: (ROL-1444) Output JSON from FeedServlet

Posted by "Dolan Halbrook (JIRA)" <no...@atlassian.com>.
    [ http://opensource.atlassian.com/projects/roller/browse/ROL-1444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_13814 ] 

Dolan Halbrook commented on ROL-1444:
-------------------------------------

One more thing to consider:

I've been using Spring MVC a lot and it allows you to easily merge content-type and view technology into a bundle.  This way you don't have the extra logic of determining this in the servlet.  

For example, you might define a base view like:

<bean id="vel-parent" abstract="true" abstract="true"
          class="org.springframework.web.servlet.view.velocity.VelocityToolboxView">
        <property name="contentType" value="text/html"/>
        <property name="toolboxConfigLocation" value="/WEB-INF/velocity/toolbox.xml"/>
    </bean>

but you could easily create "feed " views like:

<bean id="sonDetail" parent="vel-parent">
        <property name="contentType" value="text/javascript"/>
        <property name="url" value="/views/html/jsonDetail.vm"/>
    </bean>

    <bean id="xmlDetail" parent="vel-parent">
        <property name="contentType" value="text/xml"/>
        <property name="url" value="/views/html/xmlDetail.vm"/>
    </bean>


However, i'm not sure how much Spring is welcome in the Roller project, not to mention Spring MVC.  I'm a big fan, but I understand it other methods are preferred.



> Output JSON from FeedServlet
> ----------------------------
>
>                 Key: ROL-1444
>                 URL: http://opensource.atlassian.com/projects/roller/browse/ROL-1444
>             Project: Roller
>          Issue Type: Improvement
>          Components: Newsfeed Syndication
>    Affects Versions: 3.1.1, 3.2
>         Environment: n/a
>            Reporter: Dolan Halbrook
>            Assignee: Roller Unassigned
>
> It would be useful to me to have a JSON view of the feeds generated from FeedServlet.  I'd be willing to do the work to make this happen and donate it back, but as it is to make this happen I'd have to sublcass virtually all of the FeedServlet and I'm trying to avoid too much customization -- it would be much nicer to roll this back into Roller.
> Basically as I see it this would involve modifying the FeedServlet and creating several .vm files (such as weblog-entries-json.vm) for the JSON views.  Not sure how to handle the XSLT view yet.
> Does anyone see any good reason not to do this?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/roller/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira