You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Edward S <su...@gmail.com> on 2008/01/28 16:28:48 UTC

Set/Read Response Code?

Hey guys,

Had a question.

I have a reader that reads in a XML containing 'x' URL's. Each URL returns a
PDF and this reader merges the PDF and gives a single PDF as the output.
Now, if something fails, i get a 0 page pdf with an error saying 'Cannot
open the pdf because it has 0 pages'

I have no way to find out, what failed in between (except for checking the
logs)

I want to modify it in such a way, that the reader can tell me which url's
failed.
So, I thot of nesting the sitemaps and writing a transformer that can go
thru each URL first and tell me if it returns a valid pdf or not. However,
for this to work...I need to set the response code in another component to
failure and read that response code here.

Any idea how I can do that?

thanks

Ed.

Re: Set/Read Response Code?

Posted by so...@apache.org.
Can we see the code?
Can you fix the code?

The Reader needs better handling of errors.  Find the code that
translates the URL into a PDF and make Exceptions return a PDF that
reads:
   This is where the PDF from:
   http://example.com/a.pdf
   would have been inserted if the following error had not occurred:
   IOException: Could not connect to example.com.

You could also write to the command line or a log to inform an
administrator, but explaining the error in the text will allow upset
people to provide something more relevant than variations of "I
received a blank document."

About catching the error before providing a response, have you tried
the usual method of throwing a Java Exception and catching with
<map:handle-errors> in the XMAP?  Which version of Cocoon may also be
relevant.

solprovider

On 1/28/08, Edward S <su...@gmail.com> wrote:
> I have a reader that reads in a XML containing 'x' URL's. Each URL returns a
> PDF and this reader merges the PDF and gives a single PDF as the output.
> Now, if something fails, i get a 0 page pdf with an error saying 'Cannot
> open the pdf because it has 0 pages'
>
> I have no way to find out, what failed in between (except for checking the
> logs)
>
> I want to modify it in such a way, that the reader can tell me which url's
> failed.
> So, I thot of nesting the sitemaps and writing a transformer that can go
> thru each URL first and tell me if it returns a valid pdf or not. However,
> for this to work...I need to set the response code in another component to
> failure and read that response code here.
>
> Any idea how I can do that?
>
> thanks
> Ed.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org