Java Code Examples for org.springframework.core.Ordered

The following are top voted examples for showing how to use org.springframework.core.Ordered. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: happy-news   File: AuthorizationServerConfig.java   Source Code and License 8 votes vote down vote up
@Bean
FilterRegistrationBean corsFilter() {
    CorsConfiguration config = new CorsConfiguration();
    config.setAllowCredentials(true);
    config.addAllowedOrigin("*");
    config.addAllowedHeader("*");
    config.addAllowedMethod("*");

    UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
    source.registerCorsConfiguration("/**", config);

    FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source));
    bean.setOrder(Ordered.HIGHEST_PRECEDENCE);

    return bean;
}
 
Example 2
Project: incubator-servicecomb-java-chassis   File: LoggingFilterConfig.java   Source Code and License 6 votes vote down vote up
@Bean
DelegatingFilterProxyRegistrationBean delegatingFilterProxyRegistrationBean() {
  DelegatingFilterProxyRegistrationBean bean = new DelegatingFilterProxyRegistrationBean("traceLoggingFilter");

  bean.setDispatcherTypes(ASYNC, ERROR, FORWARD, INCLUDE, REQUEST);
  bean.setOrder(Ordered.LOWEST_PRECEDENCE);
  return bean;
}
 
Example 3
Project: incubator-servicecomb-java-chassis   File: TestSPIServiceUtils.java   Source Code and License 6 votes vote down vote up
@Test
public void testSort(@Mocked Ordered o1, @Mocked Ordered o2) {
  Map<String, Ordered> map = new LinkedHashMap<>();
  map.put("a", o1);
  map.put("b", o2);

  ServiceLoader<Ordered> serviceLoader = ServiceLoader.load(Ordered.class);
  Deencapsulation.setField(serviceLoader, "providers", map);
  new Expectations(ServiceLoader.class) {
    {
      o1.getOrder();
      result = -1;
      o2.getOrder();
      result = Integer.MAX_VALUE;
      ServiceLoader.load(Ordered.class);
      result = serviceLoader;
    }
  };

  Assert.assertThat(SPIServiceUtils.getSortedService(Ordered.class), Matchers.contains(o1, o2));
  Assert.assertThat(SPIServiceUtils.getPriorityHighestService(Ordered.class), Matchers.is(o1));
}
 
Example 4
Project: cas-5.1.0   File: CasCoreAuditConfiguration.java   Source Code and License 6 votes vote down vote up
@Bean
public FilterRegistrationBean casClientInfoLoggingFilter() {
    final AuditProperties audit = casProperties.getAudit();

    final FilterRegistrationBean bean = new FilterRegistrationBean();
    bean.setFilter(new ClientInfoThreadLocalFilter());
    bean.setUrlPatterns(Collections.singleton("/*"));
    bean.setName("CAS Client Info Logging Filter");
    bean.setAsyncSupported(true);
    bean.setOrder(Ordered.HIGHEST_PRECEDENCE);

    final Map<String, String> initParams = new HashMap<>();
    if (StringUtils.isNotBlank(audit.getAlternateClientAddrHeaderName())) {
        initParams.put(ClientInfoThreadLocalFilter.CONST_IP_ADDRESS_HEADER, audit.getAlternateClientAddrHeaderName());
    }

    if (StringUtils.isNotBlank(audit.getAlternateServerAddrHeaderName())) {
        initParams.put(ClientInfoThreadLocalFilter.CONST_SERVER_IP_ADDRESS_HEADER, audit.getAlternateServerAddrHeaderName());
    }

    initParams.put(ClientInfoThreadLocalFilter.CONST_USE_SERVER_HOST_ADDRESS, String.valueOf(audit.isUseServerHostAddress()));
    bean.setInitParameters(initParams);
    return bean;
}
 
