org.springframework.data.web.PageableHandlerMethodArgumentResolver Java Examples

The following examples show how to use org.springframework.data.web.PageableHandlerMethodArgumentResolver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebContext.java    From spring-data-solr-showcase with Apache License 2.0 6 votes vote down vote up
@Bean
public WebMvcConfigurerAdapter mvcViewConfigurer() {

	return new WebMvcConfigurerAdapter() {

		@Override
		public void addViewControllers(ViewControllerRegistry registry) {

			registry.addViewController("/").setViewName("search");
			registry.addViewController("/monitor").setViewName("monitor");
		}

		@Override
		public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
			argumentResolvers.add(new PageableHandlerMethodArgumentResolver());
		}
	};
}
 
Example #2
Source File: WebMvcAutoConfiguration.java    From halo with GNU General Public License v3.0 5 votes vote down vote up
public WebMvcAutoConfiguration(PageableHandlerMethodArgumentResolver pageableResolver,
                               SortHandlerMethodArgumentResolver sortResolver,
                               HaloProperties haloProperties) {
    this.pageableResolver = pageableResolver;
    this.sortResolver = sortResolver;
    this.haloProperties = haloProperties;
}
 
Example #3
Source File: PostControllerMockMvcTest.java    From spring-microservice-sample with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setup() {
    this.mockMvc = standaloneSetup(new PostController(postService, posts, comments))
        .setCustomArgumentResolvers(
            new PageableHandlerMethodArgumentResolver()
        )
        .setMessageConverters(
            new MappingJackson2HttpMessageConverter(objectMapper)
        )
        .alwaysDo(print())
        .apply(springSecurity(springSecurityFilterChain))
        .build();
}
 
Example #4
Source File: WebMvcConfig.java    From apollo with Apache License 2.0 5 votes vote down vote up
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
  PageableHandlerMethodArgumentResolver pageResolver =
          new PageableHandlerMethodArgumentResolver();
  pageResolver.setFallbackPageable(PageRequest.of(0, 10));

  argumentResolvers.add(pageResolver);
}
 
Example #5
Source File: WebConfig.java    From todolist with MIT License 5 votes vote down vote up
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
    PageableHandlerMethodArgumentResolver resolver = new PageableHandlerMethodArgumentResolver();
    resolver.setOneIndexedParameters(true);
    resolver.setFallbackPageable(new PageRequest(0, 10));
    argumentResolvers.add(resolver);
    super.addArgumentResolvers(argumentResolvers);
}
 
Example #6
Source File: WebConfiguration.java    From java-platform with Apache License 2.0 5 votes vote down vote up
@Bean
public PageableHandlerMethodArgumentResolver pageableResolver() {
	PageableHandlerMethodArgumentResolver pageableHandlerMethodArgumentResolver = new PageableHandlerMethodArgumentResolver(sortResolver());
	pageableHandlerMethodArgumentResolver.setPageParameterName("page");
	pageableHandlerMethodArgumentResolver.setOneIndexedParameters(true);
	pageableHandlerMethodArgumentResolver.setSizeParameterName("limit");
	return pageableHandlerMethodArgumentResolver;
}
 
Example #7
Source File: ProjectControllerNoWebAppTests.java    From spring-boot-practice with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    mockMvc = MockMvcBuilders.standaloneSetup(projectController)
        // To instantiate Pageable
        .setCustomArgumentResolvers(new PageableHandlerMethodArgumentResolver())
        .build();
}
 
Example #8
Source File: RestControllerTestSupport.java    From fullstop with Apache License 2.0 5 votes vote down vote up
protected HandlerMethodArgumentResolver[] mockMvcCustomArgumentResolvers() {
    final PageableHandlerMethodArgumentResolver pageableResolver = new PageableHandlerMethodArgumentResolver();
    pageableResolver.setFallbackPageable(new PageRequest(0, 10));

    final AuthenticationPrincipalArgumentResolver authenticationPrincipalResolver = new AuthenticationPrincipalArgumentResolver();

    return new HandlerMethodArgumentResolver[] { pageableResolver, authenticationPrincipalResolver };
}
 
Example #9
Source File: WallRideWebMvcConfiguration.java    From wallride with Apache License 2.0 5 votes vote down vote up
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
	BlogLanguageMethodArgumentResolver blogLanguageMethodArgumentResolver = new BlogLanguageMethodArgumentResolver();
	blogLanguageMethodArgumentResolver.setBlogService(blogService);

	argumentResolvers.add(new PageableHandlerMethodArgumentResolver());
	argumentResolvers.add(new AuthorizedUserMethodArgumentResolver());
	argumentResolvers.add(blogLanguageMethodArgumentResolver);
}
 
Example #10
Source File: WebMVCConfig.java    From ExecDashboard with Apache License 2.0 4 votes vote down vote up
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
    PageableHandlerMethodArgumentResolver resolver = new PageableHandlerMethodArgumentResolver();
    resolver.setMaxPageSize(Integer.MAX_VALUE);
    argumentResolvers.add(resolver);
}
 
Example #11
Source File: WebMVCConfig.java    From hygieia-core with Apache License 2.0 4 votes vote down vote up
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
    PageableHandlerMethodArgumentResolver resolver = new PageableHandlerMethodArgumentResolver();
    resolver.setMaxPageSize(Integer.MAX_VALUE);
    argumentResolvers.add(resolver);
}
 
Example #12
Source File: SpringDataPaginationCustomizer.java    From blog-spring with MIT License 4 votes vote down vote up
@Override
public void customize(PageableHandlerMethodArgumentResolver pageableResolver) {
  pageableResolver.setOneIndexedParameters(true);
}
 
Example #13
Source File: LifecycleControllerTest.java    From fullstop with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() throws Exception {
    reset(applicationLifecycleServiceMock);
    mockMvc = MockMvcBuilders.standaloneSetup(new LifecycleController(applicationLifecycleServiceMock))
            .setCustomArgumentResolvers(new PageableHandlerMethodArgumentResolver()).build();
}
 
Example #14
Source File: ControllerTestConfig.java    From fullstop with Apache License 2.0 4 votes vote down vote up
@Override
public void addArgumentResolvers(final List<HandlerMethodArgumentResolver> argumentResolvers) {
    argumentResolvers.add(new AuthenticationPrincipalArgumentResolver());
    argumentResolvers.add(new PageableHandlerMethodArgumentResolver());
}
 
Example #15
Source File: WebAdminConfiguration.java    From wallride with Apache License 2.0 4 votes vote down vote up
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
	argumentResolvers.add(new PageableHandlerMethodArgumentResolver());
	argumentResolvers.add(new AuthorizedUserMethodArgumentResolver());
}