About Question enthuware.jwpv6.2.582 :

Moderator: admin

Post Reply
himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

About Question enthuware.jwpv6.2.582 :

Post by himaiMinh »

Let me add one more listener:
Any class annotated with WebListener must implement one or more of the ServletContextListener, ServletContextAttributeListener, ServletRequestListener, ServletRequestAttributeListener, HttpSessionListener or HttpSessionAttributeListener interface.
Let me add "as well as AsyncListener."

admin
Site Admin
Posts: 10209
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.582 :

Post by admin »

JavaDoc description of this annotation doesn't mention AsyncListener: https://docs.oracle.com/javaee/6/api/ja ... tener.html
If you like our products and services, please help us by posting your review here.

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

Re: About Question enthuware.jwpv6.2.582 :

Post by johnlong »

Any class annotated with WebListener must implement one or more of the ServletContextListener, ServletContextAttributeListener, ServletRequestListener, ServletRequestAttributeListener, HttpSessionListener or HttpSessionAttributeListener interface.

Where did you get this requirement? Could you please indicate source?

admin
Site Admin
Posts: 10209
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.582 :

Post by admin »

johnlong wrote:Any class annotated with WebListener must implement one or more of the ServletContextListener, ServletContextAttributeListener, ServletRequestListener, ServletRequestAttributeListener, HttpSessionListener or HttpSessionAttributeListener interface.

Where did you get this requirement? Could you please indicate source?
Section 8.1.4, Servlet 3.0 specification.

HTH
Paul.
If you like our products and services, please help us by posting your review here.

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

Re: About Question enthuware.jwpv6.2.582 :

Post by johnlong »

Thanks.

1. I have annotated my class @WebListener and my class implements AsyncListener and works fine.
2. Also I am able to annotate my class @WebListener not implementing any Listener interfaces at all.

admin
Site Admin
Posts: 10209
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.582 :

Post by admin »

Some times servlet containers fail to adhere to the specification 100%. The reason could be a mistake or something that only they can tell.
If you like our products and services, please help us by posting your review here.

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

Re: About Question enthuware.jwpv6.2.582 :

Post by johnlong »

Ok, but then according to specification we cannot annotate AsyncListener as @WebListener?

admin
Site Admin
Posts: 10209
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.582 :

Post by admin »

You can annotate any class with @WebListener if the class implements one of the valid interfaces for being a web listeners i.e. HttpServletListener, ContextListener etc.
If you like our products and services, please help us by posting your review here.

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

Re: About Question enthuware.jwpv6.2.582 :

Post by johnlong »

I am very sorry, I did not get your last explanation.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests