Skip to content

Commit 95592d9

Browse files
authored
Merge pull request #67 from SentryMan/clear-unused
Remove Unused Code
2 parents 6ae1c15 + d6a9fb1 commit 95592d9

File tree

12 files changed

+2
-245
lines changed

12 files changed

+2
-245
lines changed

README.md

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7,62 +7,17 @@
77

88
# avaje-jex
99

10-
Java cut down version of https://javalin.io
10+
Javalin style Wrapper over the JDK's `jdk.httpserver` server.
1111

1212
```java
1313
var app = Jex.create()
1414
.routing(routing -> routing
1515
.get("/", ctx -> ctx.text("hello"))
1616
.get("/one/{id}", ctx -> ctx.text("one-" + ctx.pathParam("id")))
1717
)
18-
.staticFiles().addClasspath("/static", "content")
19-
.staticFiles().addExternal("/other", "/external")
2018
.port(8080)
2119
.start();
22-
2320
```
2421

25-
### Goals / intention
26-
27-
- Help progress converting Javalin internals from Kotlin to Java
28-
- Convert bits of Javalin internals to Java
29-
- Maybe get feedback from David if there is design impact
30-
- Prepare small PR's to Javalin (this is going to take time)
31-
32-
- Another goal is to explore some options for Javalin along the lines of
33-
- matching routes (making use of path segment count)
34-
- organisation of internals to reduce some statics (JavalinJson)
35-
- modularisation of internals using ServiceLoader (for templating implementation, websockets and sse - make these all optional dependencies keeping core small)
36-
37-
### Design Notes (different to Javalin):
38-
- Context is an interface
39-
- Routing, ErrorHandling, StaticFileConfig are interfaces
40-
- PathParser - Has segment count which we use with RouteIndex
41-
- RouteIndex - matching paths by method + number of segments
42-
- Immutable routes on startup - no adding/removing routes after start()
43-
- Context json() - call through to "ServiceManager" which has the JsonService (no static JavalinJson)
44-
45-
### Differences to Javalin
46-
- Uses `{}` rather than `:` for defining path parameters
47-
- Supports use of regex in path segments e.g `{id:[0-9]+}` (provides tighter path matching)
48-
- Added ctx.text(...) for plain text response
49-
- Method name change to use ctx.write(...) rather than ctx.result(...)
50-
5122
### TODO
52-
- cookie store
53-
- app attributes
54-
- basicAuthCredentials/basicAuthCredentialsExist
55-
- plugin api
56-
- render in progress - FreeMarker and Mustache done
57-
- web sockets
58-
- sse
59-
60-
### Intentionally excluded features
61-
-
62-
63-
64-
### To Review
65-
- Javalin uses int getContentLength() rather than long getContentLengthLong()
66-
- Javalin removeCookie should set null path to "/"
67-
- endpointHandlerPath()
68-
- bodyValidator
23+
- static file configuration

avaje-jex/src/main/java/io/avaje/jex/Context.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -361,21 +361,6 @@ default Context render(String name) {
361361
*/
362362
String protocol();
363363

364-
/**
365-
* Return the first UploadedFile for the specified name or null.
366-
*/
367-
UploadedFile uploadedFile(String name);
368-
369-
/**
370-
* Return a list of UploadedFiles for the specified name, or empty list.
371-
*/
372-
List<UploadedFile> uploadedFiles(String name);
373-
374-
/**
375-
* Return a list of all UploadedFiles.
376-
*/
377-
List<UploadedFile> uploadedFiles();
378-
379364
class Cookie {
380365
private static final ZonedDateTime EXPIRED = ZonedDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0, 0), ZoneId.of("GMT"));
381366
private static final DateTimeFormatter RFC_1123_DATE_TIME = DateTimeFormatter.RFC_1123_DATE_TIME;

