Thanks Marten,
I realize that my question 2) was a really a newbies question. For some stupid reasons I was lead to believe that Spring was somehow wrapping my class into a controller class when I was using the @Controller annotation. I was searching a way to access the cacheForSeconds method which was defined in the WebContentGenerator.
So now I figured out that I can do all this like this. Take the class which I defined before and add the extends WebContentGenerator, and there you go, you have access to the cacheForSeconds method.
Code:
@Controller
public class DefaultValuesController extends WebContentGenerator{
@Autowired private Services services;
@RequestMapping(value="/secure/{id}/metadataInfo.js", method = RequestMethod.GET, produces="text/javascript")
public @ResponseBody String getMetadataInfo(@PathVariable String id, HttpServletResponse response)
{
cacheForSeconds(response, 31556925, true);
return "result";
}
Thanks.