Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

spring rest request truncation  RSS feed

 
s ravi chandran
Ranch Hand
Posts: 547
5
Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
We are using spring MVC for restful services. This are moving fine so far.. except that for one particular interface method. I have getting exceptions.. from what I have tracked so far is that spring is truncating the request params when in contains DOT character... I searched in online.. but did not find any solution that wld work for me.. we are using json string to pass as parameter..

This is the error I am getting..



and this is the mapping for the method



Please let me know how to solve this.. I am not getting any clue as to how to avoid this truncation.
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just search for your query on Google. Got below mentioned options

a.Try adding this configuration in beans XML



OR


but make sure you also comment out <mvc:annotation-driven /> tag in bean class

b. As mentioned in this JIRA issue https://jira.springsource.org/browse/SPR-6164 , it seem to be a problem in specific Spring version. Are you using correct Spring version ?

c. Also please post a sample URL which is getting truncated. May be URL last section (which contains dot) may be treated as file extension. In that case, try adding a forward slash at the end of URL

d. Try this option of adding HttpServletRequest as method parameter. And then get whole path in Java String variable



 
s ravi chandran
Ranch Hand
Posts: 547
5
Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. the request is in the form :



I commented the line

<mvc:annotation-driven />

Now I am getting this error:



Did I miss something here?
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this error is due to the fact that your Controller or Handler was not defined in bean configuration xml.
In recent Spring version, due to use of annotations, entry/definition of Controller in bean configuration xml has been made optional. It is been compensated with mvc:annotation tag in bean xml. Presence of this tag let Spring container scan through all required packages for Controller annotation and generates configuration automatically.

Since you have removed mvc:annotation tag, Spring container is not able to scan and find the controller to which your request is going.

Try defining this Controller configuration manually in bean configuration xml. Then, run your code again. May be your error can get resolved.

Also what is the Spring version that you are using ?
 
s ravi chandran
Ranch Hand
Posts: 547
5
Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abhay Agarwal wrote:this error is due to the fact that your Controller or Handler was not defined in bean configuration xml.
In recent Spring version, due to use of annotations, entry/definition of Controller in bean configuration xml has been made optional. It is been compensated with mvc:annotation tag in bean xml. Presence of this tag let Spring container scan through all required packages for Controller annotation and generates configuration automatically.

Since you have removed mvc:annotation tag, Spring container is not able to scan and find the controller to which your request is going.

Try defining this Controller configuration manually in bean configuration xml. Then, run your code again. May be your error can get resolved.

Also what is the Spring version that you are using ?


Hi, Thanks for the reply. I will try the configuration. I guess, i am forgetting the things autowiring does.. it does make ppl like me lazy though.. :-).. and about the spring version, it is 3.2
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!