Package org.springframework.web.context.request

Examples of org.springframework.web.context.request.NativeWebRequest


        request.setParameter("sort1.baseInfo.realname", "asc");
        request.setParameter("sort2.id", "desc");

        MethodParameter parameter = new MethodParameter(parameterDefaultSearchable, 0);
        NativeWebRequest webRequest = new ServletWebRequest(request);
        Searchable searchable = (Searchable) new SearchableMethodArgumentResolver().resolveArgument(parameter, null, webRequest, null);

        //内部会自动-1,从0开始
        assertEquals(pn - 1, searchable.getPage().getPageNumber());
        assertEquals(pageSize, searchable.getPage().getPageSize());
View Full Code Here


        request.setParameter("search.baseInfo.realname_like", "zhang");
        request.setParameter("search.username_eq", "zhang");


        MethodParameter parameter = new MethodParameter(parameterDefaultSearchable, 0);
        NativeWebRequest webRequest = new ServletWebRequest(request);
        Searchable searchable = (Searchable) new SearchableMethodArgumentResolver().resolveArgument(parameter, null, webRequest, null);

        //内部会自动-1,从0开始
        assertEquals(pn - 1, searchable.getPage().getPageNumber());
        assertEquals(pageSize, searchable.getPage().getPageSize());
View Full Code Here

        request.setParameter("foo_search.baseInfo.realname_like", "zhang");
        request.setParameter("foo_search.username_eq", "zhang");


        MethodParameter parameter = new MethodParameter(customNamePrefixSearchableAndPageableAndSort, 0);
        NativeWebRequest webRequest = new ServletWebRequest(request);
        Searchable searchable = (Searchable) new SearchableMethodArgumentResolver().resolveArgument(parameter, null, webRequest, null);

        //内部会自动-1,从0开始
        assertEquals(pn - 1, searchable.getPage().getPageNumber());
        assertEquals(pageSize, searchable.getPage().getPageSize());
View Full Code Here

    public void testMergeDefaultSearchableWithSearchParams() throws Exception {

        request.setParameter("search.username_eq", "zhang");

        MethodParameter parameter = new MethodParameter(methodMergeDefaultSearchable, 0);
        NativeWebRequest webRequest = new ServletWebRequest(request);
        Searchable searchable = (Searchable) new SearchableMethodArgumentResolver().resolveArgument(parameter, null, webRequest, null);

        assertContainsSearchFilter(SearchFilterHelper.newCondition("baseInfo.realname", SearchOperator.like, "zhang"), searchable);
        assertContainsSearchFilter(SearchFilterHelper.newCondition("username", SearchOperator.eq, "zhang"), searchable);
    }
View Full Code Here

        int pageSize = 10;
        request.setParameter("page.pn", String.valueOf(pn));
        request.setParameter("page.size", String.valueOf(pageSize));

        MethodParameter parameter = new MethodParameter(pageable, 0);
        NativeWebRequest webRequest = new ServletWebRequest(request);
        Pageable pageable = (Pageable) new PageableMethodArgumentResolver().resolveArgument(parameter, null, webRequest, null);

        //内部会自动-1,从0开始
        assertEquals(pn - 1, pageable.getPageNumber());
        assertEquals(pageSize, pageable.getPageSize());
View Full Code Here

        request.setParameter("page.size", String.valueOf(pageSize));
        request.setParameter("sort.id", "desc");
        request.setParameter("sort.baseInfo.realname", "asc");

        MethodParameter parameter = new MethodParameter(pageableAndSort, 0);
        NativeWebRequest webRequest = new ServletWebRequest(request);
        Pageable pageable = (Pageable) new PageableMethodArgumentResolver().resolveArgument(parameter, null, webRequest, null);

        //内部会自动-1,从0开始
        assertEquals(pn - 1, pageable.getPageNumber());
        assertEquals(pageSize, pageable.getPageSize());
View Full Code Here

        request.setParameter("page.size", String.valueOf(pageSize));
        request.setParameter("sort1.baseInfo.realname", "asc");
        request.setParameter("sort2.id", "desc");

        MethodParameter parameter = new MethodParameter(pageableAndSort, 0);
        NativeWebRequest webRequest = new ServletWebRequest(request);
        Pageable pageable = (Pageable) new PageableMethodArgumentResolver().resolveArgument(parameter, null, webRequest, null);

        //内部会自动-1,从0开始
        assertEquals(pn - 1, pageable.getPageNumber());
        assertEquals(pageSize, pageable.getPageSize());
View Full Code Here


    @Test
    public void testMethodDefaultPageable() throws Exception {
        MethodParameter parameter = new MethodParameter(methodDefaultPageable, 0);
        NativeWebRequest webRequest = new ServletWebRequest(request);
        Pageable pageable = (Pageable) new PageableMethodArgumentResolver().resolveArgument(parameter, null, webRequest, null);

        assertEquals(Controller.DEFAULT_PAGENUMBER, pageable.getPageNumber());
        assertEquals(Controller.DEFAULT_PAGESIZE, pageable.getPageSize());
View Full Code Here


    @Test
    public void testParameterDefaultPageable() throws Exception {
        MethodParameter parameter = new MethodParameter(parameterDefaultPageable, 0);
        NativeWebRequest webRequest = new ServletWebRequest(request);
        Pageable pageable = (Pageable) new PageableMethodArgumentResolver().resolveArgument(parameter, null, webRequest, null);

        assertEquals(Controller.DEFAULT_PAGENUMBER, pageable.getPageNumber());
        assertEquals(Controller.DEFAULT_PAGESIZE, pageable.getPageSize());
        Sort expectedSort = new Sort(Sort.Direction.DESC, "id").and(new Sort(Sort.Direction.ASC, "name"));
View Full Code Here

        request.setParameter("sort2.id", "desc");
        request.setParameter("sort1.baseInfo.realname", "asc");

        MethodParameter parameter = new MethodParameter(parameterDefaultPageable, 0);
        NativeWebRequest webRequest = new ServletWebRequest(request);
        Pageable pageable = (Pageable) new PageableMethodArgumentResolver().resolveArgument(parameter, null, webRequest, null);

        assertEquals(Controller.DEFAULT_PAGENUMBER, pageable.getPageNumber());
        assertEquals(Controller.DEFAULT_PAGESIZE, pageable.getPageSize());
        Sort expectedSort = new Sort(Sort.Direction.ASC, "baseInfo.realname").and(new Sort(Sort.Direction.DESC, "id"));
View Full Code Here

TOP

Related Classes of org.springframework.web.context.request.NativeWebRequest

Copyright © 2018 www.massapicom. 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.