Re: Exception when try to load class ResponseFilterHeaders.groovy

24 views
Skip to first unread message

Yuexiang Zhang

unread,
Dec 13, 2017, 9:33:34 PM12/13/17
to Georgios Papageorgiou, Nginx-Clojure
Hi, it's a bug about groovy filter.
commit 5ccdd fixed this bug.

On Wed, Dec 13, 2017 at 9:48 PM, Georgios Papageorgiou <g.d.papa...@gmail.com> wrote:
Hello, 

I have this groovy class 

package gr.test.headers;

import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import static nginx.clojure.java.Constants.PHASE_DONE;
import nginx.clojure.ChannelCloseAdapter;
import nginx.clojure.java.NginxJavaFilterRequest;
import nginx.clojure.java.NginxJavaHeaderFilter;

public class ResponseFilterHeaders implements NginxJavaHeaderFilter {

static Map<Long, NginxJavaFilterRequest> headerFilterRequests = new ConcurrentHashMap<Long, NginxJavaFilterRequest>();
public ResponseFilterHeaders() {
}
@Override
public Object[] doFilter(int status, Map<String, Object> request, Map<String, Object> responseHeaders)
throws IOException {
System.err.println("============= Inside invoke ResponseFilterHeaders =============");
System.err.println(status);
System.err.println(request);
return PHASE_DONE;
}
}

and when i am trying to start nginx i get the excpetion

java.lang.ClassCastException: gr.test.headers.ResponseFilterHeaders cannot be cast to nginx.clojure.java.NginxJavaRingHandler
at nginx.clojure.groovy.NginxGroovyHandlerFactory.newInstance(NginxGroovyHandlerFactory.java:36)
at nginx.clojure.NginxHandlerFactory.fetchHandler(NginxHandlerFactory.java:46)
at nginx.clojure.NginxClojureRT.registerCode(NginxClojureRT.java:866)
2017/12/13 15:38:15 [error] 3796#6728: invalid groovy header_filter code : gr.test.headers.ResponseFilterHeaders

my nginx.conf file is like...

  location / {
  resolver 10.2.3.16;
          rewrite_handler_type 'groovy';
          rewrite_handler_name 'gr.test.HelloGroovy';
  header_filter_type groovy;
  header_filter_name 'gr.test.headers.ResponseFilterHeaders';
  body_filter_type 'java';
  body_filter_name 'gr.test.body.ResponseFilterBody';
  proxy_pass $mytarget;
}

--
You received this message because you are subscribed to the Google Groups "Nginx-Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nginx-clojure+unsubscribe@googlegroups.com.
To post to this group, send email to nginx-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nginx-clojure/ee57de57-948d-4fa2-83be-78ab9ead96d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Georgios Papageorgiou

unread,
Dec 15, 2017, 2:59:26 AM12/15/17
to Nginx-Clojure
Hi,

It is working now
To unsubscribe from this group and stop receiving emails from it, send an email to nginx-clojur...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages