Skip to content
This repository was archived by the owner on Jun 2, 2023. It is now read-only.

Addspringbootwebsocket #54

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ Inside the application project there is a application.springboot.web package con

Inside the wlpcfg project there is the <code>it.springboot.web.HelloControllerTest</code> that will test the Spring MVC endpoint to ensure it is working.

## Spring Boot with WebSocket
This provides you with a SpringBoot application that will run on WebSphere Liberty.

Inside the application project there are four classes:
* application.springboot.Application</code>: The entry point for the SpringBoot application.
* application.springboot.websocket.MvcConfig</code>: Map each uri to static html resources
* application.springboot.websocket.SystemWebSocketHandler</code>: Creating a WebSocket server by implementing WebSocketHandler
* application.springboot.websocket.WebSocketConfig</code>: The WebSocket config class to map the WebSocket handler at a specific URL

Inside the wlpcfg project there is the <code>it.springboot.security.HelloControllerTest</code> that will test the /springbootwebsocket endpoint to ensure it is working.


## Websockets
This provides you with the websocket-1.1 feature.

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ allprojects {
mavenCentral()
}
dependencies {
classpath 'net.wasdev.wlp.gradle.plugins:liberty-gradle-plugin:1.1-SNAPSHOT'
classpath 'net.wasdev.wlp.gradle.plugins:liberty-gradle-plugin:1.0'
classpath files('gradle/wlp-anttasks.jar')
}
}
Expand Down
2 changes: 1 addition & 1 deletion liberty-starter-application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ liberty {
}

clean.dependsOn(':liberty-starter-wlpcfg:cleanServer')
war.dependsOn(':liberty-filter-application:publishWar', ':starter-microservice-test:publishTestWar', ':starter-microservice-web:publishWar', ':starter-microservice-persistence:publishWar', ':starter-microservice-rest:publishWar', ':starter-microservice-websocket:publishWar', ':starter-microservice-springboot-web:publishWar', ':starter-microservice-watsonsdk:publishWar', 'compressSkeletonBuildImage', 'copySpecialFiles', 'createSwaggerJSON')
war.dependsOn(':liberty-filter-application:publishWar', ':starter-microservice-test:publishTestWar', ':starter-microservice-web:publishWar', ':starter-microservice-persistence:publishWar', ':starter-microservice-rest:publishWar', ':starter-microservice-websocket:publishWar', ':starter-microservice-springboot-web:publishWar', ':starter-microservice-springboot-websocket:publishWar', ':starter-microservice-watsonsdk:publishWar', 'compressSkeletonBuildImage', 'copySpecialFiles', 'createSwaggerJSON')
installFeature.dependsOn('installLiberty')
libertyStart.dependsOn('installFeature', 'addServerEnv', 'publishWar')
fvt.dependsOn('libertyStart', 'testClasses')
Expand Down
6 changes: 6 additions & 0 deletions liberty-starter-application/src/main/resources/services.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
"name": "Watson SDK",
"description": "Adds the Watson SDK dependency to the project, allowing you to integrate Watson services",
"endpoint" : "/watsonsdk"
},
{
"id": "springbootwebsocket",
"name": "Spring Boot with WebSocket",
"description": "Spring Boot with WebSocket",
"endpoint" : "/springbootwebsocket"
}
]
}
1 change: 1 addition & 0 deletions liberty-starter-wlpcfg/servers/StarterServer/server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@
<application location="starter-microservice-watsonsdk.war" id="watsonsdk" context-root="/watsonsdk"></application>
<application location="starter-microservice-websocket.war" id="websocket" context-root="/websocket"></application>
<application location="starter-microservice-springboot-web.war" id="springbootweb" context-root="/springbootweb"></application>
<application location="starter-microservice-springboot-websocket.war" id="springbootwebsocket" context-root="/springbootwebsocket"></application>
</server>
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ include 'services:webservice'
*/