Example 5
Project: cas-5.1.0   File: CasCoreTicketCatalogConfiguration.java   Source Code and License 6 votes vote down vote up
@Override
public final void configureTicketCatalog(final TicketCatalog plan) {
    LOGGER.debug("Registering core CAS protocol ticket definitions...");

    buildAndRegisterProxyTicketDefinition(plan,
            buildTicketDefinition(plan, ProxyTicket.PROXY_TICKET_PREFIX, 
                    ProxyTicketImpl.class, Ordered.HIGHEST_PRECEDENCE));

    buildAndRegisterServiceTicketDefinition(plan,
            buildTicketDefinition(plan, ServiceTicket.PREFIX, 
                    ServiceTicketImpl.class, Ordered.HIGHEST_PRECEDENCE));

    buildAndRegisterProxyGrantingTicketDefinition(plan,
            buildTicketDefinition(plan, ProxyGrantingTicket.PROXY_GRANTING_TICKET_PREFIX,
                    ProxyGrantingTicketImpl.class, Ordered.LOWEST_PRECEDENCE));

    buildAndRegisterTicketGrantingTicketDefinition(plan,
            buildTicketDefinition(plan, TicketGrantingTicket.PREFIX,
                    TicketGrantingTicketImpl.class, Ordered.LOWEST_PRECEDENCE));
}
 
Example 6
Project: basic   File: Application.java   Source Code and License 6 votes vote down vote up
@Bean
public WebMvcConfigurer webMvcConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addViewControllers(ViewControllerRegistry viewControllerRegistry) {

            // 首页默认加载web端
            viewControllerRegistry.addViewController("/").setViewName("/web/index.html");
            viewControllerRegistry.addViewController("/index.html").setViewName("redirect:/");

            // web首页
            viewControllerRegistry.addViewController("/web").setViewName("/web/index.html");

            // webapp首页
            viewControllerRegistry.addViewController("/webapp").setViewName("/webapp/index.html");

            viewControllerRegistry.setOrder(Ordered.HIGHEST_PRECEDENCE);
            super.addViewControllers(viewControllerRegistry);
        }
    };
}
 
Example 7
Project: cornerstone   File: AutoConfiguration.java   Source Code and License 6 votes vote down vote up
@Bean(name = "VIFilterRegistrationBeanNew")
public org.springframework.boot.web.servlet.FilterRegistrationBean factory() {

    if(environment != null) {
        String port = environment.getProperty("server.port");
        if(port !=null) {
            System.setProperty(SysKeys.SPRINGBOOTPORTKEY, port);
        }
    }
    org.springframework.boot.web.servlet.FilterRegistrationBean filter =
            new org.springframework.boot.web.servlet.FilterRegistrationBean();
    filter.setFilter(new VIFilter());
    filter.setName("vi-filter");
    filter.addUrlPatterns(URLPATTERNS);
    filter.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.FORWARD);
    filter.setAsyncSupported(true);
    filter.setOrder(Ordered.HIGHEST_PRECEDENCE);
    return filter;
}
 
Example 8
Project: artemis-disruptor-miaosha   File: JmsClientConfiguration.java   Source Code and License 6 votes vote down vote up
@Bean
public JmsMessageSender requestMessageSender(@Value("${jms-sender.ring-buffer-size}") int ringBufferSize) throws JMSException {

  DisruptorJmsMessageSender messageSender = DisruptorJmsMessageSenderFactory.create(
      requestSession(),
      requestMessageProducer(),
      new ArtemisMessageDtoDupMessageDetectStrategy(),
      ringBufferSize
  );


  BeanRegisterUtils.registerSingleton(
      applicationContext,
      "RequestDtoEventDisruptorLifeCycleContainer",
      new DisruptorLifeCycleContainer("RequestDtoEventDisruptor", messageSender.getDisruptor(),
          Ordered.HIGHEST_PRECEDENCE));

  return messageSender;

}
 
Example 9
Project: apollo-custom   File: NamespaceHandler.java   Source Code and License 6 votes vote down vote up
@Override
protected void doParse(Element element, BeanDefinitionBuilder builder) {
  String namespaces = element.getAttribute("namespaces");
  //default to application
  if (Strings.isNullOrEmpty(namespaces)) {
    namespaces = ConfigConsts.NAMESPACE_APPLICATION;
  }

  int order = Ordered.LOWEST_PRECEDENCE;
  String orderAttribute = element.getAttribute("order");

  if (!Strings.isNullOrEmpty(orderAttribute)) {
    try {
      order = Integer.parseInt(orderAttribute);
    } catch (Throwable ex) {
      throw new IllegalArgumentException(
          String.format("Invalid order: %s for namespaces: %s", orderAttribute, namespaces));
    }
  }
  PropertySourcesProcessor.addNamespaces(NAMESPACE_SPLITTER.splitToList(namespaces), order);
}
 
