• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need clarity on Spring Controller

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI All,

I am into a situation where I need to trigger a http URL from shell script passing 2 parameter say param 1 and param 2 to a web project.

I need to write a spring controller which is capable of handling this get request and return a String say "Success" on successful completion of the request.

I need to use Spring 3.

As per my analysis, i understood i need a method something like this




Guide me whether i am going on the right path, is this doable?

Regards
Siva
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you just want to return the string "success" you will need to annotate your method with @ResponseBody this indicates that the return type should be written straight to the HTTP response body (and not placed in a Model, or interpreted as a view name).

As for passing in your parameter just let spring bind them for you make use of the annotations they have @RequestParam for this purpose, maybe something more like below.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic