Edit: This is our initializer code
@Component
@ComponentScan("com.sdl.dxa.modules.generic")
@RegisteredViewModels({
@RegisteredViewModel(viewName = "CustomTeaser_jsp", modelClass = CustomTeaser.class, controllerName = "Generic"),
@RegisteredViewModel(viewName = "CodeBlock_jsp", modelClass = CodeBlock.class, controllerName = "Generic"),
@RegisteredViewModel(viewName = "SiteMap_jsp", modelClass = SitemapItem.class, controllerName = "Generic"),
@RegisteredViewModel(viewName = "ShortArticle_jsp", modelClass = Article.class, controllerName = "Generic"),
This is our controller code.
@Controller
public class CampaignRedirectsController {
// TODO: Move this to common-impl or core-module
private static final Logger LOG = LoggerFactory.getLogger(CampaignRedirectsController.class);
private final UrlPathHelper urlPathHelper = new UrlPathHelper();
private final ContentProvider contentProvider;
private final LinkResolver linkResolver;
private final MediaHelper mediaHelper;
private final WebRequestContext webRequestContext;
private final Markup markup;
private final ViewResolver viewResolver;
private final DataFormatter dataFormatters;
@Value("#{environment.getProperty('AllowJsonResponse', 'false')}")
private boolean allowJsonResponse;
@Autowired
public CampaignRedirectsController(ContentProvider contentProvider, LinkResolver linkResolver, MediaHelper mediaHelper,
WebRequestContext webRequestContext, Markup markup, ViewResolver viewResolver, DataFormatter dataFormatter) {
this.contentProvider = contentProvider;
this.linkResolver = linkResolver;
this.mediaHelper = mediaHelper;
this.webRequestContext = webRequestContext;
this.markup = markup;
this.viewResolver = viewResolver;
this.dataFormatters = dataFormatter;
}
private static boolean isIncludeRequest(HttpServletRequest request) {
return request.getAttribute(WebUtils.INCLUDE_REQUEST_URI_ATTRIBUTE) != null;
}
@RequestMapping(method = RequestMethod.GET, value = {"/{shortcutName}",
"/f/{shortcutName}",
"/g/{shortcutName}",
"/l/{shortcutName}",
"/t/{shortcutName}",
"/i/{shortcutName}",
"/s/{shortcutName}",
"/q/{shortcutName}",
"/e/{shortcutName}"}, produces = {MediaType.TEXT_HTML_VALUE, MediaType.ALL_VALUE})
public String handleCampaignRedirectsPage(@PathVariable Map pathVariables, HttpServletRequest request, HttpServletResponse response) throws Exception {