Example 10
Project: NGB-master   File: ExceptionHandlerAdvice.java   Source Code and License 6 votes vote down vote up
@ResponseBody
@Order(Ordered.HIGHEST_PRECEDENCE)
@ExceptionHandler(Throwable.class)
public final ResponseEntity<Result<String>> handleUncaughtException(final Throwable exception, final WebRequest
        request) {
    // adds information about encountered error to application log
    LOG.error(MessageHelper.getMessage("logger.error", request.getDescription(true)), exception);
    HttpStatus code = HttpStatus.OK;

    String message;
    if (exception instanceof FileNotFoundException) {
        // any details about real path of a resource should be normally prevented to send to the client
        message = MessageHelper.getMessage("error.io.not.found");
    } else if (exception instanceof DataAccessException) {
        // any details about data access error should be normally prevented to send to the client,
        // as its message can contain information about failed SQL query or/and database schema
        if (exception instanceof BadSqlGrammarException) {
            // for convenience we need to provide detailed information about occurred BadSqlGrammarException,
            // but it can be retrieved
            SQLException root = ((BadSqlGrammarException) exception).getSQLException();
            if (root.getNextException() != null) {
                LOG.error(MessageHelper.getMessage("logger.error.root.cause", request.getDescription(true)),
                    root.getNextException());
            }
            message = MessageHelper.getMessage("error.sql.bad.grammar");
        } else {
            message = MessageHelper.getMessage("error.sql");
        }
    } else if (exception instanceof UnauthorizedClientException) {
        message = exception.getMessage();
        code = HttpStatus.UNAUTHORIZED;
    } else {
        message = exception.getMessage();
    }

    return new ResponseEntity<>(Result.error(StringUtils.defaultString(StringUtils.trimToNull(message),
                                   MessageHelper.getMessage("error" + ".default"))), code);
}
 
Example 11
Project: web-framework-for-java   File: WebSecurityConfig.java   Source Code and License 6 votes vote down vote up
/**
 * CORS:
 * <p>
 * Do not do any of below, which are the wrong way to attempt solving the ajax problem:
 * - http.authorizeRequests().antMatchers(HttpMethod.OPTIONS, "/**").permitAll();
 * - web.ignoring().antMatchers(HttpMethod.OPTIONS)
 * <p>
 * Global CORS configuration
 * https://spring.io/blog/2015/06/08/cors-support-in-spring-framework
 * https://docs.spring.io/spring-security/site/docs/current/reference/html/cors.html
 * <p>
 * Solution 1
 * add CrossOrigin annotation to Controller class or methods
 * <p>
 * Solution 2
 * override addCorsMappings(CorsRegistry registry) method of WebMvcConfigurerAdapter class
 * <p>
 * <p>
 * The follow method will override CORS Configuration provided by Spring MVC.
 */
@Bean
public FilterRegistrationBean initCorsFilter() {
    UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
    CorsConfiguration config = new CorsConfiguration();

    // setAllowCredentials(true) is important, otherwise:
    // The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.
    config.setAllowCredentials(true);

    // setAllowedHeaders is important! Without it, OPTIONS preflight request
    // will fail with 403 Invalid CORS request
    config.setAllowedHeaders(ImmutableList.of("Authorization", "Cache-Control", "Content-Type"));

    config.addAllowedMethod("*");

    String origins = this.applicationConfig.getAllowedOrigins();
    if (origins != null && !"".equals(origins)) {
        config.setAllowedOrigins(Arrays.asList(StringHelper.splitWithoutWhitespace(origins, ",")));
    }
    source.registerCorsConfiguration("/**", config);
    FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source));
    bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
    return bean;
}
 
Example 12
Project: lams   File: AspectJAwareAdvisorAutoProxyCreator.java   Source Code and License 6 votes vote down vote up
@Override
public String toString() {
	StringBuilder sb = new StringBuilder();
	Advice advice = this.advisor.getAdvice();
	sb.append(ClassUtils.getShortName(advice.getClass()));
	sb.append(": ");
	if (this.advisor instanceof Ordered) {
		sb.append("order ").append(((Ordered) this.advisor).getOrder()).append(", ");
	}
	if (advice instanceof AbstractAspectJAdvice) {
		AbstractAspectJAdvice ajAdvice = (AbstractAspectJAdvice) advice;
		sb.append(ajAdvice.getAspectName());
		sb.append(", declaration order ");
		sb.append(ajAdvice.getDeclarationOrder());
	}
	return sb.toString();
}
 