avaje-jex/src/main/java/io/avaje/jex/DJex.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,9 @@ final class DJex implements Jex {
1515

1616
private final Routing routing = new DefaultRouting();
1717
private final AppLifecycle lifecycle = new DefaultLifecycle();
18-
private final StaticFileConfig staticFiles;
1918
private final Map<Class<?>, Object> attributes = new HashMap<>();
2019
private final DJexConfig config = new DJexConfig();
2120

22-
DJex() {
23-
this.staticFiles = new DefaultStaticFileConfig(this);
24-
}
25-
2621
@Override
2722
public DJexConfig config() {
2823
return config;
@@ -105,11 +100,6 @@ public Jex context(String contextPath) {
105100
return this;
106101
}
107102

108-
@Override
109-
public StaticFileConfig staticFiles() {
110-
return staticFiles;
111-
}
112-
113103
@Override
114104
public Jex register(TemplateRender renderer, String... extensions) {
115105
for (String extension : extensions) {

avaje-jex/src/main/java/io/avaje/jex/DJexConfig.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ final class DJexConfig implements JexConfig {
2020

2121
private boolean preCompressStaticFiles;
2222
private JsonService jsonService;
23-
private UploadConfig multipartConfig;
24-
private int multipartFileThreshold = 8 * 1024;
2523
private final Map<String, TemplateRender> renderers = new HashMap<>();
2624
private SSLContext sslContext;
2725

@@ -67,18 +65,6 @@ public JexConfig jsonService(JsonService jsonService) {
6765
return this;
6866
}
6967

70-
@Override
71-
public JexConfig multipartConfig(UploadConfig multipartConfig) {
72-
this.multipartConfig = multipartConfig;
73-
return this;
74-
}
75-
76-
@Override
77-
public JexConfig multipartFileThreshold(int multipartFileThreshold) {
78-
this.multipartFileThreshold = multipartFileThreshold;
79-
return this;
80-
}
81-
8268
@Override
8369
public JexConfig renderer(String extension, TemplateRender renderer) {
8470
renderers.put(extension, renderer);
@@ -137,16 +123,6 @@ public JsonService jsonService() {
137123
return jsonService;
138124
}
139125

140-
@Override
141-
public UploadConfig multipartConfig() {
142-
return multipartConfig;
143-
}
144-
145-
@Override
146-
public int multipartFileThreshold() {
147-
return multipartFileThreshold;
148-
}
149-
150126
@Override
151127
public Map<String, TemplateRender> renderers() {
152128
return renderers;

avaje-jex/src/main/java/io/avaje/jex/DefaultStaticFileConfig.java

Lines changed: 0 additions & 42 deletions
This file was deleted.

avaje-jex/src/main/java/io/avaje/jex/Jex.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@ static Jex create() {
107107
*/
108108
Jex context(String contextPath);
109109

110-
/**
111-
* Return the static file configuration.
112-
*/
113-
StaticFileConfig staticFiles();
114-
115110
/**
116111
* Explicitly register a template renderer.
117112
* <p>

avaje-jex/src/main/java/io/avaje/jex/JexConfig.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,6 @@ public sealed interface JexConfig permits DJexConfig {
4949
*/
5050
JexConfig jsonService(JsonService jsonService);
5151

52-
/**
53-
* Set the upload configuration.
54-
*/
55-
JexConfig multipartConfig(UploadConfig multipartConfig);
56-
57-
/**
58-
* Set the multipartFileThreshold.
59-
*/
60-
JexConfig multipartFileThreshold(int multipartFileThreshold);
61-
6252
/**
6353
* Register a template renderer explicitly.
6454
*
@@ -118,16 +108,6 @@ public sealed interface JexConfig permits DJexConfig {
118108
/** Enable https with the provided SSLContext. */
119109
JexConfig sslContext(SSLContext ssl);
120110

121-
/**
122-
* Return the multipartConfig.
123-
*/
124-
UploadConfig multipartConfig();
125-
126-
/**
127-
* Return the multipartFileThreshold.
128-
*/
129-
int multipartFileThreshold();
130-
131111
/**
132112
* Return the template renderers registered by extension.
133113
*/

avaje-jex/src/main/java/io/avaje/jex/StaticFileConfig.java

Lines changed: 0 additions & 16 deletions
This file was deleted.

avaje-jex/src/main/java/io/avaje/jex/StaticFileSource.java

Lines changed: 0 additions & 9 deletions
This file was deleted.

avaje-jex/src/main/java/io/avaje/jex/UploadConfig.java

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)