Announcement Announcement Module
Collapse
No announcement yet.
REST/JSON is not working out of the box Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • REST/JSON is not working out of the box

    Roo script:
    project --topLevelPackage com.xyz.restapi
    jpa setup --provider OPENJPA --database MYSQL --hostName localhost --databaseName test --userName root
    entity jpa --class ~.model.Person --testAutomatically
    field string --fieldName name --notNull
    field string --fieldName password --notNull
    field string --fieldName email --notNull
    web mvc setup
    web mvc scaffold --class ~.web.PersonController
    service --interface ~.service.PersonService --entity ~.model.Person
    web mvc all --package ~.web
    json all --deepSerialize
    quit

    > mvn tomcat:run

    Simple REST Client
    ---------------------
    REQUEST
    Type: GET
    Header: none
    URL: http://localhost:8080/restapi/people/182

    RESPONSE
    Status: 200 OK

    Headers:
    Date: Fri, 29 Mar 2013 20:35:43 GMT
    Server: Apache-Coyote/1.1
    Content-Length: 4075
    Content-Language: en-US
    Content-Type: text/html;charset=UTF-8

    Data:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE HTML SYSTEM "about:legacy-compat">
    <html><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><meta content="IE=8" http-equiv="X-UA-Compatible"/><link href="/restapi/resources/dijit/themes/tundra/tundra.css" type="text/css" rel="stylesheet"/><link href="/restapi/resources/styles/standard.css" media="screen" type="text/css" rel="stylesheet"/><link href="/restapi/resources/images/favicon.ico" rel="SHORTCUT ICON"/><script type="text/javascript">var djConfig = {parseOnLoad: false, isDebug: false, locale: 'en-us'};</script><script type="text/javascript" src="/restapi/resources/dojo/dojo.js"></script><script type="text/javascript" src="/restapi/resources/spring/Spring.js"></script><script type="text/javascript" src="/restapi/resources/spring/Spring-Dojo.js"></script><script type="text/javascript" language="JavaScript">dojo.require("dojo.parser");</script><title>Welcome to Restapi</title></head><body class="tundra spring"><div id="wrapper"><div version="2.0" id="header"><a title="Home" name="Home" href="/restapi/"><img src="/restapi/resources/images/banner-graphic.png"/></a></div><div version="2.0" id="menu"><ul id="_menu"><li id="c_person"><h2>Person</h2><ul><li id="i_person_new"><a title="Create new Person" href="/restapi/people?form">Create new Person</a></li><li id="i_person_list"><a title="List all People" href="/restapi/people?page=1&amp;size=10">List all People</a></li></ul></li></ul></div><div id="main"><div version="2.0"><script type="text/javascript">dojo.require('dijit.TitlePane');</script><div id="_title_ps_com_xyz_restapi_model_Person_id"><script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : '_title_ps_com_xyz_restapi_model_Person_id', widgetType : 'dijit.TitlePane', widgetAttrs : {title: 'Show Person', open: true}})); </script><div id="_s_com_xyz_restapi_model_Person_name_id"><label for="_name_id">Name
            :
          </label><div id="_s_com_xyz_restapi_model_Person_name_name_id" class="box">update1</div></div><br/><div id="_s_com_xyz_restapi_model_Person_password_id"><label for="_password_id">Password
            :
          </label><div id="_s_com_xyz_restapi_model_Person_password_password_id" class="box">xyz</div></div><br/><div id="_s_com_xyz_restapi_model_Person_email_id"><label for="_email_id">Email
            :
          </label><div id="_s_com_xyz_restapi_model_Person_email_email_id" class="box">[email protected]</div></div><br/><div class="quicklinks"><span><form id="command" action="/restapi/people/182" method="post"><input type="hidden" name="_method" value="DELETE"/><input onclick="return confirm('Are you sure want to delete this item?');" value="Delete Person" type="image" title="Delete Person" src="/restapi/resources/images/delete.png" class="image" alt="Delete Person"/></form></span><span><a title="Update Person" alt="Update Person" href="/restapi/people/182?form"><img title="Update Person" src="/restapi/resources/images/update.png" class="image" alt="Update Person"/></a></span><span><a title="Create new Person" alt="Create new Person" href="/restapi/people?form"><img title="Create new Person" src="/restapi/resources/images/create.png" class="image" alt="Create new Person"/></a></span><span><a title="List all People" alt="List all People" href="/restapi/people"><img title="List all People" src="/restapi/resources/images/list.png" class="image" alt="List all People"/></a></span></div></div></div><div version="2.0" id="footer"><span><a href="/restapi/">Home</a></span><span id="language"> | Language: <a title="Switch language to English" href="?lang=en"><img alt="Switch language to English" src="/restapi/resources/images/en.png" class="flag"/></a> </span><span> | Theme: <a title="standard" href="?theme=standard">standard</a> | <a title="alt" href="?theme=alt">alt</a></span><span><a title="Sponsored by SpringSource" href="http://springsource.com"><img src="/restapi/resources/images/springsource-logo.png" alt="Sponsored by SpringSource" align="right"/></a></span></div></div></div></body></html>
    Are the Roo commands wrong or is this just not working as advertised?
Working...
X