@Override
 public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
   PageableHandlerMethodArgumentResolver resolver =
       new PageableHandlerMethodArgumentResolver(new SortHandlerMethodArgumentResolver());
   argumentResolvers.add(resolver);
   super.addArgumentResolvers(argumentResolvers);
 }
Ejemplo n.º 2
0
  @Override
  public void configureViewResolvers(ViewResolverRegistry registry) {

    super.configureViewResolvers(registry);

    registry.jsp("/WEB-INF/jsp/", ".jsp");
  }
Ejemplo n.º 3
0
 /** configure json converter charset to UTF-8 */
 @Override
 public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
   converters.add(new StringHttpMessageConverter(UTF8));
   converters.add(new ByteArrayHttpMessageConverter());
   converters.add(jacksonMessageConverter());
   super.configureMessageConverters(converters);
 }
  public void configureMessageConverters(List<HttpMessageConverter<?>> messageConverters) {

    MappingJackson2HttpMessageConverter jmc = new MappingJackson2HttpMessageConverter();
    jmc.setObjectMapper(new JSONObjectMapper());
    messageConverters.add(jmc);
    messageConverters.add(createXmlHttpMessageConverter());
    super.configureMessageConverters(messageConverters);
  }
Ejemplo n.º 5
0
 @Override
 public void addResourceHandlers(final ResourceHandlerRegistry registry) {
   super.addResourceHandlers(registry);
   System.out.println("Reading here");
   registry.addResourceHandler("/index.jsp").addResourceLocations("/WEB-INF/views/index.html");
   registry.addResourceHandler("/css/**").addResourceLocations("/WEB-INF/css/");
   registry.addResourceHandler("/images/**").addResourceLocations("/WEB-INF/images/");
   registry.addResourceHandler("/js/**").addResourceLocations("/WEB-INF/js/");
 }
Ejemplo n.º 6
0
 @Override
 public void addResourceHandlers(ResourceHandlerRegistry registry) {
   super.addResourceHandlers(registry);
   registry.addResourceHandler("/webapp/**").addResourceLocations("/webapp/");
   registry.addResourceHandler("/webapp/styles/**").addResourceLocations("/webapp/styles/");
   registry.addResourceHandler("/webapp/dist/**").addResourceLocations("/webapp/dist/");
   registry
       .addResourceHandler("/webapp/jspm_packages/**")
       .addResourceLocations("/webapp/jspm_packages/");
 }
Ejemplo n.º 7
0
  @Override
  public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {

    System.out.println("AppConfig.configureMessageConverters()----------------配置转换器");
    final FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
    List<MediaType> supportedMediaTypes = new ArrayList<MediaType>();
    supportedMediaTypes.add(new MediaType("text", "plain"));
    supportedMediaTypes.add(new MediaType("application", "json"));
    converter.setSupportedMediaTypes(supportedMediaTypes);
    converters.add(converter);
    super.configureMessageConverters(converters);
  }
 /** Add our static resources folder mapping. */
 @Override
 public void addResourceHandlers(ResourceHandlerRegistry registry) {
   //
   registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
   //
   // Activiti repository resources(diagram picture,process BPM files).
   // registry.addResourceHandler("/repository/**").addResourceLocations("classpath:/repository/");
   // Jasper report
   registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
   // registry.addResourceHandler("/reports/**").addResourceLocations("classpath:/reports/");
   //
   super.addResourceHandlers(registry);
 }
Ejemplo n.º 9
0
  @Override
  public void configureMessageConverters(final List<HttpMessageConverter<?>> messageConverters) {
    messageConverters.add(marshallingHttpMessageConverter());

    final ClassLoader classLoader = getClass().getClassLoader();
    if (ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", classLoader)) {
      messageConverters.add(new MappingJackson2HttpMessageConverter());
    } else if (ClassUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", classLoader)) {
      messageConverters.add(new MappingJacksonHttpMessageConverter());
    }

    super.configureMessageConverters(messageConverters);
  }
