Skip to content

Commit

Permalink
Added WebSocketSecureExample
Browse files Browse the repository at this point in the history
  • Loading branch information
A.Lepe committed Aug 9, 2022
1 parent 04058d6 commit 017868b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/test/java/spark/examples/hello/HelloSecureWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
public class HelloSecureWorld {
public static void main(String[] args) {
if(args.length == 0) {
secure("/home/lepe/Projects/git/spark/keystore.jks", "yourpasswordhere", null, null);
//secure(SparkTestUtil.getKeyStoreLocation(), SparkTestUtil.getKeystorePassword(), null, null);
secure(SparkTestUtil.getKeyStoreLocation(), SparkTestUtil.getKeystorePassword(), null, null);
} else {
secure(args[0], args[1], null, null);
}
Expand Down
38 changes: 38 additions & 0 deletions src/test/java/spark/examples/websocket/WebSocketSecureExample.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2011- Per Wendel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package spark.examples.websocket;

import spark.util.SparkTestUtil;

import static spark.Spark.init;
import static spark.Spark.secure;
import static spark.Spark.staticFiles;
import static spark.Spark.webSocket;

public class WebSocketSecureExample {

public static void main(String[] args) {
// Will serve all static file are under "/public" in classpath if the route isn't consumed by others routes.
staticFiles.location("/public");

secure(SparkTestUtil.getKeyStoreLocation(), SparkTestUtil.getKeystorePassword(), null, null);

webSocket("/echo", EchoWebSocket.class);
webSocket("/ping", PingWebSocket.class);
init();
}
}

0 comments on commit 017868b

Please sign in to comment.