File tree Expand file tree Collapse file tree 2 files changed +0
-24
lines changed
src/main/java/guru/springframework Expand file tree Collapse file tree 2 files changed +0
-24
lines changed Original file line number Diff line number Diff line change 1- /*
2- * Copyright 2002-2017 the original author or authors.
3- *
4- * Licensed under the Apache License, Version 2.0 (the "License");
5- * you may not use this file except in compliance with the License.
6- * You may obtain a copy of the License at
7- *
8- * http://www.apache.org/licenses/LICENSE-2.0
9- *
10- * Unless required by applicable law or agreed to in writing, software
11- * distributed under the License is distributed on an "AS IS" BASIS,
12- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13- * See the License for the specific language governing permissions and
14- * limitations under the License.
15- */
16-
171package guru .springframework .handlers ;
182
193import guru .springframework .repositories .ProductRepository ;
Original file line number Diff line number Diff line change 2828public class Server {
2929 public static void main (String [] args ) throws Exception {
3030 Server server = new Server ();
31- //server.startReactorServer("localhost", 8080);
3231 server .startTomcatServer ("localhost" , 8080 );
3332 System .out .println ("Press ENTER to exit." );
3433 System .in .read ();
@@ -42,13 +41,6 @@ public RouterFunction<ServerResponse> routingFunction() {
4241 .andRoute (method (HttpMethod .GET ), handler ::getAllProductsFromRepository )
4342 ).andRoute (POST ("/" ).and (contentType (APPLICATION_JSON )), handler ::saveProductToRepository ));
4443 }
45- public void startReactorServer (String host , int port ) throws InterruptedException {
46- RouterFunction <ServerResponse > route = routingFunction ();
47- HttpHandler httpHandler = toHttpHandler (route );
48- ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter (httpHandler );
49- HttpServer server = HttpServer .create (host , port );
50- server .newHandler (adapter ).block ();
51- }
5244 public void startTomcatServer (String host , int port ) throws LifecycleException {
5345 RouterFunction <?> route = routingFunction ();
5446 HttpHandler httpHandler = toHttpHandler (route );
You can’t perform that action at this time.
0 commit comments