Ejemplo n.º 10
0
  @Override
  public void configureContentNegotiation(final ContentNegotiationConfigurer configurer) {

    super.configureContentNegotiation(configurer);
    configurer.favorPathExtension(true);
    configurer.ignoreAcceptHeader(false).defaultContentType(MediaType.TEXT_HTML);
    Map<String, MediaType> mediaTypes = new HashMap<String, MediaType>();
    mediaTypes.put("html", MediaType.TEXT_HTML);
    mediaTypes.put("xml", MediaType.TEXT_XML);
    mediaTypes.put("json", new MediaType("application", "json", Charset.forName("UTF-8")));
    mediaTypes.put("atom", MediaType.APPLICATION_ATOM_XML);
    mediaTypes.put("js", new MediaType("text", "javascript"));
    configurer.mediaTypes(mediaTypes);
  }
Ejemplo n.º 11
0
 @Override
 public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
   converters.add(new MappingJackson2HttpMessageConverter());
   super.configureMessageConverters(converters);
 }
Ejemplo n.º 12
0
 /** 解决中文乱码问题 */
 @Override
 public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
   converters.add(customJackson2HttpMessageConverter());
   converters.add(stringHttpMessageConverter());
   super.extendMessageConverters(converters);
 }
 @Override
 public void addFormatters(FormatterRegistry registry) {
   registry.addFormatter(new JodaMoneyFormatter());
   super.addFormatters(registry);
 }
Ejemplo n.º 14
0
 @Override
 public void addViewControllers(final ViewControllerRegistry registry) {
   super.addViewControllers(registry);
   registry.addViewController("/login").setViewName(AbstractController.LOGIN_TEMPLATE);
 }
 @Override
 public void configureHandlerExceptionResolvers(
     List<HandlerExceptionResolver> exceptionResolvers) {
   super.configureHandlerExceptionResolvers(exceptionResolvers);
 }
Ejemplo n.º 16
0
 @Override
 public void addViewControllers(ViewControllerRegistry registry) {
   registry.addViewController("/").setViewName("forward:/web/ui/main.zul");
   registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
   super.addViewControllers(registry);
 }
 @Override
 public void addResourceHandlers(ResourceHandlerRegistry registry) {
   registry.addResourceHandler("/js/**").addResourceLocations("classpath:/js/");
   registry.addResourceHandler("/css/**").addResourceLocations("classpath:/css/");
   super.addResourceHandlers(registry);
 }
Ejemplo n.º 18
0
 @Override
 public void addArgumentResolvers(final List<HandlerMethodArgumentResolver> argumentResolvers) {
   argumentResolvers.add(pageableHandlerMethodArgumentResolver());
   super.addArgumentResolvers(argumentResolvers);
 }
Ejemplo n.º 19
0
 @Override
 public void addViewControllers(final ViewControllerRegistry registry) {
   super.addViewControllers(registry);
   registry.addViewController("/csrfAttacker.html");
 }
 @Override
 public void addResourceHandlers(ResourceHandlerRegistry registry) {
   super.addResourceHandlers(registry);
 }
  /**
   * Adds a <code>LocaleChangeInterceptor</code>. It changes the locale when requested.<br>
   * On each request to the <code>DispatcherServlet</code>, it looks for a request parameter, which
   * defaults to <code>locale</code> but can be customized. If this request parameter exists, the
   * interceptor converts the <code>String</code> parameter to a <code>Locale</code> and then uses
   * the <code>LocaleResolver</code>’s <code>setLocale</code> method to set the locale.<br>
   * <br>
   * On any page you can add a link to change locales and simply submit it to the current page. This
   * not only changes the locale for the current page, it also changes the locale for all subsequent
   * pages the user visits until his session times out or he closes his browser. <br>
   * Example usage: <code>http://localhost:8080/i18n/<strong>?locale=es_MX</strong></code><br>
   */
  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    super.addInterceptors(registry);

    registry.addInterceptor(new LocaleChangeInterceptor());
  }
 @Override
 public void addInterceptors(InterceptorRegistry registry) {
   registry.addInterceptor(interceptor).addPathPatterns("/**").excludePathPatterns("/error**");
   super.addInterceptors(registry);
 }
 @Override
 public void addInterceptors(InterceptorRegistry registry) {
   super.addInterceptors(registry);
 }