rootProject.name = 'LibertyUserExperience'
include 'liberty-starter-wlpcfg', 'liberty-filter-application', 'liberty-starter-application', 'starter-microservice-test', 'starter-microservice-web', 'starter-microservice-persistence', 'starter-microservice-rest', 'starter-microservice-websocket', 'starter-microservice-watsonsdk', 'starter-microservice-springboot-web', 'liberty-starter-model', 'liberty-starter-common'
include 'liberty-starter-wlpcfg', 'liberty-filter-application', 'liberty-starter-application', 'starter-microservice-test', 'starter-microservice-web', 'starter-microservice-persistence', 'starter-microservice-rest', 'starter-microservice-websocket', 'starter-microservice-watsonsdk', 'starter-microservice-springboot-web', 'starter-microservice-springboot-websocket', 'liberty-starter-model', 'liberty-starter-common'
7 changes: 7 additions & 0 deletions starter-microservice-springboot-websocket/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/target
/pom.xml
/build
/.settings
/.classpath
/.project
/bin
45 changes: 45 additions & 0 deletions starter-microservice-springboot-websocket/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2016 IBM Corp.
*
* 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.
*/

apply from: '../common-java.gradle'
apply from: '../common-war.gradle'

import com.ibm.liberty.starter.gradle.MavenTask
import com.ibm.liberty.starter.gradle.FvtTask

dependencies {
providedCompile group:'javax.ws.rs', name:'javax.ws.rs-api', version: '2.0'
providedCompile group:'javax.json', name:'javax.json-api', version:'1.0'
}

buildutils {
contextRoot = '/springbootwebsocket'
}

task installAllPOMs(type: MavenTask) {
id 'springbootwebsocket'
hasProvided true
hasRuntime true
hasCompile true
hasServerSnippet true
}

task fvt(type: FvtTask) {
id 'starter-microservice-springboot-websocket'
finalizedBy libertyStop
}

apply from: '../tech-type-task-graph.gradle'
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>net.wasdev.wlp.starters.springbootwebsocket</groupId>
<artifactId>compile-pom</artifactId>
<version>0.0.1</version>

<name>compile-pom</name>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>https://raw.github.com/WASdev/tool.artisan.core/master/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<connection>scm:git:[email protected]:WASdev/tool.artisan.core.git</connection>
<developerConnection>scm:[email protected]:WASdev/tool.artisan.core.git</developerConnection>
<url>[email protected]:WASdev/tool.artisan.core.git</url>
</scm>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<version>1.3.0.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>1.3.0.RELEASE</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>net.wasdev.wlp.starters.springbootwebsocket</groupId>
<artifactId>provided-pom</artifactId>
<version>0.0.1</version>

<name>provided-pom</name>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>https://raw.github.com/WASdev/tool.artisan.core/master/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<connection>scm:git:[email protected]:WASdev/tool.artisan.core.git</connection>
<developerConnection>scm:[email protected]:WASdev/tool.artisan.core.git</developerConnection>
<url>[email protected]:WASdev/tool.artisan.core.git</url>
</scm>

<repositories>
<repository>
<id>ibm-maven-repo</id>
<name>ibm-maven-repo</name>
<url>https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/repository/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.ibm.websphere.appserver.api</groupId>
<artifactId>com.ibm.websphere.appserver.api.servlet</artifactId>
<version>1.0.10</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>net.wasdev.wlp.starters.springbootwebsocket</groupId>
<artifactId>runtime-pom</artifactId>
<version>0.0.1</version>

<name>runtime-pom</name>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>https://raw.github.com/WASdev/tool.artisan.core/master/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<connection>scm:git:[email protected]:WASdev/tool.artisan.core.git</connection>
<developerConnection>scm:[email protected]:WASdev/tool.artisan.core.git</developerConnection>
<url>[email protected]:WASdev/tool.artisan.core.git</url>
</scm>

<dependencies>
<dependency>
<groupId>net.wasdev.wlp.starters.springbootwebsocket</groupId>
<artifactId>server-snippet</artifactId>
<type>xml</type>
<version>0.0.1</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- Copyright (c) 2016 IBM Corp.

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.-->
<server description="Websocket server snippet">

<!-- Enable features -->
<featureManager>
<feature>websocket-1.1</feature>
<feature>servlet-3.1</feature>
</featureManager>

</server>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2016 IBM Corp.
*
* 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 com.ibm.liberty.starter.service.springboot.websocket.api;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath("api")
public class TechnologyAPI extends Application {


}
Loading