Package name.pehl.taoki.paging

Source Code of name.pehl.taoki.paging.PagingQueryResource

package name.pehl.taoki.paging;

import name.pehl.taoki.paging.parser.QueryPageInfoParser;

import org.restlet.Request;

/**
* A {@linkplain AbstractPagingResource paging resource} which uses query
* parameters of the resource as input. The query must contain the following
* parameter:
* <ul>
* <li><code>offset</code><br/>
* The offset in the result.
* <li><code>pageSize</code><br/>
* The size of one page.
* <li><code>sortField</code><br/>
* The name of the field used for srting the result (optional)
* <li><code>sortDir</code><br/>
* The sort direction. Must match (case insensitiv) one of the constants in
* {@link SortDir}
* </ul>
* <p>
* Examples:
* <ul>
* <li>http://server/resource?offset=0&pageSize=50
* <li>http://server/resource?offset=100&pageSize=50&sortField=surname
* <li>http://server/resource?offset=1&pageSize=2&sortField=surname&sortDir=aSc
* </ul>
*
* @author $Author: harald.pehl $
* @version $Date: 2012-03-02 08:50:20 -0600 (Fri, 02 Mar 2012) $ $Revision:
*          61416 $
*/
public abstract class PagingQueryResource extends AbstractPagingResource
{
    /**
     * Construct a new instance with a {@link QueryPageInfoParser}
     */
    public PagingQueryResource()
    {
        super(new QueryPageInfoParser());
    }


    /**
     * Returns the {@linkplain #getQuery() query}.
     *
     * @param request
     * @return the {@linkplain #getQuery() query}.
     * @see name.pehl.taoki.paging.AbstractPagingResource#getInput(org.restlet.Request)
     */
    @Override
    protected Object getInput(Request request)
    {
        return getQuery();
    }
}
TOP

Related Classes of name.pehl.taoki.paging.PagingQueryResource

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.