这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos
package com.bolingcavalry.simplehello;
import nginx.clojure.java.ArrayMap;
import nginx.clojure.java.NginxJavaRingHandler;
import java.time.LocalDateTime;
import java.util.Map;
import static nginx.clojure.MiniConstants.CONTENT_TYPE;
import static nginx.clojure.MiniConstants.NGX_HTTP_OK;
public class HelloHandler implements NginxJavaRingHandler {
@Override
public Object[] invoke(Map<String, Object> request) {
return new Object[] {
NGX_HTTP_OK, //http status 200
ArrayMap.create(CONTENT_TYPE, "text/plain"), //headers map
"Hello, Nginx clojure! " + LocalDateTime.now() //response body can be string, File or Array/Collection of them
};
}
}
location /java {
content_handler_type 'java';
content_handler_name 'com.bolingcavalry.simplehello.HelloHandler';
}
jvm_options "-Xdebug";
jvm_options "-Xrunjdwp:server=y,transport=dt_socket,address=840#{pno},suspend=n";