Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corpus-web-services
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lange, Dr. Herbert
corpus-web-services
Commits
63846f23
Commit
63846f23
authored
Jun 16, 2021
by
Lange, Dr. Herbert
Browse files
Options
Downloads
Patches
Plain Diff
Initial commit
parents
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pom.xml
+107
-0
107 additions, 0 deletions
pom.xml
src/main/java/de/uni_hamburg/corpora/server/Main.java
+45
-0
45 additions, 0 deletions
src/main/java/de/uni_hamburg/corpora/server/Main.java
with
152 additions
and
0 deletions
pom.xml
0 → 100644
+
107
−
0
View file @
63846f23
<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/maven-v4_0_0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
de.uni_hamburg.corpora.server
</groupId>
<artifactId>
corpus-web-service
</artifactId>
<packaging>
jar
</packaging>
<version>
1.0-SNAPSHOT
</version>
<name>
corpus-web-service
</name>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.glassfish.jersey
</groupId>
<artifactId>
jersey-bom
</artifactId>
<version>
${jersey.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.glassfish.jersey.containers
</groupId>
<artifactId>
jersey-container-grizzly2-http
</artifactId>
</dependency>
<dependency>
<groupId>
org.glassfish.jersey.inject
</groupId>
<artifactId>
jersey-hk2
</artifactId>
</dependency>
<!-- uncomment this to get JSON support:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-binding</artifactId>
</dependency>
-->
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.12
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
de.uni_hamburg.corpora
</groupId>
<artifactId>
corpus-services
</artifactId>
<version>
1.0
</version>
<type>
jar
</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.8.1
</version>
<inherited>
true
</inherited>
<configuration>
<source>
1.8
</source>
<target>
1.8
</target>
</configuration>
</plugin>
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
exec-maven-plugin
</artifactId>
<version>
1.2.1
</version>
<executions>
<execution>
<goals>
<goal>
java
</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>
de.uni_hamburg.corpora.server.Main
</mainClass>
</configuration>
</plugin>
<!--
https://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven
-->
<plugin>
<artifactId>
maven-assembly-plugin
</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>
de.uni_hamburg.corpora.server.Main
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>
jar-with-dependencies
</descriptorRef>
</descriptorRefs>
<appendAssemblyId>
false
</appendAssemblyId>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jersey.version>
2.34
</jersey.version>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
</project>
This diff is collapsed.
Click to expand it.
src/main/java/de/uni_hamburg/corpora/server/Main.java
0 → 100644
+
45
−
0
View file @
63846f23
package
de.uni_hamburg.corpora.server
;
import
org.glassfish.grizzly.http.server.HttpServer
;
import
org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory
;
import
org.glassfish.jersey.server.ResourceConfig
;
import
java.io.IOException
;
import
java.net.URI
;
/**
* Main class.
*
*/
public
class
Main
{
// Base URI the Grizzly HTTP server will listen on
public
static
final
String
BASE_URI
=
"http://localhost:8080/"
;
/**
* Starts Grizzly HTTP server exposing JAX-RS resources defined in this application.
* @return Grizzly HTTP server.
*/
public
static
HttpServer
startServer
()
{
// create a resource config that scans for JAX-RS resources and providers
// in de.uni_hamburg.corpora package
final
ResourceConfig
rc
=
new
ResourceConfig
().
packages
(
"de.uni_hamburg.corpora.server"
);
// create and start a new instance of grizzly http server
// exposing the Jersey application at BASE_URI
return
GrizzlyHttpServerFactory
.
createHttpServer
(
URI
.
create
(
BASE_URI
),
rc
);
}
/**
* Main method.
* @param args
* @throws IOException
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
final
HttpServer
server
=
startServer
();
System
.
out
.
println
(
String
.
format
(
"Jersey app started with endpoints available at "
+
"%s%nHit Ctrl-C to stop it..."
,
BASE_URI
));
System
.
in
.
read
();
server
.
stop
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment