Hi Hippo's,
I try to catch HTTP exceptions in my sitemap with error handling. For do
this, i defined a selector like this
<map:selector name="httpException"
src="org.apache.cocoon.selection.XPathExceptionSelector">
<exception name="httpError" class="java.net.HttpURLConnection">
<xpath name="403" test="responseCode=403"/>
</exception>
<exception class="java.lang.Throwable" unroll="true"/>
</map:selector>
So, if I have well understand the error handling and the
XPathExceptionSelector, when java.net.HttpURLConnector raise an exception,
the selector try to
call the getResponseCode method and if the test is verified, the error
handler can be do the process. For try this, I define in the sitemap a
matcher like
<map:match pattern="check-repository">
<map:aggregate element="monit">
<map:part src="
http://siteuser:[EMAIL PROTECTED]/path/default.active/file.xml"/>
</map:aggregate>
<map:transform
src="site://transformers/system/check-repository/repository-ok.xsl"
type="xslt"/>
<map:transform src="site://transformers/util/stripnamespaces.xsl"
type="xslt"/>
<map:serialize type="xml"/>
</map:match>
and the handler below
<map:handle-errors when="always">
<map:select type="httpException">
<map:when test="403">
<map:aggregate element="check-repository">
<map:part src="site://resources/empty.xml"/>
</map:aggregate>
<map:transform
src="site://transformers/system/check-repository/repository-403.xsl"
type="xslt"/>
<map:transform
src="site://transformers/util/stripnamespaces.xsl" type="xslt"/>
<map:serialize type="xml"/>
</map:when>
</map:select></map:handle-errors>
but when, i try the URL, I receive the error in my browser and no exception
is catched by the handle-error.
What is wrong ? I have not correctly understand the handle-errors ? Just
one thing, I see in the log that the exception is not raised by
java.net.HttpURLConnection class but the java.io.IOException. I have try to
add this class in exception class attribute but without success and it's
normal (I think) so this class have not getResponseCode method.
Thanks in advance for your help and your ideas ;-)
Regards
--
-=[ ZeBBy™ ]=-
********************************************
Hippocms-dev: Hippo CMS development public mailinglist
Searchable archives can be found at:
MarkMail: http://hippocms-dev.markmail.org
Nabble: http://www.nabble.com/Hippo-CMS-f26633.html