Ultrakompakter HTTP Server
ulrich
2024-02-23 4d253a518cdd889ad84c8f873aa615e14b6d9ca8
Filter hinzugefuegt
2 files modified
12 ■■■■■ changed files
src/de/uhilger/neon/Factory.java 10 ●●●●● patch | view | raw | blame | history
src/de/uhilger/neon/entity/ContextDescriptor.java 2 ●●●●● patch | view | raw | blame | history
src/de/uhilger/neon/Factory.java
@@ -19,6 +19,7 @@
import com.google.gson.Gson;
import com.sun.net.httpserver.Authenticator;
import com.sun.net.httpserver.Filter;
import com.sun.net.httpserver.HttpContext;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
@@ -199,6 +200,15 @@
        //    ctx.getAttributes().putAll(d.authenticator.attributes);
        //    fireAuthenticatorCreated(ctx, auth);
        //}
        for(String filterClassName : cd.filter) {
          //
          Object filterObj = Class.forName(filterClassName)
                .getDeclaredConstructor().newInstance();
          if(filterObj instanceof Filter) {
            Filter filter = (Filter) filterObj;
            ctx.getFilters().add(filter);
          }
        }
        fireHandlerCreated(ctx, h);
        fireContextCreated(ctx);
      } else {
src/de/uhilger/neon/entity/ContextDescriptor.java
@@ -17,6 +17,7 @@
 */
package de.uhilger.neon.entity;
import java.util.List;
import java.util.Map;
/**
@@ -28,6 +29,7 @@
  public String className;
  public boolean sharedHandler;
  public String contextPath;
  public List<String> filter;
  public String authenticator;
  public Map<String, String> attributes;
}