Example 13
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 14
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 15
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 16
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 17
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 18
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 19
Project: joal   File: CoreEventListener.java   Source Code and License 5 votes vote down vote up
@Async
@Order(Ordered.LOWEST_PRECEDENCE)
@EventListener
void handleSomethingHasFuckedUp(final SomethingHasFuckedUpEvent event) {
    // We caught an unrecoverable exception in a thread, we better stop right now.
    logger.error("Event SomethingHasFuckedUpEvent caught.", event.getException());
    // Stop the application
    SpringApplication.exit(appContext, () -> 42);
}
 
Example 20
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 21
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 22
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 23
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 24
Project: joal   File: WebMvcConfiguration.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    registry.addViewController("/ui").setViewName("redirect:ui/");
    registry.addViewController("/ui/").setViewName("forward:index.html");
    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
    super.addViewControllers(registry);
}
 
Example 25
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 26
Project: data-migration   File: WebMvcConfiguration.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(ViewControllerRegistry registry) {
    registry.addViewController( "/" )
            .setViewName( "index" );
    registry.addViewController( "/login" )
            .setViewName( "login" );
    registry.setOrder( Ordered.HIGHEST_PRECEDENCE );
    super.addViewControllers( registry );
}
 
Example 27
Project: joal   File: CoreEventListener.java   Source Code and License 5 votes vote down vote up
@Async
@Order(Ordered.HIGHEST_PRECEDENCE)
@EventListener
void handleNoMoreTorrents(final NoMoreTorrentsFileAvailableEvent event) {
    logger.debug("Event NoMoreTorrentsFileAvailableEvent caught.");
    // logger.warn("There is no more .torrent file, add some more to resume seed.");
}
 
Example 28
Project: joal   File: WebConfigEventListener.java   Source Code and License 5 votes vote down vote up
@Order(Ordered.LOWEST_PRECEDENCE)
@EventListener
void handleConfigHasChanged(final ConfigHasChangedEvent event) {
    logger.debug("Send ConfigHasChangedEvent to clients.");

    this.messagingTemplate.convertAndSend("/config", new ConfigHasChangedPayload(event));
}
 
Example 29
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 30
Project: JavaQuarkBBS   File: MyAdapter.java   Source Code and License 5 votes vote down vote up
/**
 * 配置默认路径为文档
 * @param registry
 */
@Override
public void addViewControllers( ViewControllerRegistry registry ) {
    registry.addViewController( "" ).setViewName( "redirect:/swagger-ui.html" );
    registry.setOrder( Ordered.HIGHEST_PRECEDENCE );
    super.addViewControllers( registry );
}
 
Example 31
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 32
Project: joal   File: CoreEventListener.java   Source Code and License 5 votes vote down vote up
@Async
@Order(Ordered.HIGHEST_PRECEDENCE)
@EventListener
void handleSeedSessionHasEnded(final SeedSessionHasEndedEvent event) {
    logger.debug("Event SeedSessionHasEndedEvent caught.");
    // TODO : log that the seed session is over
}
 
Example 33
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 34
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 35
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 36
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 37
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 38
Project: joal   File: WebAnnounceEventListener.java   Source Code and License 5 votes vote down vote up
@Order(Ordered.LOWEST_PRECEDENCE)
@EventListener
void handleAnnouncerHasAnnounced(final AnnouncerHasAnnouncedEvent event) {
    logger.debug("Send AnnouncerHasAnnouncedEvent to clients.");

    this.messagingTemplate.convertAndSend(
            "/announce",
            new AnnouncerHasAnnouncedPayload(event)
    );
}
 
