Hi guys, I'm happily using Maverick for over 3 years now, and was really
surprised to discover this.
When HEAD http request comes to a view (in my case used by host uptime
monitor), I have following stacktrace:

2005-09-13 22:22:46,875 [http-9094-Processor23] ERROR
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].[dispatcher]
 - Servlet.service() for servlet dispatcher threw exception
java.lang.IllegalStateException: The previous step never tried to write
anything.  Perhaps the document path is incorrect?
        at
org.infohazard.maverick.util.FakeHttpServletResponse.getOutputAsString(FakeHttpServletResponse.java:99)
        at
org.infohazard.maverick.transform.StringTransformStep.done(StringTransformStep.java:87)
        at
org.infohazard.maverick.transform.DocumentTransform$Step.go(DocumentTransform.java:114)
        at org.infohazard.maverick.view.DocumentView.go(DocumentView.java:96)
        at
org.infohazard.maverick.flow.ViewWithTransforms.go(ViewWithTransforms.java:57)
        at org.infohazard.maverick.flow.CommandBase.go(CommandBase.java:79)
        at org.infohazard.maverick.Dispatcher.service(Dispatcher.java:345)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
        at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
        at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
        at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
        at
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:693)
        at
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:660)
        at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:45)
        at 
.....

Here is debug log:
2005-09-13 22:22:46,861 [http-9094-Processor23] DEBUG
org.infohazard.maverick.Dispatcher  - Command servlet path is:  /home.m
2005-09-13 22:22:46,861 [http-9094-Processor23] DEBUG
org.infohazard.maverick.Dispatcher  - Command context path is:  
2005-09-13 22:22:46,861 [http-9094-Processor23] DEBUG
org.infohazard.maverick.Dispatcher  - Servicing command:  home
2005-09-13 22:22:46,864 [http-9094-Processor23] DEBUG
org.infohazard.maverick.flow.CommandBase  - Switching to view:  success
2005-09-13 22:22:46,864 [http-9094-Processor23] DEBUG
org.infohazard.maverick.flow.MaverickContext  - Set 2 transform(s), of
which 2 will be executed
2005-09-13 22:22:46,864 [http-9094-Processor23] DEBUG
org.infohazard.maverick.flow.MaverickContext  - Creating transform step 0
2005-09-13 22:22:46,864 [http-9094-Processor23] DEBUG
org.infohazard.maverick.transform.DocumentTransform  - Wrapping text with
length 0
2005-09-13 22:22:46,865 [http-9094-Processor23] DEBUG
org.infohazard.maverick.flow.MaverickContext  - Creating transform step 1
2005-09-13 22:22:46,865 [http-9094-Processor23] DEBUG
org.infohazard.maverick.transform.DocumentTransform  - Transforming
(include) with document:  home.html
2005-09-13 22:22:46,865 [http-9094-Processor23] DEBUG
org.infohazard.maverick.transform.AbstractTransformStep  - Getting fake
response
2005-09-13 22:22:46,865 [http-9094-Processor23] DEBUG
org.infohazard.maverick.util.FakeHttpServletResponse  - Creating fake
response, original buffer size is 8192
2005-09-13 22:22:46,865 [http-9094-Processor23] DEBUG
org.infohazard.maverick.util.FakeHttpServletResponse  - Set header ETag to
W/"896-1126216638000"
2005-09-13 22:22:46,865 [http-9094-Processor23] DEBUG
org.infohazard.maverick.util.FakeHttpServletResponse  - Set header
Last-Modified to Thu, 08 Sep 2005 21:57:18 GMT
2005-09-13 22:22:46,865 [http-9094-Processor23] DEBUG
org.infohazard.maverick.util.FakeHttpServletResponse  - Setting
contentType to text/html
2005-09-13 22:22:46,866 [http-9094-Processor23] DEBUG
org.infohazard.maverick.util.FakeHttpServletResponse  - Someone wanted to
set contentLength to 896
2005-09-13 22:22:46,866 [http-9094-Processor23] DEBUG
org.infohazard.maverick.transform.StringTransformStep  - Done being
written to
2005-09-13 22:22:46,866 [http-9094-Processor23] DEBUG
org.infohazard.maverick.util.FakeHttpServletResponse  - Getting output as
String
2005-09-13 22:22:46,875 [http-9094-Processor23] ERROR
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].[dispatcher]
 - Servlet.service() for servlet dispatcher threw exception

And i makes sense because:
<quote from http://www.w3.org>
The HEAD method is identical to GET except that the server MUST NOT return
a message-body in the response. The metainformation contained in the HTTP
headers in response to a HEAD request SHOULD be identical to the
information sent in response to a GET request. This method can be used for
obtaining metainformation about the entity implied by the request without
transferring the entity-body itself. This method is often used for testing
hypertext links for validity, accessibility, and recent modification.
</quote>

I made a test through "Rex Swain's HTTP Viewer":
http://www.rexswain.com/httpview.html

Can someone think of any workaround?

Vladimir Yusseem


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
[INVALID FOOTER]

Reply via email to