Esempio n. 1
0
        /// <summary>
        /// Receives an HTTP HEAD request from the protected
        /// Service method and handles the
        /// request.
        /// The client sends a HEAD request when it wants
        /// to see only the headers of a response, such as
        /// Content-Type or Content-Length. The HTTP HEAD
        /// method counts the output bytes in the response
        /// to set the Content-Length header accurately.
        ///
        /// If you override this method, you can avoid computing
        /// the response body and just set the response headers
        /// directly to improve performance. Make sure that the
        /// DoHead method you write is both safe
        /// and idempotent (that is, protects itself from being
        /// called multiple times for one HTTP HEAD request).
        ///
        /// If the HTTP HEAD request is incorrectly formatted,
        /// DoHead returns an HTTP "Bad Request"
        /// message.
        /// </summary>
        /// <param name="req">the request object that is passed to the servlet</param>
        /// <param name="resp">the response object that the servlet uses to return the headers to the clien</param>
        /// <exception cref="IOException">if an input or output error occurs</exception>
        /// <exception cref="ServletException">if the request for the HEAD could not be handled</exception>
        protected void DoHead(IHttpServletRequest req, IHttpServletResponse resp)
        {
            NoBodyResponse response = new NoBodyResponse(resp);

            DoGet(req, (IHttpServletResponse)response);
            response.SetContentLength();
        }
Esempio n. 2
0
        /// <summary>
        /// Receives an HTTP HEAD request from the protected
        /// Service method and handles the
        /// request.
        /// The client sends a HEAD request when it wants
        /// to see only the headers of a response, such as
        /// Content-Type or Content-Length. The HTTP HEAD
        /// method counts the output bytes in the response
        /// to set the Content-Length header accurately.
        /// 
        /// If you override this method, you can avoid computing
        /// the response body and just set the response headers
        /// directly to improve performance. Make sure that the
        /// DoHead method you write is both safe
        /// and idempotent (that is, protects itself from being
        /// called multiple times for one HTTP HEAD request).
        /// 
        /// If the HTTP HEAD request is incorrectly formatted,
        /// DoHead returns an HTTP "Bad Request"
        /// message.
        /// </summary>
        /// <param name="req">the request object that is passed to the servlet</param>
        /// <param name="resp">the response object that the servlet uses to return the headers to the clien</param>
        /// <exception cref="IOException">if an input or output error occurs</exception>
        /// <exception cref="ServletException">if the request for the HEAD could not be handled</exception>
        protected void DoHead(IHttpServletRequest req, IHttpServletResponse resp)
        {
            NoBodyResponse response = new NoBodyResponse(resp);

            DoGet(req, (IHttpServletResponse)response);
            response.SetContentLength();
        }