users@grizzly.java.net

async filter help

From: rama <rama.rama_at_tiscali.it>
Date: Mon, 1 Dec 2008 22:38:46 +0100

Hello,

after reading a bit, i am ready for some new question :)

this is not the real code, i don't think
that this will work :D
but, the question is, if i get a shtml or ehtml file
i will do something (still to do)
if not, return true, should go to EulerStaticAdapter
but, the print is not executed.

can someone give to me a little hint?


---server---
        st = new SelectorThread();
        st.setPort(port);
        st.setMaxThreads(maxThreads);
        isStarted = true;

         st.setAdapter(new EulerStaticAdapter(root1,root2));

         st.setEnableAsyncExecution(true);
         AsyncHandler asyncHandler = new DefaultAsyncHandler();
         asyncHandler.addAsyncFilter(new EulerAsyncAdapter());
         st.setAsyncHandler(asyncHandler);

         try {
             st.listen();
         } catch (InstantiationException ex) {
             throw new IOException(ex.getMessage());
         }
---asyncadapter---
public class EulerAsyncAdapter implements AsyncFilter{

        public boolean doFilter(AsyncExecutor ex) {
                ProcessorTask pt = ex.getProcessorTask();
                String uri = pt.getRequestURI();
                
                if (uri.endsWith(".shtml") || uri.endsWith(".ehtml"))
                        return serverStupid();
                System.out.println(uri);
                return true;
        }

        private boolean serverStupid() {
                // TODO Auto-generated method stub
                return false;
        }

}
---sync---
public class EulerStaticAdapter implements Adapter {
public void service(Request req, final Response res) throws Exception {
        System.out.println(hey);
}
}