Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0 M4
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      Create a view that outputs its model as a JSON object. This will help AJAX enabled applications to transfer less bytes as the JSON format is more compact that XML. It also allows for quick object creation using eval(), no need for extra XML parsing.

      I have created such view (JsonView) using the json-simple library (http://json.org/java) and would like to contribute it.

      1. JsonView.java
        3 kB
        Domenico Testa
      2. SmdServiceExporter.java
        5 kB
        Rogier Goede

        Issue Links

          Activity

          Hide
          Lari Hotari added a comment -

          Please checkout the features in http://spring-json.sourceforge.net/ . Besides json view, it also supports AJAX form validation and submission using spring mvc. It would be nice to get these features in standard Spring MVC. Spring-Json works well with ExtJS (with a little tweaking).

          Show
          Lari Hotari added a comment - Please checkout the features in http://spring-json.sourceforge.net/ . Besides json view, it also supports AJAX form validation and submission using spring mvc. It would be nice to get these features in standard Spring MVC. Spring-Json works well with ExtJS (with a little tweaking).
          Hide
          Andres Almiray added a comment -

          Speaking for the JsonView code attached to this issue (latest version [1.0.1] available at http://sourceforge.net/projects/json-lib) you may configure it as you would with any other SpringMVC view. It also accepts a JsonConfig bean to further customize how beans must be serialized.
          JsonView is responsible for exporting data as JSON only (it is a view after all), any AJAX integration must be handled by your own components, thus giving full freedom to choose what makes more sense for your app.

          Show
          Andres Almiray added a comment - Speaking for the JsonView code attached to this issue (latest version [1.0.1] available at http://sourceforge.net/projects/json-lib ) you may configure it as you would with any other SpringMVC view. It also accepts a JsonConfig bean to further customize how beans must be serialized. JsonView is responsible for exporting data as JSON only (it is a view after all), any AJAX integration must be handled by your own components, thus giving full freedom to choose what makes more sense for your app.
          Hide
          Paul Sundling added a comment -

          I see there is also a project that seems to solve this called spring-json http://spring-json.sourceforge.net/ which supports both sojo and json-lib.

          Which implementation, or yet a third solution will be included in Spring 3?

          Show
          Paul Sundling added a comment - I see there is also a project that seems to solve this called spring-json http://spring-json.sourceforge.net/ which supports both sojo and json-lib. Which implementation, or yet a third solution will be included in Spring 3?
          Hide
          Kirill Kovalchuk added a comment -

          Rogier, what is the status for SmdServiceExporter?

          I'm searching scalable, supportable solution for my projects to build a bridge between Browser and Spring's Services - I just want to be able to call remote method using Javacript and searching for an appropriate ServiceExporter.

          In this issue we can see two solutions:

          1) SmdServiceExporter
          Client javascript library: DOJO
          Service description: SMD format
          Data transfer protocol: JSON-RPC
          Server-side library: json-lib

          2) JSONRPCServiceExporter.
          Client javascript library: prototypejs
          Service description: generated javascript code using prototypejs library
          Data transfer protocol: JSON-serialized org.springframework.remoting.support.RemoteInvocation class
          Server-side library: jsonrpc

          Advantages of SmdServiceExporter:

          • don't stick to exact javascript library on the client
          • known formats are used (SMD and JSON-RPC)
          • small size of source code

          Disadvantages of SmdServiceExporter:

          • no samples
          • no unit tests
          • no support for clients written in plain java

          Advantages of JSONRPCServiceExporter:

          • unit tests
          • support for clients written in plain java+spring

          Disadvantages of JSONRPCServiceExporter:

          • too much javascript code (because of using poor prototypejs)
          • stick to prototypejs while getting service description
          • using "java-like" data transfer protocol style tied to RemoteInvocation class

          Conclusion: I think SmdServiceExporter is better than JSONRPCServiceExporter for a long perspective because:

          • dojo library is much better in use than prototypejs (avoid looking at UI and so on)
          • SmdServiceExporter uses more standards than JSONRPCServiceExporter

          But I found some difficulties compiling SmdServiceExporter with latest versions of dojo and json-lib and I think that it doesn't support complex types. So if Rogier would share us updated version it would be appreciated.

          BR
          Kirill

          Show
          Kirill Kovalchuk added a comment - Rogier, what is the status for SmdServiceExporter? I'm searching scalable, supportable solution for my projects to build a bridge between Browser and Spring's Services - I just want to be able to call remote method using Javacript and searching for an appropriate ServiceExporter. In this issue we can see two solutions: 1) SmdServiceExporter Client javascript library: DOJO Service description: SMD format Data transfer protocol: JSON-RPC Server-side library: json-lib 2) JSONRPCServiceExporter. Client javascript library: prototypejs Service description: generated javascript code using prototypejs library Data transfer protocol: JSON-serialized org.springframework.remoting.support.RemoteInvocation class Server-side library: jsonrpc Advantages of SmdServiceExporter: don't stick to exact javascript library on the client known formats are used (SMD and JSON-RPC) small size of source code Disadvantages of SmdServiceExporter: no samples no unit tests no support for clients written in plain java Advantages of JSONRPCServiceExporter: unit tests support for clients written in plain java+spring Disadvantages of JSONRPCServiceExporter: too much javascript code (because of using poor prototypejs) stick to prototypejs while getting service description using "java-like" data transfer protocol style tied to RemoteInvocation class Conclusion: I think SmdServiceExporter is better than JSONRPCServiceExporter for a long perspective because: dojo library is much better in use than prototypejs (avoid looking at UI and so on) SmdServiceExporter uses more standards than JSONRPCServiceExporter But I found some difficulties compiling SmdServiceExporter with latest versions of dojo and json-lib and I think that it doesn't support complex types. So if Rogier would share us updated version it would be appreciated. BR Kirill
          Hide
          Brian C. Dilley added a comment -

          I've created a project for a springframework JSON-RPC based RemoteExporter at the following URL:

          http://code.google.com/p/spring-jsonrpc/

          It's based on the specification being written at:

          http://groups.google.com/group/json-rpc

          note: The code for this project is not the same code attached to this issue - it's completely different. I just figured I'd let everyone know that it exists

          Show
          Brian C. Dilley added a comment - I've created a project for a springframework JSON-RPC based RemoteExporter at the following URL: http://code.google.com/p/spring-jsonrpc/ It's based on the specification being written at: http://groups.google.com/group/json-rpc note: The code for this project is not the same code attached to this issue - it's completely different. I just figured I'd let everyone know that it exists

            People

            • Assignee:
              Arjen Poutsma
              Reporter:
              Andres Almiray
              Last updater:
              Trevor Marshall
            • Votes:
              26 Vote for this issue
              Watchers:
              26 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                5 years, 5 weeks, 1 day ago

                Time Tracking

                Estimated:
                Original Estimate - 3d
                3d
                Remaining:
                Remaining Estimate - 3d
                3d
                Logged:
                Time Spent - Not Specified
                Not Specified