"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/server/reactive/bootstrap/ReactorHttpsServer.java" between
spring-framework-5.3.7.tar.gz and spring-framework-5.3.8.tar.gz

About: Spring Framework is an application framework for the Java platform and .NET Framework. Community edition.

ReactorHttpsServer.java  (spring-framework-5.3.7):ReactorHttpsServer.java  (spring-framework-5.3.8)
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* https://www.apache.org/licenses/LICENSE-2.0 * https://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.testfixture.http.server.reactive.bootstrap; package org.springframework.web.testfixture.http.server.reactive.bootstrap;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import io.netty.handler.ssl.SslContextBuilder;
import io.netty.handler.ssl.util.SelfSignedCertificate; import io.netty.handler.ssl.util.SelfSignedCertificate;
import reactor.netty.DisposableServer; import reactor.netty.DisposableServer;
import reactor.netty.tcp.SslProvider.DefaultConfigurationType; import reactor.netty.http.Http11SslContextSpec;
import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter; import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter;
/** /**
* @author Stephane Maldini * @author Stephane Maldini
*/ */
public class ReactorHttpsServer extends AbstractHttpServer { public class ReactorHttpsServer extends AbstractHttpServer {
private ReactorHttpHandlerAdapter reactorHandler; private ReactorHttpHandlerAdapter reactorHandler;
private reactor.netty.http.server.HttpServer reactorServer; private reactor.netty.http.server.HttpServer reactorServer;
private AtomicReference<DisposableServer> serverRef = new AtomicReference <>(); private AtomicReference<DisposableServer> serverRef = new AtomicReference <>();
@Override @Override
protected void initServer() throws Exception { protected void initServer() throws Exception {
SelfSignedCertificate cert = new SelfSignedCertificate(); SelfSignedCertificate cert = new SelfSignedCertificate();
SslContextBuilder builder = SslContextBuilder.forServer(cert.cert ificate(), cert.privateKey()); Http11SslContextSpec http11SslContextSpec = Http11SslContextSpec. forServer(cert.certificate(), cert.privateKey());
this.reactorHandler = createHttpHandlerAdapter(); this.reactorHandler = createHttpHandlerAdapter();
this.reactorServer = reactor.netty.http.server.HttpServer.create( ) this.reactorServer = reactor.netty.http.server.HttpServer.create( )
.host(getHost()) .host(getHost())
.port(getPort()) .port(getPort())
.secure(spec -> spec.sslContext(builder).defaultConfigura tion(DefaultConfigurationType.TCP)); .secure(sslContextSpec -> sslContextSpec.sslContext(http1 1SslContextSpec));
} }
private ReactorHttpHandlerAdapter createHttpHandlerAdapter() { private ReactorHttpHandlerAdapter createHttpHandlerAdapter() {
return new ReactorHttpHandlerAdapter(resolveHttpHandler()); return new ReactorHttpHandlerAdapter(resolveHttpHandler());
} }
@Override @Override
protected void startInternal() { protected void startInternal() {
DisposableServer server = this.reactorServer.handle(this.reactorH andler).bind().block(); DisposableServer server = this.reactorServer.handle(this.reactorH andler).bind().block();
setPort(((InetSocketAddress) server.address()).getPort()); setPort(((InetSocketAddress) server.address()).getPort());
 End of changes. 6 change blocks. 
6 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)