Nginx with Java library

Jennie Jia Jennie.Jia at
Thu May 23 21:29:32 UTC 2019

I am following the example posted by 

Here is my code to do the logic, but I checking the java library provided by this nginx-clojure  I can not figure out how to get  "cookie" header value from the http request ( it use here.  Any help are appreciated.!

Here is my nginx.conf

location /java {
          content_handler_type  java;
          content_handler_name  example.MyHandler;

Here is my  java code

package example;

import static nginx.clojure.MiniConstants.*;
import static nginx.clojure.NginxClojureRT.*;

import java.util.Map;
import org.onap.portalsdk.core.onboarding.util.CipherUtil;

import nginx.clojure.MiniConstants;

public class MyHandler implements NginxJavaRingHandler {

	public MyHandler() {

	public Object[] invoke(Map<String, Object> request) throws IOException {
		NginxJavaRequest req = ((NginxJavaRequest)request);
		// TODO  Need Figure out how to get Cookie from the request
		String encryptedCookie = req.getVariable("cookie");   // not sure if it is correct
		if (encryptedCookie == null) 
			return new Object[] { 
			NGX_HTTP_UNAUTHORIZED, //http status 401
		String decryptedCookie = "";
		    try {
		    	decryptedCookie = CipherUtil.decryptPKC(encryptedCookie);
		    } catch (Exception e) {
		return  new Object[] { 
			NGX_HTTP_OK, //http status 200


-----Original Message-----
From: nginx <nginx-bounces at> On Behalf Of Patrick
Sent: Wednesday, May 22, 2019 8:35 PM
To: nginx at
Subject: Re: Nginx with Java library

On 2019-05-22 14:02, Jennie Jia wrote:
> The java library is ONAP Portal/SDK

If you can find the cookie decryption library, then you can call it from clojure -- though spinning up a clojure/java runtime to get access to a cookie seems to be expensive unless you're already writing clojure code.

nginx mailing list
nginx at
This email and the information contained herein is proprietary and confidential and subject to the Amdocs Email Terms of Service, which you may review at <>

More information about the nginx mailing list