location /myClojure { content_handler_type 'clojure'; content_handler_name 'my.hello/hello-world'; }
import static nginx.clojure.MiniConstants.*; import nginx.clojure.java.NginxJavaRingHandler; import java.util.HashMap; import java.util.Map; public class Hello 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, Java & Nginx!" //response body can be string, File or Array/Collection of them }; } }