Java 类org.springframework.boot.devtools.remote.server.DispatcherFilter 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RemoteDevToolsAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
public DispatcherFilter remoteDevToolsDispatcherFilter(AccessManager accessManager,
        Collection<HandlerMapper> mappers) {
    Dispatcher dispatcher = new Dispatcher(accessManager, mappers);
    return new DispatcherFilter(dispatcher);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HttpTunnelIntegrationTests.java   
@Bean
public DispatcherFilter filter() {
    PortProvider port = new StaticPortProvider(this.httpServerPort);
    TargetServerConnection connection = new SocketTargetServerConnection(port);
    HttpTunnelServer server = new HttpTunnelServer(connection);
    HandlerMapper mapper = new UrlHandlerMapper("/httptunnel",
            new HttpTunnelServerHandler(server));
    Collection<HandlerMapper> mappers = Collections.singleton(mapper);
    Dispatcher dispatcher = new Dispatcher(AccessManager.PERMIT_ALL, mappers);
    return new DispatcherFilter(dispatcher);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void ignoresUnmappedUrl() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI("/restart");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertRestartInvoked(false);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void ignoresIfMissingSecretFromRequest() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH + "/restart");
    filter.doFilter(this.request, this.response, this.chain);
    assertRestartInvoked(false);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void ignoresInvalidSecretInRequest() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH + "/restart");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "invalid");
    filter.doFilter(this.request, this.response, this.chain);
    assertRestartInvoked(false);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void invokeRestartWithDefaultSetup() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH + "/restart");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertRestartInvoked(true);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void invokeRestartWithCustomServerContextPath() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret",
            "server.context-path:/test");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI("/test" + DEFAULT_CONTEXT_PATH + "/restart");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertRestartInvoked(true);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void invokeTunnelWithDefaultSetup() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH + "/debug");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertTunnelInvoked(true);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void invokeTunnelWithCustomServerContextPath() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret",
            "server.context-path:/test");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI("/test" + DEFAULT_CONTEXT_PATH + "/debug");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertTunnelInvoked(true);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void invokeTunnelWithCustomHeaderName() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret",
            "spring.devtools.remote.secretHeaderName:customheader");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH + "/debug");
    this.request.addHeader("customheader", "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertTunnelInvoked(true);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void devToolsHealthReturns200() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH);
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    this.response.setStatus(500);
    filter.doFilter(this.request, this.response, this.chain);
    assertThat(this.response.getStatus()).isEqualTo(200);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void devToolsHealthWithCustomServerContextPathReturns200() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret",
            "server.context-path:/test");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI("/test" + DEFAULT_CONTEXT_PATH);
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    this.response.setStatus(500);
    filter.doFilter(this.request, this.response, this.chain);
    assertThat(this.response.getStatus()).isEqualTo(200);
}
项目:spring-boot-concourse    文件:RemoteDevToolsAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
public DispatcherFilter remoteDevToolsDispatcherFilter(AccessManager accessManager,
        Collection<HandlerMapper> mappers) {
    Dispatcher dispatcher = new Dispatcher(accessManager, mappers);
    return new DispatcherFilter(dispatcher);
}
项目:spring-boot-concourse    文件:HttpTunnelIntegrationTests.java   
@Bean
public DispatcherFilter filter() {
    PortProvider port = new StaticPortProvider(this.httpServerPort);
    TargetServerConnection connection = new SocketTargetServerConnection(port);
    HttpTunnelServer server = new HttpTunnelServer(connection);
    HandlerMapper mapper = new UrlHandlerMapper("/httptunnel",
            new HttpTunnelServerHandler(server));
    Collection<HandlerMapper> mappers = Collections.singleton(mapper);
    Dispatcher dispatcher = new Dispatcher(AccessManager.PERMIT_ALL, mappers);
    return new DispatcherFilter(dispatcher);
}
项目:spring-boot-concourse    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void ignoresUnmappedUrl() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI("/restart");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertRestartInvoked(false);
}
项目:spring-boot-concourse    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void ignoresIfMissingSecretFromRequest() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH + "/restart");
    filter.doFilter(this.request, this.response, this.chain);
    assertRestartInvoked(false);
}
项目:spring-boot-concourse    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void ignoresInvalidSecretInRequest() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH + "/restart");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "invalid");
    filter.doFilter(this.request, this.response, this.chain);
    assertRestartInvoked(false);
}
项目:spring-boot-concourse    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void invokeRestartWithDefaultSetup() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH + "/restart");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertRestartInvoked(true);
}
项目:spring-boot-concourse    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void invokeRestartWithCustomServerContextPath() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret",
            "server.context-path:/test");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI("/test" + DEFAULT_CONTEXT_PATH + "/restart");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertRestartInvoked(true);
}
项目:spring-boot-concourse    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void invokeTunnelWithDefaultSetup() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH + "/debug");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertTunnelInvoked(true);
}
项目:spring-boot-concourse    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void invokeTunnelWithCustomServerContextPath() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret",
            "server.context-path:/test");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI("/test" + DEFAULT_CONTEXT_PATH + "/debug");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertTunnelInvoked(true);
}
项目:spring-boot-concourse    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void invokeTunnelWithCustomHeaderName() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret",
            "spring.devtools.remote.secretHeaderName:customheader");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH + "/debug");
    this.request.addHeader("customheader", "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertTunnelInvoked(true);
}
项目:spring-boot-concourse    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void devToolsHealthReturns200() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH);
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    this.response.setStatus(500);
    filter.doFilter(this.request, this.response, this.chain);
    assertThat(this.response.getStatus()).isEqualTo(200);
}
项目:spring-boot-concourse    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void devToolsHealthWithCustomServerContextPathReturns200() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret",
            "server.context-path:/test");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI("/test" + DEFAULT_CONTEXT_PATH);
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    this.response.setStatus(500);
    filter.doFilter(this.request, this.response, this.chain);
    assertThat(this.response.getStatus()).isEqualTo(200);
}
项目:contestparser    文件:RemoteDevToolsAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
public DispatcherFilter remoteDevToolsDispatcherFilter(AccessManager accessManager,
        Collection<HandlerMapper> mappers) {
    Dispatcher dispatcher = new Dispatcher(accessManager, mappers);
    return new DispatcherFilter(dispatcher);
}
项目:contestparser    文件:HttpTunnelIntegrationTest.java   
@Bean
public DispatcherFilter filter() {
    PortProvider port = new StaticPortProvider(this.httpServerPort);
    TargetServerConnection connection = new SocketTargetServerConnection(port);
    HttpTunnelServer server = new HttpTunnelServer(connection);
    HandlerMapper mapper = new UrlHandlerMapper("/httptunnel",
            new HttpTunnelServerHandler(server));
    Collection<HandlerMapper> mappers = Collections.singleton(mapper);
    Dispatcher dispatcher = new Dispatcher(AccessManager.PERMIT_ALL, mappers);
    return new DispatcherFilter(dispatcher);
}
项目:contestparser    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void ignoresUnmappedUrl() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI("/restart");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertRestartInvoked(false);
}
项目:contestparser    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void ignoresIfMissingSecretFromRequest() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH + "/restart");
    filter.doFilter(this.request, this.response, this.chain);
    assertRestartInvoked(false);
}
项目:contestparser    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void ignoresInvalidSecretInRequest() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH + "/restart");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "invalid");
    filter.doFilter(this.request, this.response, this.chain);
    assertRestartInvoked(false);
}
项目:contestparser    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void invokeRestartWithDefaultSetup() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH + "/restart");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertRestartInvoked(true);
}
项目:contestparser    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void invokeTunnelWithDefaultSetup() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH + "/debug");
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertTunnelInvoked(true);
}
项目:contestparser    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void invokeTunnelWithCustomHeaderName() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret",
            "spring.devtools.remote.secretHeaderName:customheader");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH + "/debug");
    this.request.addHeader("customheader", "supersecret");
    filter.doFilter(this.request, this.response, this.chain);
    assertTunnelInvoked(true);
}
项目:contestparser    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void devToolsHealthReturns200() throws Exception {
    loadContext("spring.devtools.remote.secret:supersecret");
    DispatcherFilter filter = this.context.getBean(DispatcherFilter.class);
    this.request.setRequestURI(DEFAULT_CONTEXT_PATH);
    this.request.addHeader(DEFAULT_SECRET_HEADER_NAME, "supersecret");
    this.response.setStatus(500);
    filter.doFilter(this.request, this.response, this.chain);
    assertThat(this.response.getStatus(), equalTo(200));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void disabledIfRemoteSecretIsMissing() throws Exception {
    loadContext("a:b");
    this.thrown.expect(NoSuchBeanDefinitionException.class);
    this.context.getBean(DispatcherFilter.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RemoteClientConfigurationTests.java   
@Bean
public DispatcherFilter dispatcherFilter() throws IOException {
    return new DispatcherFilter(dispatcher());
}
项目:spring-boot-concourse    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void disabledIfRemoteSecretIsMissing() throws Exception {
    loadContext("a:b");
    this.thrown.expect(NoSuchBeanDefinitionException.class);
    this.context.getBean(DispatcherFilter.class);
}
项目:spring-boot-concourse    文件:RemoteClientConfigurationTests.java   
@Bean
public DispatcherFilter dispatcherFilter() throws IOException {
    return new DispatcherFilter(dispatcher());
}
项目:contestparser    文件:RemoteDevToolsAutoConfigurationTests.java   
@Test
public void disabledIfRemoteSecretIsMissing() throws Exception {
    loadContext("a:b");
    this.thrown.expect(NoSuchBeanDefinitionException.class);
    this.context.getBean(DispatcherFilter.class);
}
项目:contestparser    文件:RemoteClientConfigurationTests.java   
@Bean
public DispatcherFilter dispatcherFilter() throws IOException {
    return new DispatcherFilter(dispatcher());
}