I have registered a validator by doing a @InitBinder. Here is my controller code snippet:
Code:@InitBinder public void initBinder(WebDataBinder binder) { binder.setValidator(new ArchiveReportRequestFormValidator()); }Now Spring is validating my incoming request model, ArchiveReportRequestForm, just fine. However, it seems to attempt to validate my outgoing response model, FraudArchiveReport, as well, and that is not a desired behavior. Is there a way to validate only the incoming request and not the outgoing response when I bind my own custom validator?Code:@RequestMapping(value = "/reports/preciseid/v2/archives", method = RequestMethod.GET, headers = "Accept=application/xml") public FraudArchiveReport getArchiveReportsV2( final HttpServletRequest request, @Validated ArchiveReportRequestForm requestForm) throws ApplicationException { appLogHandler .logInformational("RESTfulPreciseIDV1WebserviceController.getArchiveReportsV2() is invoked at " + new Date() + "."); appLogHandler.logInformational("RequestForm: " + requestForm); FraudArchiveReport report = createPIDArchiveReport(); request.setAttribute("Archive Report", report); appLogHandler .logInformational("RESTfulPreciseIDV1WebserviceController.getArchiveReportsV2() is invoked at " + new Date() + "."); return report; }


Reply With Quote
