Skip to content

Commit 3aa03c8

Browse files
authored
Tidy Context, imports, javadoc, whitespace (#70)
1 parent e661b16 commit 3aa03c8

File tree

4 files changed

+12
-21
lines changed

4 files changed

+12
-21
lines changed

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

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

364-
class Cookie {
364+
/**
365+
* Gets basic-auth credentials from the request, or throws.
366+
*
367+
* <p>Returns a wrapper object containing the Base64 decoded username
368+
* and password from the Authorization header, or null if basic-auth is not properly configured
369+
*/
370+
BasicAuthCredentials basicAuthCredentials();
371+
372+
final class Cookie {
365373
private static final ZonedDateTime EXPIRED = ZonedDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0, 0), ZoneId.of("GMT"));
366374
private static final DateTimeFormatter RFC_1123_DATE_TIME = DateTimeFormatter.RFC_1123_DATE_TIME;
367375
private static final String PARAM_SEPARATOR = "; ";
@@ -375,7 +383,7 @@ class Cookie {
375383
private boolean httpOnly;
376384

377385
private Cookie(String name, String value) {
378-
if (name == null || name.length() == 0) {
386+
if (name == null || name.isEmpty()) {
379387
throw new IllegalArgumentException("name required");
380388
}
381389
this.name = name;
@@ -492,12 +500,4 @@ public String toString() {
492500
}
493501
}
494502

495-
/**
496-
* Gets basic-auth credentials from the request, or throws.
497-
*
498-
* <p>Returns a wrapper object containing the Base64 decoded username
499-
* and password from the Authorization header, or null if basic-auth is not properly configured
500-
*/
501-
BasicAuthCredentials basicAuthCredentials();
502-
503503
}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,10 @@ public JexConfig renderer(String extension, TemplateRender renderer) {
7373

7474
@Override
7575
public ThreadFactory threadFactory() {
76-
7776
if (factory == null) {
7877
factory =
7978
Thread.ofVirtual().name("avaje-jex-http-", 0).factory();
8079
}
81-
8280
return factory;
8381
}
8482

@@ -130,7 +128,6 @@ public Map<String, TemplateRender> renderers() {
130128

131129
@Override
132130
public SSLContext sslContext() {
133-
134131
return this.sslContext;
135132
}
136133

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
import java.util.Map;
1111
import java.util.Set;
1212

13-
import io.avaje.jex.Routing.Entry;
14-
import io.avaje.jex.Routing.Group;
15-
import io.avaje.jex.Routing.HttpService;
16-
import io.avaje.jex.Routing.Type;
1713
import io.avaje.jex.security.Role;
1814

1915
final class DefaultRouting implements Routing {

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
import java.io.IOException;
44

5-
import com.sun.net.httpserver.Filter.Chain;
6-
75
/**
86
* A filter used to pre- and post-process incoming requests. Pre-processing occurs before the
97
* application's exchange handler is invoked, and post-processing occurs after the exchange handler
108
* returns. Filters are organized in chains, and are associated with {@link Context} instances.
119
*
1210
* <p>Each {@code HttpFilter} in the chain, invokes the next filter within its own {@link
13-
* #filter(Context, Chain)} implementation. The final {@code HttpFilter} in the chain invokes the
11+
* #filter(Context, FilterChain)} implementation. The final {@code HttpFilter} in the chain invokes the
1412
* applications exchange handler.
1513
*/
1614
@FunctionalInterface
@@ -26,7 +24,7 @@ public interface HttpFilter {
2624
* <ol>
2725
* <li>Invoke the next filter in the chain, by calling {@link FilterChain#proceed}.
2826
* <li>Terminate the chain of invocation, by <b>not</b> calling {@link
29-
* FilterChain#filter}.
27+
* FilterChain#proceed()}.
3028
* </ol>
3129
* <li>If option 1. above is taken, then when filter() returns all subsequent filters in the
3230
* Chain have been called, and the response headers can be examined or modified.

0 commit comments

Comments
 (0)