• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

4 Servlet Related Questions....

 
Sandesh Tathare
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question 1]
The servlet container cannot place the servlet into service
if the init method Throws a ServletException or
Does not return within a time period defined by the Web server
What is the maximum time period a Web server waits for Servlet's init() method to return? Is it server specific? Where this value is being set?
-------------------------------------------------------------------------
Question 2]
One can forward or include using RequestDispatcher to foreign context.
But How can we access foreign context? Javadoc says about path passed as parameter as mentioned below:
The pathname must begin with a "/" and is interpreted as relative to the current context root.
-------------------------------------------------------------------------
Question 3]
public java.lang.String getContextPath() of HttpServletRequest
For servlets in the default (root) context, this method returns "".
What is default context?
Is it putting class file in webapps folder of Tomcat directly?
--------------------------------------------------------------------------
Question 4]
public java.lang.String getQueryString() of HttpServletRequest
Returns:
a String containing the query string or null if the URL contains no query string. The value is not decoded by the container.
What kind of decoding container do?
Can any one tell for which values Container does decoding?
--------------------------------------------------------------------------
Thanks in advance.
Sandesh
 
Shiva Mantri
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q1. Dont know and not sure about my response. Seems like a web server must process the request within a specified time period, otherwise it will return Request Timeout message (code 408).
Q2.
The pathname must begin with a "/" and is interpreted as relative to the current context root

The path is NOT interpreted relative to current context, but relative to server's document root and is matched against the context roots of other web applications hosted on the container.
Q3. in tomcat, its webapp/ROOT context. you have to specify your servlets even in root context to be picked up, else container wont initialize them. you can access resources without specifying context. eg: http://localhost:8080/test.jsp or http://localhost:8080/testServlet provided you specified testServlet in the deployment descriptor.
Q4. dont know...!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic