Actually "serverStupid" will just return false, this was just an
example :D
the problem is that EulerStaticAdapter (service) isn't executed
neither if doFilter return true, neither if doFilter return false.
what i expected to obtain (after reading the example) is that if i
get "serverStupid" (return false) the execution of all
the next filter (Both sync and async) is blocked. with return true,
all the other filter (synch and async) are executed.
in this example, sync is never executed :(
tnx :)
> Salut,
>
> answering that one before the others :-)
>
> rama wrote:
>> 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());
>> }
>
> So far so good.
>
>> ---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;
>> }
>
> Yes it will works :-) But what serverStupid will do? if you want to
> see an example of AsyncFilter, take a look at:
>
> https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/comet/
> CometAsyncFilter.html
>
> Thanks
>
> -- Jeanfrancois
>
>
>> 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);
>> }
>> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>