use of org.apereo.cas.validation.ValidationResponseType in project cas by apereo.
the class WebApplicationServiceFactory method determineWebApplicationFormat.
/**
* Determine web application format boolean.
*
* @param request the request
* @param webApplicationService the web application service
* @return the service itself.
*/
private AbstractWebApplicationService determineWebApplicationFormat(final HttpServletRequest request, final AbstractWebApplicationService webApplicationService) {
final String format = request != null ? request.getParameter(CasProtocolConstants.PARAMETER_FORMAT) : null;
try {
if (StringUtils.isNotBlank(format)) {
final ValidationResponseType formatType = ValidationResponseType.valueOf(format.toUpperCase());
webApplicationService.setFormat(formatType);
}
} catch (final Exception e) {
LOGGER.error("Format specified in the request [{}] is not recognized", format);
}
return webApplicationService;
}
use of org.apereo.cas.validation.ValidationResponseType in project cas by apereo.
the class AbstractServiceValidateController method getModelAndView.
private ModelAndView getModelAndView(final HttpServletRequest request, final boolean isSuccess, final WebApplicationService service) {
ValidationResponseType type = service != null ? service.getFormat() : ValidationResponseType.XML;
final String format = request.getParameter(CasProtocolConstants.PARAMETER_FORMAT);
if (!StringUtils.isEmpty(format)) {
try {
type = ValidationResponseType.valueOf(format.toUpperCase());
} catch (final Exception e) {
LOGGER.warn(e.getMessage(), e);
}
}
if (type == ValidationResponseType.JSON) {
return new ModelAndView(this.jsonView);
}
return new ModelAndView(isSuccess ? this.successView : this.failureView);
}
Aggregations