About Question enthuware.jwpv6.2.747 :
Moderator: admin
-
- Posts: 4
- Joined: Mon Jan 11, 2016 1:52 pm
- Contact:
About Question enthuware.jwpv6.2.747 :
What if different protocol request (not HTTP) is made to url mapped to HttpServlet?
Will option "For any and every request, at least 1 of its methods will be called." be incorrect?
Will option "For any and every request, at least 1 of its methods will be called." be incorrect?
-
- Site Admin
- Posts: 10102
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.747 :
Unless specified in the question, or unless the question is clearly about the protocols, you have to consider HTTP only.
But to answer your question, I am not sure how you can map a protocol to a servlet. A protocol is implemented by the web server, which interprets the incoming request and invokes appropriate handler. For example, if an HTTP request goes to Tomcat server, it will interpret the request and forward it to appropriate servlet. If you send a non-http request to Tomcat, it will not understand the request and there is no question of the request reaching the servlet.
But to answer your question, I am not sure how you can map a protocol to a servlet. A protocol is implemented by the web server, which interprets the incoming request and invokes appropriate handler. For example, if an HTTP request goes to Tomcat server, it will interpret the request and forward it to appropriate servlet. If you send a non-http request to Tomcat, it will not understand the request and there is no question of the request reaching the servlet.
If you like our products and services, please help us by posting your review here.
-
- Posts: 4
- Joined: Mon Jan 11, 2016 1:52 pm
- Contact:
Re: About Question enthuware.jwpv6.2.747 :
For sure I agree it would be a problem with any server available.
Yet, regarding spec itself, GenericServlet was intended to be protocol independent.
Yet, regarding spec itself, GenericServlet was intended to be protocol independent.
-
- Site Admin
- Posts: 10102
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.747 :
GenericServlet, yes, it can be used for any protocol. But HttpServlet, No. HttpServlet is meant for HTTP only.
If you like our products and services, please help us by posting your review here.
-
- Posts: 358
- Joined: Fri Nov 29, 2013 8:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.747 :
Hi,
the explanation says when the first request is made to a servlet, the init() method is called.
By according to Chapter 2.3.2 of Serlvet 3.0 specification, init() method is called before the servlet handles any request.
So, I think regardless there is a first request or not, the init() method is always called after the serlvet has been instantiated.
the explanation says when the first request is made to a servlet, the init() method is called.
By according to Chapter 2.3.2 of Serlvet 3.0 specification, init() method is called before the servlet handles any request.
So, I think regardless there is a first request or not, the init() method is always called after the serlvet has been instantiated.
-
- Site Admin
- Posts: 10102
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.747 :
But a container may not even initialize a servlet if there is no request. You can only state for certain that it will be called before the first request is processed by the servlet.
This question clearly specifies, "Assuming that it is not preloaded or preinitialized,....", therefore the explanation is correct.
HTH,
Paul.
This question clearly specifies, "Assuming that it is not preloaded or preinitialized,....", therefore the explanation is correct.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 1 guest