Example 39
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 40
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 41
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 42
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 43
Project: spring-batch-support   File: SpringBatchSupportAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@PostConstruct
public void initialize() throws Exception {
	// Default order for the AutomaticJobRegistrar is Ordered.LOWEST_PRECEDENCE. Since we want to register
	// listeners after the jobs are registered through the AutomaticJobRegistrar, we need to decrement its
	// order value by one. The creation of the AutomaticJobRegistrar bean is hidden deep in the automatic
	// batch configuration, so we unfortunately have to do it here.
	automaticJobRegistrar.setOrder(Ordered.LOWEST_PRECEDENCE - 1);
	addApplicationContextFactories(automaticJobRegistrar);
}
 
Example 44
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 45
Project: joal   File: CoreEventListener.java   Source Code and License 5 votes vote down vote up
@Async
@Order(Ordered.HIGHEST_PRECEDENCE)
@EventListener
void handleAnnounceRequesting(final AnnouncerWillAnnounceEvent event) {
    final RequestEvent announceEvent = event.getEvent();
    final TorrentWithStats torrent = event.getTorrent();
    logger.info(
            "Announced {} for torrent {} Up={}/Down={}/Left={}",
            announceEvent == RequestEvent.NONE ? "" : announceEvent,
            torrent.getTorrent().getName(),
            FileUtils.byteCountToDisplaySize(torrent.getUploaded()),
            FileUtils.byteCountToDisplaySize(torrent.getDownloaded()),
            FileUtils.byteCountToDisplaySize(torrent.getLeft())
    );
}
 
Example 46
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 47
Project: joal   File: WebAnnounceEventListener.java   Source Code and License 5 votes vote down vote up
@Order(Ordered.LOWEST_PRECEDENCE)
@EventListener
void handleAnnounceHasStopped(final AnnouncerHasStoppedEvent event) {
    logger.debug("Send AnnouncerHasStoppedEvent to clients.");

    this.messagingTemplate.convertAndSend("/announce", new AnnouncerHasStoppedPayload(event));
}
 
Example 48
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 49
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 50
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 51
Project: didi-eureka-server   File: EurekaServerAutoConfiguration.java   Source Code and License 5 votes vote down vote up
/**
 * Register the Jersey filter
 */
@Bean
public FilterRegistrationBean jerseyFilterRegistration(
		javax.ws.rs.core.Application eurekaJerseyApp) {
	FilterRegistrationBean bean = new FilterRegistrationBean();
	bean.setFilter(new ServletContainer(eurekaJerseyApp));
	bean.setOrder(Ordered.LOWEST_PRECEDENCE);
	bean.setUrlPatterns(
			Collections.singletonList(EurekaConstants.DEFAULT_PREFIX + "/*"));

	return bean;
}
 
Example 52
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 53
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 54
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 55
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 56
Project: joal   File: CoreEventListener.java   Source Code and License 5 votes vote down vote up
@Async
@Order(Ordered.HIGHEST_PRECEDENCE)
@EventListener
void handleSeedSessionHasStarted(final SeedSessionHasStartedEvent event) {
    logger.debug("Event SeedSessionHasStartedEvent caught.");
    // TODO : add a log to tell which BitTorrent client.
    // TODO : detailed BitTorrent client log at debug log level
}
 
Example 57
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
 
Example 58
Project: joal   File: WebTorrentFileEventListener.java   Source Code and License 5 votes vote down vote up
@Order(Ordered.LOWEST_PRECEDENCE)
@EventListener
void handleTorrentFileDeleted(final TorrentFileDeletedEvent event) {
    logger.debug("Send TorrentFileDeletedPayload to clients.");

    this.messagingTemplate.convertAndSend("/torrents", new TorrentFileDeletedPayload(event));
}
 
Example 59
Project: joal   File: WebAnnounceEventListener.java   Source Code and License 5 votes vote down vote up
@Order(Ordered.LOWEST_PRECEDENCE)
@EventListener
void handleAnnouncerFailedToAnnounce(final AnnouncerHasFailedToAnnounceEvent event) {
    logger.debug("Send AnnouncerHasFailedToAnnounceEvent to clients.");

    this.messagingTemplate.convertAndSend(
            "/announce",
            new AnnouncerHasFailedToAnnouncePayload(event)
    );
}
 
Example 60
Project: Spring-Security-Third-Edition   File: WebMvcConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
    super.addViewControllers(registry);

    registry.addViewController("/login/form")
            .setViewName("login");
    registry.addViewController("/errors/403")
            .setViewName("/errors/403");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}