How can I send user authentication information while makingURLConnection?
Servlet Interview Questions and Answers
(Continued from previous question...)
11. How can I send user authentication information while makingURLConnection?
You'll want to use HttpURLConnection.setRequestProperty and set all the appropriate headers to HTTP authorization.
(Continued on next question...)
Other Interview Questions
- What is Servlet?
- Why is Servlet so popular?
- What is servlet container?
- When a client request is sent to the servlet container, how does the container choose which servlet to invoke?
- If a servlet is not properly initialized, what exception may be thrown?
- Given the request path below, which are context path, servlet path and path info?
- What is filter? Can filter be used as request or response?
- When using servlets to build the HTML, you build a DOCTYPE line, why do you do that?
- What is new in ServletRequest interface?(Servlet 2.4)
- Request parameter How to find whether a parameter exists in the request object?
- How can I send user authentication information while makingURLConnection?
- Can we use the constructor, instead of init(), to initialize servlet?
- How can a servlet refresh automatically if some new data has entered the database?
- The code in a finally clause will never fail to execute, right?
- What mechanisms are used by a Servlet Container to maintain session information?
- Difference between GET and POST
- What is session?
- What is servlet mapping?
- What is servlet context ?
- Which interface must be implemented by all servlets?
- Explain the life cycle of Servlet.
- When is the servlet instance created in the life cycle of servlet? What is the importance of configuring a servlet?
- Why don't we write a constructor in a servlet?
- When we don't write any constructor for the servlet, how does container create an instance of servlet?
- Once the destroy() method is called by the container, will the servlet be immediately destroyed? What happens to the tasks(threads) that the servlet might be executing at that time?
- What is the difference between callling a RequestDispatcher using ServletRequest and ServletContext?
- Why is it that we can't give relative URL's when using ServletContext.getRequestDispatcher() when we can use the same while calling ServletRequest.getRequestDispatcher()?
|