Returning data from a controller

Hi, I'm wondering if there's a way to plug a controller-like component able to return something which is not a view but instead some other kind of content, like an image, a file or an arbitrary resource.

4 comments
Comment actions Permalink

Of course. Just extend BaseController class and write everything you want to the stream obtained from the HttpResponse object.

0
Comment actions Permalink

Am I not supposed to override the abstract doHandle method which returns ModelAndView? What would I return there?

0
Comment actions Permalink

Sorry, forgot about this. You can just return null here.

0
Comment actions Permalink

Thanks, I didn't know I could just retrurn null.

0

Please sign in to leave a comment.