-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip with felix, stuck at jetty multiple connectors
- Loading branch information
1 parent
4f65695
commit 2fc6ebb
Showing
11 changed files
with
138 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...rver.manager/src/main/java/org/eclipse/kura/http/server/manager/HttpConnectorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Eurotech and/or its affiliates and others | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Eurotech | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.kura.http.server.manager; | ||
|
||
import java.util.EnumSet; | ||
|
||
import org.apache.felix.http.jetty.ConnectorFactory; | ||
import org.eclipse.jetty.http.HttpMethod; | ||
import org.eclipse.jetty.server.Connector; | ||
import org.eclipse.jetty.server.HttpConfiguration; | ||
import org.eclipse.jetty.server.HttpConnectionFactory; | ||
import org.eclipse.jetty.server.Server; | ||
import org.eclipse.jetty.server.ServerConnector; | ||
|
||
public class HttpConnectorFactory implements ConnectorFactory { | ||
|
||
private final int port; | ||
|
||
public HttpConnectorFactory(int port) { | ||
this.port = port; | ||
} | ||
|
||
@Override | ||
public Connector createConnector(Server server) { | ||
HttpConnectionFactory connFactory = new HttpConnectionFactory(); | ||
configureHttpConnectionFactory(connFactory); | ||
|
||
ServerConnector connector = new ServerConnector(server, config.getAcceptors(), config.getSelectors(), | ||
connFactory); | ||
|
||
HttpConfiguration httpConfiguration = new HttpConfiguration(); | ||
httpConfiguration.addCustomizer(new BlockHttpMethods(EnumSet.of(HttpMethod.TRACE))); | ||
|
||
for (final int port : ports) { | ||
final ServerConnector newConnector = new ServerConnector(serverConnector.getServer(), | ||
new HttpConnectionFactory(httpConfiguration)); | ||
|
||
customizeConnector(newConnector, port); | ||
serverConnector.getServer().addConnector(newConnector); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters