Class SpringComponentPresentationController


  • public class SpringComponentPresentationController
    extends org.dd4t.mvc.controllers.AbstractComponentPresentationController
    SpringComponentPresentationController. Example controller to load DCPs. Extend as needed.
    Author:
    R. Kempees
    • Constructor Detail

      • SpringComponentPresentationController

        public SpringComponentPresentationController()
    • Method Detail

      • showComponentPresentation

        @RequestMapping(value="/{componentViewName}/{componentId}.dcp",
                        method={GET,HEAD})
        public String showComponentPresentation​(@PathVariable
                                                String componentViewName,
                                                @PathVariable
                                                int componentId,
                                                javax.servlet.http.HttpServletRequest request)
        Renders the component/model, which must be put on the request using ComponentUtils#setComponentPresentation.
        Overrides:
        showComponentPresentation in class org.dd4t.mvc.controllers.AbstractComponentPresentationController
        Parameters:
        componentViewName - the viewName to be used to render this component
        componentId - the id as an int, not a tcm uri!
        request - the request on which the component must be present
        Returns:
        the view name to render
      • showComponentPresentation

        @RequestMapping(value="/{componentViewPrefix}/{componentViewName}/{componentId}.dcp",
                        method={GET,HEAD})
        public String showComponentPresentation​(@PathVariable
                                                String componentViewPrefix,
                                                @PathVariable
                                                String componentViewName,
                                                @PathVariable
                                                int componentId,
                                                javax.servlet.http.HttpServletRequest request)
        Renders the component template response, the exact mapping needs to be determined.
        Overrides:
        showComponentPresentation in class org.dd4t.mvc.controllers.AbstractComponentPresentationController
        Parameters:
        componentViewPrefix - the prefix to use for the view
        componentViewName - the viewName to be used to render this component
        componentId - the id as an int, not a tcm uri!
        request - the request on which the component must be present
        Returns:
        the view name to render
      • getComponentViewPath

        public String getComponentViewPath()
        Overrides:
        getComponentViewPath in class org.dd4t.mvc.controllers.AbstractComponentPresentationController
        Returns:
        the component view path
      • setComponentViewPath

        public void setComponentViewPath​(String componentViewPath)
        Overrides:
        setComponentViewPath in class org.dd4t.mvc.controllers.AbstractComponentPresentationController
        Parameters:
        componentViewPath - , sets the component view path relative to the view resolver path