1. How do you request via other methods? Well, as icecoolz already explained, you use the normal HttpServlet class and override the service() method or override one of these methods directly - doGet(), doPost(), doHead(), doDelete(), doPut(), etc. You already knew that, I guess. The service() method itself is not typically overridden, nor are the doTrace() and doOptions() methods, since the service method automatically handles TRACE and OPTIONS methods by calling the required methods automatically. Also, know that doGet automatically provides support for HEAD operations too, so there would be no point in overriding that either.
2. To make your servlet handle these requests, you have to override them manually. Know that you do not ever override them by default, unless you know what you are doing since its very easy to mess it up and you hardly ever use the doPut, doDelete methods, except in some rare custom applications running on AS's such as WebLogic, where you need the functionality. So, if I were to override, lets say the doPut method, which is like using FTP to send a file. It would look something like this:
Code:
protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
So when you send a file/request to store it in the server with the PUT form method, this doPut() method is called and its contents executed. Of course, if you use such a method, you have to remember to not modify any content headers sent with the request including Content-Length, Content-Type, Content-Transfer-Encoding, Content-Encoding, Content-Base, Content-Language, Content-Location, Content-MD5, and Content-Range, unless you want to see a 501 Not Implemented error. Overriding rules depend on the method that's being overridden. See this page for more rules:
http://java.sun.com/products/servlet...tpServlet.html
Also remember that this works only for HTTP 1.1.
Coming to the HttpURLConnection class, its just a URLConnection class with support for HTTP features, such as status codes, redirects (301/302, etc), Content Type, Encoding, headers, etc. Most of its features are derived from java.net.URLConnection. If I were to explain all the features and supported methods in the class, it would make a really, really huge post. Instead, here's the link to the official class doc, along with detailed explanations of the methods.
http://java.sun.com/j2se/1.4.2/docs/...onnection.html
I will post examples later, if you still need them.