0

Using Ext-JS 4.1 with Spring 3.1 Controllers.

I am trying to retrieve an object from my Spring Controller using the load() method. I read a string from a text field and send that into the load method. The string field will contain a fully qualified server name such as "company.server.com". What's happening is that the value within the Spring controllers is "company.server", in other words it drops the ".com". It I put in an additional period at the end such as "company.server.com." then it comes in properly as "company.server.com". There seems to be some sort of tokenizing going on. I used commas (,) just to see what would happen. Using commas the string came in as expected. For some reason periods (.) is causing the issue.

Here is the Model:

Ext.define('AB.model.Server', {
    extend: 'Ext.data.Model',
    fields: [
        {name:'serverName', type:'String'},
        {name:'memory', type:'String'},
        {name:'cpus', type:'int'}
    ],

    proxy {
        type: 'rest',
        url: '/web/user/'
    }
});

Here is a snippet from the form which makes the load() call:

Ext.define('AB.view.Form', {
    extend: 'Ext.form.Panel',

    ....

    ,{
        xtype: 'button',
        text: 'Retrieve Information',
        handler: function() {
           Ext.ModelManager.getModel('AB.model.User').load(Ext.getCmp('serverName').getValue(), {
               success: function(user) {
                   alert("Success");
        }

    ....
}

Using Firebug I see this as the URL being called:

http://myServer/web/user/company.server.com?_dc=13461612333647?id=company.server.com

So the URL has the correct server name but on the Spring Controller side the value of my parameter is "company.server".

When I directly put the following URL directly in my web browser:

http://myServer/web/user/company.server.com/

it works properly with the parameter in the Spring Controller being "company.server.com".

Is this an EXT JS problem? Is a problem with EXT JS to Spring? I don't think it is a Spring issue alone since the URL directly in the browser works properly.

UPDATE:

When I put the following URL directly in my web browser:

http://myServer/web/user/company.server.com

it behaves the same as the EXT JS Rest call. Notice there is no ending slash (/). So maybe this is a Spring issue? Or maybe a web.xml issue?

wxkevin
  • 1,634
  • 2
  • 25
  • 44
  • As you get `?id=company.server.com` on your server request, I can't really see how this is an ExtJs issue. I could be something to do with spring's routing mechanism, in which case perhaps sending JSON would work for you. – Izhaki Aug 28 '12 at 16:29
  • after further research I agree it is not ExtJs. I found this article which proposes a solution I am going to try. http://stackoverflow.com/questions/3526523/spring-mvc-pathvariable-getting-truncated – wxkevin Aug 29 '12 at 13:13
  • Also found this relevant article which is another solution, and possibly better since it is configuring Spring to do what you want it to do as opposed to a workaround using regex. http://stackoverflow.com/questions/4135329/how-to-change-spring-mvcs-behavior-in-handling-url-dot-character?lq=1 – wxkevin Aug 29 '12 at 13:17

0 Answers0