org.mentawai.filter

Class PaginatorFilter

    • Constructor Detail

      • PaginatorFilter

        public PaginatorFilter(String key)
        Instantiate a PaginatorFilter with the specified key pointing to the data in the output stack which should be paged.
        Parameters:
        key - Key of the data from the output stack to page
      • PaginatorFilter

        public PaginatorFilter(String key,
                       int itemsPerPage)
        Instantiate a PaginatorFilter with the specified key and amount of items per page.
        Parameters:
        key - Key of the data from the output stack to page
        itemsPerPage - Amount of items per page
      • PaginatorFilter

        public PaginatorFilter(String key,
                       int itemsPerPage,
                       String pageParam)
        Instantiate a PaginatorFilter with the specified key, amount of items per page and name of the page parameter.
        Parameters:
        key - Key of the data from the output stack to page
        itemsPerPage - Amount of items per page
        pageParam - Name of the page parameter
    • Method Detail

      • filter

        public String filter(InvocationChain chain)
                      throws Exception
        The filter replaces the specified data with an instance of Paginator which contains the paged data and some other useful information. Note: Only arrays and Collections can be paged.
        Specified by:
        filter in interface Filter
        Parameters:
        chain - The InvocationChain for the action this filter is being applied to.
        Returns:
        The result of the filter or the action the filter is being applied to.
        Throws:
        Exception
        See Also:
        Paginator
      • copyOfRange

        public static Object[] copyOfRange(Object[] original,
                           int from,
                           int to)
      • destroy

        public void destroy()
        Description copied from interface: Filter
        Gives a chance to the filter to deallocalte any resources before it is destroyed. This is called when the web application is stopped, in other words, this has nothing to do with garbage collection.
        Specified by:
        destroy in interface Filter

Copyright © 2015. All Rights Reserved.