Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helloworld example extendned by GraalVM native-image generation #4800

Merged
merged 4 commits into from
Jul 2, 2021
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# maven noise
target/
target-*/
target*/

# gradle noise
.gradle
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[
{
"name":"org.glassfish.grizzly.Buffer[]"
},
{
"name":"org.glassfish.grizzly.ConnectionProbe[]"
},
{
"name":"org.glassfish.grizzly.IOEventLifeCycleListener[]"
},
{
"name":"org.glassfish.grizzly.TransportProbe[]"
},
{
"name":"org.glassfish.grizzly.http.HttpProbe[]"
},
{
"name":"org.glassfish.grizzly.http.TransferEncoding[]"
},
{
"name":"org.glassfish.grizzly.http.server.HttpServerProbe[]"
},
{
"name":"org.glassfish.grizzly.http.server.TagLocaleParser",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"name":"org.glassfish.grizzly.http.server.filecache.FileCacheProbe[]"
},
{
"name":"org.glassfish.grizzly.memory.MemoryProbe[]"
},
{
"name":"org.glassfish.grizzly.threadpool.ThreadPoolProbe[]"
},
{
"name":"org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainerProvider"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
[
{
"name":"org.glassfish.jersey.internal.config.ExternalPropertiesAutoDiscoverable",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.internal.inject.Custom",
"allDeclaredMethods":true
},
{
"name":"org.glassfish.jersey.internal.ServiceFinder",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.logging.LoggingFeatureAutoDiscoverable",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.AbstractFormProvider",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"org.glassfish.jersey.message.internal.BasicTypesMessageProvider",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.ByteArrayProvider",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.DataSourceProvider",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.EnumMessageProvider",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allPublicMethods":true,
"allDeclaredConstructors":true,
"allPublicConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.FileProvider",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.FormMultivaluedMapProvider",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.FormProvider",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.InputStreamProvider",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.ReaderProvider",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.RenderedImageProvider",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.SourceProvider$DomSourceReader",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.SourceProvider$SaxSourceReader",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.SourceProvider$SourceWriter",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.SourceProvider$StreamSourceReader",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.StreamingOutputProvider",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.message.internal.StringMessageProvider",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.process.Inflector",
"methods":[{"name":"apply","parameterTypes":["java.lang.Object"] }]
},
{
"name":"org.glassfish.jersey.process.internal.RequestScope",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"org.glassfish.jersey.spi.AbstractThreadPoolProvider",
"allDeclaredMethods":true
},
{
"name":"org.glassfish.jersey.spi.ScheduledThreadPoolExecutorProvider",
"allDeclaredMethods":true
},
{
"name":"org.glassfish.jersey.spi.ThreadPoolExecutorProvider",
"allDeclaredMethods":true
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"bundles": [
{"name": "org.glassfish.jersey.internal.localization"}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
[
{
"name":"org.glassfish.jersey.server.BackgroundScheduler",
"allDeclaredMethods":true
},
{
"name":"org.glassfish.jersey.server.ChunkedResponseWriter",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.server.ManagedAsyncExecutor",
"allDeclaredMethods":true
},
{
"name":"org.glassfish.jersey.server.ResourceConfig",
"allDeclaredMethods":true
},
{
"name":"org.glassfish.jersey.server.ServerExecutorProvidersConfigurator$DefaultBackgroundSchedulerProvider",
"allDeclaredMethods":true
},
{
"name":"org.glassfish.jersey.server.ServerExecutorProvidersConfigurator$DefaultManagedAsyncExecutorProvider",
"allDeclaredMethods":true
},
{
"name":"org.glassfish.jersey.server.filter.internal.ServerFiltersAutoDiscoverable",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.server.internal.monitoring.MonitoringAutodiscoverable",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.server.internal.monitoring.MonitoringContainerListener",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.server.internal.process.RequestProcessingContextReference",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.server.model.Parameter$ServerParameterService",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"name":"org.glassfish.jersey.server.wadl.WadlFeature",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allPublicMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.server.wadl.internal.WadlAutoDiscoverable",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"org.glassfish.jersey.server.wadl.processor.OptionsMethodProcessor$GenericOptionsInflector",
"allPublicMethods":true,
"allPublicConstructors":true
},
{
"name":"org.glassfish.jersey.server.wadl.processor.OptionsMethodProcessor$PlainTextOptionsInflector",
"allPublicMethods":true,
"allPublicConstructors":true
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"bundles": [
{"name":"org.glassfish.jersey.server.internal.localization"}
]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -40,7 +40,7 @@ public static void main(String[] args) {
server.start();

System.out.println("Application started.\nTry out");
System.out.println(String.format("%s%s%s", BASE_URI, ROOT_HELLO_PATH, "/Some%Name"));
System.out.println(String.format("%s%s%s", BASE_URI, ROOT_HELLO_PATH, "/Some%20Name"));
System.out.println(String.format("%s%s%s", BASE_URI, ROOT_COUNTER_PATH, "/request"));
System.out.println(String.format("%s%s%s", BASE_URI, ROOT_COUNTER_PATH, "/application"));
System.out.println("Stop the application using CTRL+C");
Expand Down
45 changes: 45 additions & 0 deletions examples/helloworld-programmatic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,51 @@
</plugins>
</build>
</profile>
<profile>
<id>native-image</id>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>native-image-maven-plugin</artifactId>
<version>${graalvm.version}</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<imageName>${project.artifactId}-native</imageName>
<mainClass>org.glassfish.jersey.examples.helloworld.App</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>

<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
<version>${jakarta.activation.version}</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-locator</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.framework</artifactId>
<version>${osgi.framework.version}</version>
</dependency>
</dependencies>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"name":"java.lang.ClassLoader",
"methods":[{"name":"getPlatformClassLoader","parameterTypes":[] }]
},
{
"name":"java.lang.NoSuchMethodError"
}
]
Loading