-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc(quickstarts): improved hello-world example
Removed declared exception in ResourceMojo.extractEnricherConfig that is never thrown #2780 Signed-off-by: wayne kirimi <kirimiwayne@gmail.com> --- chore(example): Added /hello endpoint that prints a message Signed-off-by: wayne kirimi <kirimiwayne@gmail.com> --- chore(example): Removed declarations of thrown exceptions Signed-off-by: wayne kirimi <kirimiwayne@gmail.com> --- chore(example): Updated image name Signed-off-by: wayne kirimi <kirimiwayne@gmail.com> --- chore(example): Updated quickstart readme Signed-off-by: wayne kirimi <kirimiwayne@gmail.com> --- chore(example): Updated quickstart with requested changes Signed-off-by: wayne kirimi <kirimiwayne@gmail.com> --- chore(example): Updated project Readme Signed-off-by: wayne kirimi <kirimiwayne@gmail.com> --- chore(example): Refactored a child class. Signed-off-by: wayne kirimi <kirimiwayne@gmail.com> --- Merge branch 'master' into improve-example-2788 --- fix/quickstart-example: Fixed requested changes. Signed-off-by:wayne kirimi <kirimiwayne@gmail.com> --- Update RootHandler.java --- Readme changes for Hello-World quickstart --- Readme change --- review: fix hello-world quickstart
- Loading branch information
1 parent
78a7989
commit ea0085f
Showing
5 changed files
with
129 additions
and
101 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
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
44 changes: 44 additions & 0 deletions
44
...arts/maven/hello-world/src/main/java/org/eclipse/jkube/sample/helloworld/RootHandler.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,44 @@ | ||
/* | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* 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: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.jkube.sample.helloworld; | ||
|
||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
import java.util.logging.Logger; | ||
import java.util.logging.Level; | ||
|
||
import com.sun.net.httpserver.HttpExchange; | ||
import com.sun.net.httpserver.HttpHandler; | ||
|
||
/** | ||
* @author: Wayne Kirimi | ||
*/ | ||
public class RootHandler implements HttpHandler { | ||
|
||
private static final Logger log = Logger.getLogger(App.class.getSimpleName()); | ||
|
||
@Override | ||
public void handle(HttpExchange exchange) { | ||
try (OutputStream outputStream = exchange.getResponseBody()) { | ||
log.info("GET /hello"); | ||
String response = "Hello World"; | ||
exchange.sendResponseHeaders(200, response.length()); | ||
exchange.getResponseHeaders().set("Content-Type", "text/plain"); | ||
outputStream.write(response.getBytes()); | ||
log.info("Response written successfully: " + response); | ||
} catch (IOException e) { | ||
log.severe("Server failed to respond: " + e.getMessage()); | ||
} | ||
} | ||
} |