Skip to content

Commit

Permalink
Tidy Context, imports, javadoc, whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
rbygrave committed Nov 24, 2024
1 parent e661b16 commit eb4ca59
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 21 deletions.
20 changes: 10 additions & 10 deletions avaje-jex/src/main/java/io/avaje/jex/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,15 @@ default Context render(String name) {
*/
String protocol();

class Cookie {
/**
* Gets basic-auth credentials from the request, or throws.
*
* <p>Returns a wrapper object containing the Base64 decoded username
* and password from the Authorization header, or null if basic-auth is not properly configured
*/
BasicAuthCredentials basicAuthCredentials();

final class Cookie {
private static final ZonedDateTime EXPIRED = ZonedDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0, 0), ZoneId.of("GMT"));
private static final DateTimeFormatter RFC_1123_DATE_TIME = DateTimeFormatter.RFC_1123_DATE_TIME;
private static final String PARAM_SEPARATOR = "; ";
Expand All @@ -375,7 +383,7 @@ class Cookie {
private boolean httpOnly;

private Cookie(String name, String value) {
if (name == null || name.length() == 0) {
if (name == null || name.isEmpty()) {
throw new IllegalArgumentException("name required");
}
this.name = name;
Expand Down Expand Up @@ -492,12 +500,4 @@ public String toString() {
}
}

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

}
3 changes: 0 additions & 3 deletions avaje-jex/src/main/java/io/avaje/jex/DJexConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,10 @@ public JexConfig renderer(String extension, TemplateRender renderer) {

@Override
public ThreadFactory threadFactory() {

if (factory == null) {
factory =
Thread.ofVirtual().name("avaje-jex-http-", 0).factory();
}

return factory;
}

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

@Override
public SSLContext sslContext() {

return this.sslContext;
}

Expand Down
4 changes: 0 additions & 4 deletions avaje-jex/src/main/java/io/avaje/jex/DefaultRouting.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
import java.util.Map;
import java.util.Set;

import io.avaje.jex.Routing.Entry;
import io.avaje.jex.Routing.Group;
import io.avaje.jex.Routing.HttpService;
import io.avaje.jex.Routing.Type;
import io.avaje.jex.security.Role;

final class DefaultRouting implements Routing {
Expand Down
6 changes: 2 additions & 4 deletions avaje-jex/src/main/java/io/avaje/jex/HttpFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

import java.io.IOException;

import com.sun.net.httpserver.Filter.Chain;

/**
* A filter used to pre- and post-process incoming requests. Pre-processing occurs before the
* application's exchange handler is invoked, and post-processing occurs after the exchange handler
* returns. Filters are organized in chains, and are associated with {@link Context} instances.
*
* <p>Each {@code HttpFilter} in the chain, invokes the next filter within its own {@link
* #filter(Context, Chain)} implementation. The final {@code HttpFilter} in the chain invokes the
* #filter(Context, FilterChain)} implementation. The final {@code HttpFilter} in the chain invokes the
* applications exchange handler.
*/
@FunctionalInterface
Expand All @@ -26,7 +24,7 @@ public interface HttpFilter {
* <ol>
* <li>Invoke the next filter in the chain, by calling {@link FilterChain#proceed}.
* <li>Terminate the chain of invocation, by <b>not</b> calling {@link
* FilterChain#filter}.
* FilterChain#proceed()}.
* </ol>
* <li>If option 1. above is taken, then when filter() returns all subsequent filters in the
* Chain have been called, and the response headers can be examined or modified.
Expand Down

0 comments on commit eb4ca59

Please sign in to comment.