Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
849065c
Refactor move jetty into separate module
rbygrave Jul 9, 2021
8b3bda7
Initial jex-jdk module
rbygrave Jul 11, 2021
ccaa67f
Move MultipartUtil into Jetty specific module
rbygrave Jul 11, 2021
519f846
Use responseHeader(key) for Context API
rbygrave Jul 11, 2021
e311929
Remove servlet api dependency - MultipartConfigElement -> UploadConfig
rbygrave Jul 12, 2021
6abd636
Add back API to set all Cookie attributes (using non-servlet Context.…
rbygrave Jul 12, 2021
2f41ab1
JDK explicit charset=utf-8 for plain text and html response
rbygrave Jul 12, 2021
66e4304
Fix Json stream with flush and close generator
rbygrave Jul 12, 2021
5528df5
JDK module add ExceptionManagerTest
rbygrave Jul 12, 2021
3a46971
JDK module add FilterTest
rbygrave Jul 12, 2021
5d9ad15
JDK module add ContextTest with host() and ip()
rbygrave Jul 12, 2021
0b4204f
JDK module add QueryParamTest with queryParam support
rbygrave Jul 12, 2021
f165f74
JDK module contextPath and fullUrl
rbygrave Jul 12, 2021
9ecc246
JDK module add NestedRoutesTest
rbygrave Jul 12, 2021
48ffb8c
JDK module add redirect handling
rbygrave Jul 12, 2021
312011c
test logging trace
rbygrave Jul 12, 2021
4aac189
Use java.net.HttpCookie for Context API
rbygrave Jul 12, 2021
0061375
JDK module cookie support with CookieParser
rbygrave Jul 12, 2021
1db52f0
Add Context.Cookie with better expires property and building (and ser…
rbygrave Jul 12, 2021
90be9e8
Tidy JdkContext
rbygrave Jul 12, 2021
b0ed590
Add AppLifecycle and HealthPlugin
rbygrave Jul 13, 2021
276a40a
Tidy Jex pom
rbygrave Jul 13, 2021
e0c3281
Tidy examples modules
rbygrave Jul 13, 2021
3738806
Tidy examples modules
rbygrave Jul 13, 2021
b5f841d
Add initial Grizzly support - avaje-jex-grizzly
rbygrave Jul 14, 2021
bb7da8f
Examples to use java 11
rbygrave Jul 16, 2021
cac4c74
Examples to use java 11
rbygrave Jul 16, 2021
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
61 changes: 61 additions & 0 deletions avaje-jetty-loom/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<artifactId>java11-oss</artifactId>
<groupId>org.avaje</groupId>
<version>3.2</version>
</parent>

<artifactId>avaje-jex-loomjetty</artifactId>
<groupId>io.avaje</groupId>
<version>1.0</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<javadoc.source>17</javadoc.source>
<java.release>17</java.release>
<jetty.version>11.0.2</jetty.version>
</properties>

<dependencies>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<version>1.0.0.RC1</version>
<executions>
<execution>
<id>add-module-infos</id>
<phase>package</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<jvmVersion>9</jvmVersion>
<module>
<moduleInfoFile>src/main/java9/module-info.java</moduleInfoFile>
</module>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
23 changes: 22 additions & 1 deletion avaje-jex-freemarker/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<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>
<parent>
<artifactId>avaje-jex-parent</artifactId>
Expand All @@ -21,6 +22,13 @@
<version>1.8-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-jex-jetty</artifactId>
<version>1.8-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
Expand All @@ -36,4 +44,17 @@

</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
--add-modules io.avaje.jex.jetty
</argLine>
</configuration>
</plugin>
</plugins>
</build>

</project>
2 changes: 2 additions & 0 deletions avaje-jex-freemarker/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
requires transitive freemarker;
requires java.net.http;

requires static io.avaje.jex.jetty;

provides io.avaje.jex.TemplateRender with io.avaje.jex.render.freemarker.FreeMarkerRender;
}
50 changes: 50 additions & 0 deletions avaje-jex-grizzly/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>avaje-jex-parent</artifactId>
<groupId>io.avaje</groupId>
<version>1.8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>avaje-jex-grizzly</artifactId>

<properties>
<!-- <java.release>17</java.version>-->
</properties>

<dependencies>

<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-jex</artifactId>
<version>1.8-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-http-server</artifactId>
<version>3.0.0</version>
</dependency>

<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-http2</artifactId>
<version>3.0.0</version>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>1.7.30</version>
<scope>test</scope>
</dependency>

</dependencies>



</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package io.avaje.jex.grizzly;

import org.glassfish.grizzly.http.server.Request;

import java.io.*;

class ContextUtil {

private static final int DEFAULT_BUFFER_SIZE = 8 * 1024;

private static final int BUFFER_MAX = 65536;

static byte[] requestBodyAsBytes(Request req) {
final int len = req.getContentLength();
try (final InputStream inputStream = req.getInputStream()) {

int bufferSize = len > -1 ? len : DEFAULT_BUFFER_SIZE;
if (bufferSize > BUFFER_MAX) {
bufferSize = BUFFER_MAX;
}
ByteArrayOutputStream os = new ByteArrayOutputStream(bufferSize);
copy(inputStream, os, bufferSize);
return os.toByteArray();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}

static void copy(InputStream in, OutputStream out, int bufferSize) throws IOException {
byte[] buffer = new byte[bufferSize];
int len;
while ((len = in.read(buffer, 0, bufferSize)) > 0) {
out.write(buffer, 0, len);
}
}

static String requestBodyAsString(Request request) {
final long requestLength = request.getContentLengthLong();
if (requestLength == 0) {
return "";
}
if (requestLength < 0) {
throw new IllegalStateException("No content-length set?");
}
final int bufferSize = requestLength > 512 ? 512 : (int)requestLength;

StringWriter writer = new StringWriter((int)requestLength);
final Reader reader = request.getReader();
try {
long transferred = 0;
char[] buffer = new char[bufferSize];
int nRead;
while ((nRead = reader.read(buffer, 0, bufferSize)) >= 0) {
writer.write(buffer, 0, nRead);
transferred += nRead;
if (transferred == requestLength) {
break;
}
}
return writer.toString();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}
Loading