Class BaseFormXmlController

    • Field Summary

      • Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator

        HEADER_CACHE_CONTROL, METHOD_GET, METHOD_HEAD, METHOD_POST
      • Fields inherited from class org.springframework.context.support.ApplicationObjectSupport

        logger
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addMessage​(javax.servlet.http.HttpServletRequest request, String key, String text, String... parameters)
      Adds a messages to the messages storage associated with specified request.
      protected org.springframework.validation.BindingResult bindFromRequest​(javax.servlet.http.HttpServletRequest request, Object bean)
      Binds the specified bean properties from the HTTP request.
      protected abstract org.springframework.web.servlet.ModelAndView doGet​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Implement this method to process GET requests.
      protected org.springframework.web.servlet.ModelAndView doHandle​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Performs actual request processing
      protected abstract void doPost​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.jdom.Element xmlResponse)
      Implement this method to process POST requests.
      protected void forgetFormBean​(javax.servlet.http.HttpServletRequest request, Class clazz)
      Removes a form bean of the specified class from the session.
      protected void forgetFormBean​(javax.servlet.http.HttpServletRequest request, Class clazz, String customKey)
      Removes a form bean of the specified class from the session.
      protected <T> T getOrCreateFormBean​(javax.servlet.http.HttpServletRequest request, Class<T> clazz, String customKey, FormUtil.FormCreator<T> formBeanCreator)
      Retrieves or creates (using the specified form bean creator) a form bean of the specified class.
      protected <T> T getOrCreateFormBean​(javax.servlet.http.HttpServletRequest request, Class<T> clazz, FormUtil.FormCreator<T> formBeanCreator)
      Retrieves or creates (using the specified form bean creator) a form bean of the specified class.
      protected boolean isInitPageRequest​(javax.servlet.http.HttpServletRequest request)
      Returns true if request contains parameter: init.
      protected org.springframework.web.servlet.ModelAndView selfRedirectOnInit​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
      protected void writeErrors​(org.jdom.Element xmlResponse, ActionErrors errors)
      Writes errors to the XML response.
      protected void writeRedirect​(org.jdom.Element xmlResponse, String url)
      Writes redirect to the XML response.
      • Methods inherited from class org.springframework.web.servlet.mvc.AbstractController

        isSynchronizeOnSession, setSynchronizeOnSession
      • Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator

        applyCacheControl, applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, checkRequest, getAllowHeader, getCacheControl, getCacheSeconds, getSupportedMethods, getVaryByRequestHeaders, isAlwaysMustRevalidate, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, prepareResponse, preventCaching, setAlwaysMustRevalidate, setCacheControl, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader, setVaryByRequestHeaders
      • Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport

        getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
      • Methods inherited from class org.springframework.context.support.ApplicationObjectSupport

        getApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext
    • Constructor Detail

      • BaseFormXmlController

        public BaseFormXmlController​(@NotNull
                                     SBuildServer server)
        Constructor
        Parameters:
        server - SBuildServer instance
      • BaseFormXmlController

        protected BaseFormXmlController()
        Constructor
    • Method Detail

      • doHandle

        @Nullable
        protected org.springframework.web.servlet.ModelAndView doHandle​(@NotNull
                                                                        javax.servlet.http.HttpServletRequest request,
                                                                        @NotNull
                                                                        javax.servlet.http.HttpServletResponse response)
                                                                 throws Exception
        Description copied from class: BaseController
        Performs actual request processing
        Specified by:
        doHandle in class BaseController
        Parameters:
        request - HTTP request
        response - HTTP response
        Returns:
        model and view components
        Throws:
        Exception - exception
      • doGet

        protected abstract org.springframework.web.servlet.ModelAndView doGet​(@NotNull
                                                                              javax.servlet.http.HttpServletRequest request,
                                                                              @NotNull
                                                                              javax.servlet.http.HttpServletResponse response)
        Implement this method to process GET requests. Usually on GET request a form bean is created and a page is shown.
        Parameters:
        request - HTTP request
        response - HTTP response
        Returns:
        model and view components
      • doPost

        protected abstract void doPost​(@NotNull
                                       javax.servlet.http.HttpServletRequest request,
                                       @NotNull
                                       javax.servlet.http.HttpServletResponse response,
                                       @NotNull
                                       org.jdom.Element xmlResponse)
        Implement this method to process POST requests. Usually POST requests are changing state of the form bean and underlying model. To output errors (if request validation failed) ActionErrors can be used. To add messages (if request processing was successful) use addMessage(javax.servlet.http.HttpServletRequest, String, String, String...) method.
        Parameters:
        request - HTTP request
        response - HTTP response
        xmlResponse - XML response for AJAX requests
      • writeRedirect

        protected void writeRedirect​(@NotNull
                                     org.jdom.Element xmlResponse,
                                     @NotNull
                                     String url)
        Writes redirect to the XML response. This redirect command is then can be processed by JavaScript on the client side.
        Parameters:
        xmlResponse - XML response
        url - URL
      • writeErrors

        protected void writeErrors​(@NotNull
                                   org.jdom.Element xmlResponse,
                                   @NotNull
                                   ActionErrors errors)
        Writes errors to the XML response. These errors can be then processed by JavaScript.
        Parameters:
        xmlResponse - XML response
        errors - errors
      • bindFromRequest

        protected org.springframework.validation.BindingResult bindFromRequest​(@NotNull
                                                                               javax.servlet.http.HttpServletRequest request,
                                                                               @NotNull
                                                                               Object bean)
        Binds the specified bean properties from the HTTP request.
        Parameters:
        request - HTTP request
        bean - bean
        Returns:
        binding result
      • getOrCreateFormBean

        protected <T> T getOrCreateFormBean​(javax.servlet.http.HttpServletRequest request,
                                            Class<T> clazz,
                                            FormUtil.FormCreator<T> formBeanCreator)
        Retrieves or creates (using the specified form bean creator) a form bean of the specified class.
        Parameters:
        request - HTTP request
        clazz - class
        formBeanCreator - form bean creator
        Returns:
        Retrieves or creates form bean of the specified class
      • getOrCreateFormBean

        protected <T> T getOrCreateFormBean​(javax.servlet.http.HttpServletRequest request,
                                            Class<T> clazz,
                                            String customKey,
                                            FormUtil.FormCreator<T> formBeanCreator)
        Retrieves or creates (using the specified form bean creator) a form bean of the specified class.
        Parameters:
        request - HTTP request
        clazz - class
        customKey - additional key identifying the form bean in the session
        formBeanCreator - form bean creator
        Returns:
        Retrieves or creates form bean of the specified class
      • forgetFormBean

        protected void forgetFormBean​(javax.servlet.http.HttpServletRequest request,
                                      Class clazz)
        Removes a form bean of the specified class from the session.
        Parameters:
        request - HTTP request
        clazz - class
      • forgetFormBean

        protected void forgetFormBean​(javax.servlet.http.HttpServletRequest request,
                                      Class clazz,
                                      String customKey)
        Removes a form bean of the specified class from the session.
        Parameters:
        request - HTTP request
        clazz - class
        customKey - additional key
      • isInitPageRequest

        protected boolean isInitPageRequest​(javax.servlet.http.HttpServletRequest request)
        Returns true if request contains parameter: init.
        Parameters:
        request - HTTP request
        Returns:
        true if init parameter presents
      • addMessage

        protected void addMessage​(@NotNull
                                  javax.servlet.http.HttpServletRequest request,
                                  @NotNull
                                  String key,
                                  String text,
                                  String... parameters)
        Adds a messages to the messages storage associated with specified request.

        The caller cannot pass raw HTML message using this constructor, as the message and parameters will be escaped.

        Parameters:
        request - HTTP request
        key - message key
        text - message
        parameters - if specified then substrings like {0}, {1}, {2} and so on will be replaced with parameter with corresponding index.
        See Also:
        ActionMessages.addMessage(String, String, String...)
      • selfRedirectOnInit

        @Nullable
        protected org.springframework.web.servlet.ModelAndView selfRedirectOnInit​(@NotNull
                                                                                  javax.servlet.http.HttpServletRequest request,
                                                                                  @NotNull
                                                                                  javax.servlet.http.HttpServletResponse response)