Skip to content

Commit 7271402

Browse files
Merge pull request #4 from ximanta/master
Seperated out Netty code from Server class.
2 parents 5234834 + c336e7b commit 7271402

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

src/main/java/guru/springframework/handlers/ProductHandlerImpl.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
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-
171
package guru.springframework.handlers;
182

193
import guru.springframework.repositories.ProductRepository;

src/main/java/guru/springframework/server/Server.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
public 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);

0 commit comments

Comments
 (0)