Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5936509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:24:31+00:00 2026-05-22T15:24:31+00:00

I have been stuck at this for a while. I have a smartgwt widget

  • 0

I have been stuck at this for a while. I have a smartgwt widget listgrid tied to a restdatasource. I have mapped its URLs to my spring services. However I cannot figure out how to retrieve the JSON dsrequest on spring server side. Even my dispatcher servlet does not contain the params.

My restdatasource is as follows:

RestDataSource myDS = new RestDataSource() {  
                @Override  
                protected Object transformRequest(DSRequest dsRequest) {
                    dsRequest.setContentType("application/json");
                    JavaScriptObject jso = dsRequest.getData();
            String s1 = JSON.encode(jso);
            return s1;
//                  return super.transformRequest(dsRequest);  
                }  
                @Override  
                protected void transformResponse(DSResponse response, DSRequest request, Object data) {  
                    super.transformResponse(response, request, data);  
                }  
            };

Then on this datasource set the operations as follows:

// set the operation on the datasource  
            OperationBinding fetch = new OperationBinding();  
            fetch.setOperationType(DSOperationType.FETCH);  
            fetch.setDataProtocol(DSProtocol.POSTMESSAGE);  
            OperationBinding add = new OperationBinding();  
            add.setOperationType(DSOperationType.ADD);  
            add.setDataProtocol(DSProtocol.POSTMESSAGE);  
            OperationBinding update = new OperationBinding();  
            update.setOperationType(DSOperationType.UPDATE);  
            update.setDataProtocol(DSProtocol.POSTPARAMS);  
            OperationBinding remove = new OperationBinding();  
            remove.setOperationType(DSOperationType.REMOVE);  
            remove.setDataProtocol(DSProtocol.POSTMESSAGE);  
            myDS.setOperationBindings(fetch, add, update, remove);
            myDS.setDataFormat(DSDataFormat.JSON);
//          myDS.setDataProtocol(DSProtocol.POSTMESSAGE);

Set some fields in the datasource:

// set the values for the datasource
            DataSourceTextField Id = new DataSourceTextField("Id", "Id");
            Id.setPrimaryKey(true);  
            Id.setCanEdit(false);  
            DataSourceTextField name= new DataSourceTextField("name", "Name");
            name.setCanEdit(false);
            DataSourceTextField employeeType= new DataSourceTextField("employeeType", "employeeType");
            employeeType.setCanEdit(true);
            employeeType.setValueMap("Manager", "Associate", "Contractor");

Set these fields to the datasource:

myDS.setFields(Id, name,employeeType);  
myDS.setFetchDataURL("/rest/myservice/fetch");  
myDS.setAddDataURL("/rest/myservice/add");  
myDS.setUpdateDataURL("/rest/myservice/update");  
myDS.setRemoveDataURL("/rest/myservice/remove");

So in the case that the user changes the employeeType (because it’s a dropdown), an update request is sent. I send the JSON string to the server configured as below:

@Controller
@RequestMapping("/myservice")
public class MyService {
...fetch
...update
    @RequestMapping(value="/update", method=RequestMethod.POST)
    @ResponseBody
    public String update()
    {
         }

I am failing to understand how to retrieve the (JSON) dsrequest because even my DispatcherServlet does not have the parameters (even if I use POSTPARAMS). The developer console shows the request made correctly but I don’t receive anything on the server side.
My spring servlet is configured as below in web.xml:

<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>    </servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>

I think I am missing something obvious but I can’t locate it. Do I use @PathVariable or RequestParams?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:24:32+00:00Added an answer on May 22, 2026 at 3:24 pm

    Found my own answer. Hope this helps someone.

    update.setDataProtocol(DSProtocol.POSTPARAMS);
    

    to

    update.setDataProtocol(DSProtocol.POSTMESSAGE);
    
    @Override
    protected Object transformRequest(DSRequest dsRequest) {
        JavaScriptObject jso = dsRequest.getData(); 
        String s1 = JSON.encode(jso); 
    return s1; 
    }
    
    @RequestMapping(value="/update", method=RequestMethod.POST)
    @ResponseBody public String update(@RequestBody String json) { }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been stuck on this problem for a while now. I want to
This is something I've been stuck on for a while now, and I have
I have been stuck on this one for a while - I couldn't figure
I am new using spring 3 and have been stuck for a while on
I've been stuck on this problem for a while now and have tried my
While clensing PII from test data I have been stuck with a challenging scenario:
Been kind of stuck on this one for a while now, so any help
I've been stuck on this for a while so I thought I would ask.
I've been stuck on this for 3 days now. I have two pages that
I have this, and i've been fiddling around with it for a while but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.