You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by vijay visu <vi...@yahoo.com> on 2006/01/18 09:32:10 UTC
Dynamic charts issues in batch PDF generation
hi
i am doing a code which generates the PDF in a batch
process.
These PDFs include dynamically built charts by
servlets.
I am making use of external-graphic tag to pick the
images.
These servlets throw jpeg image of the charts in the
output stream.
These servlets should be called for each PDFs
generated since each chart will be unique.
My problem is that the servlets which builds the
dynamic charts are called
for the first time only. On the subsequent calls the
old charts are
only built in PDF and the servlets are not getting
called.
Please help me out in this problem
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Dynamic charts issues in batch PDF generation
Posted by Glen Mazza <gm...@apache.org>.
Clay Leeds wrote:
> Heh... no, I'm not sure. That's what I understood the OP to mean when I
> read:
>
>>>> My problem is that the servlets which builds the
>>>> dynamic charts are called for the first time only. On the
>>>> subsequent calls the
>>>> old charts are only built in PDF and the servlets are not getting
>>>> called.
>
>
> I take this to mean that since FOP does not see a change in the URL/
> servlet call generating the fo:external-graphic element, it uses a
> 'cached' version. I suspect that unless the call is modified--at least
> slightly--using a technique similar to what Jeremias described, FOP
> will continue to think that there is no need to call the servlet again,
> thereby causing the 'old' chart to be used.
>
I didn't think that FOP can or is coded to make servlet calls while
running (IIC, the SRC property[1] for external-graphics is just pointing
to a URI reference on a file server.) But I am unsure, and so would
definitely welcome correction on this point if that is not the case.
[1] http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#src
Glen
> Of course, it would help if vijay visu (the OP) would clarify this point.
>
> Web Maestro Clay
>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Dynamic charts issues in batch PDF generation
Posted by Clay Leeds <we...@mac.com>.
On Jan 20, 2006, at 9:22 AM, Glen Mazza wrote:
> Clay Leeds wrote:
>> I understood the OP (pasted at the bottom of this msg) to mean
>> there is a caching problem with the JPEG image of each chart.
>
> Are you sure? The proxy/client is getting only a PDF document
> (MIME type application/pdf), no JPEGs. The JPEGs are incorporated
> within the PDF documents. Nothing is sent to the proxy/client
> until the PDF document is finished (would have to be, if only to
> solve the "Page 1 of XXX" resolution issues.) I would think the
> proxy/client would be completely oblivious to the fact that the PDF
> contains JPEGs within it when it receives the application/pdf stream.
>
> No problem whatsoever with the rest of what you're saying, just
> this premise.
>
> Glen
Heh... no, I'm not sure. That's what I understood the OP to mean when
I read:
>>> My problem is that the servlets which builds the
>>> dynamic charts are called for the first time only. On the
>>> subsequent calls the
>>> old charts are only built in PDF and the servlets are not getting
>>> called.
I take this to mean that since FOP does not see a change in the URL/
servlet call generating the fo:external-graphic element, it uses a
'cached' version. I suspect that unless the call is modified--at
least slightly--using a technique similar to what Jeremias described,
FOP will continue to think that there is no need to call the servlet
again, thereby causing the 'old' chart to be used.
Of course, it would help if vijay visu (the OP) would clarify this
point.
Web Maestro Clay
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Dynamic charts issues in batch PDF generation
Posted by Glen Mazza <gm...@apache.org>.
Clay Leeds wrote:
> On Jan 20, 2006, at 6:28 AM, Jeroen van der Vegt wrote:
>
>> I'm not sure I correctly understand the problem anymore, but this
>> might be relevant:
>>
>> Can't you let the JPEG servlet indicate that its output should not be
>> cached? I use this code to disable various cache mechanism:
>>
>> private void setNoCache(HttpServletResponse resp) {
>> resp.setHeader("Pragma","No-Cache");
>> resp.setHeader("Cache-Control","no-Cache");
>> resp.setDateHeader("Expires", 0 );
>> }
>>
>> Regards,
>>
>> Jeroen
>
>
> I understood the OP (pasted at the bottom of this msg) to mean there is
> a caching problem with the JPEG image of each chart.
>
Are you sure? The proxy/client is getting only a PDF document (MIME
type application/pdf), no JPEGs. The JPEGs are incorporated within the
PDF documents. Nothing is sent to the proxy/client until the PDF
document is finished (would have to be, if only to solve the "Page 1 of
XXX" resolution issues.) I would think the proxy/client would be
completely oblivious to the fact that the PDF contains JPEGs within it
when it receives the application/pdf stream.
No problem whatsoever with the rest of what you're saying, just this
premise.
Glen
> My previous post supported Jeremias 'simple' fix whereby each chart be
> given a different URI (PATH, name, etc.)--even if the difference is just
> 'dummy' text. I still believe this is the case.
>
> While you can set special caching parameters on the server end (such as
> described by Jeroen above), unless there is a change in the
> URI/PATH/Filename, there are other places where the file might be cached
> (thereby negating any 'NEVER CACHE THIS RESOURCE' settings).
>
> I attended a talk by Michael Radwin, Senior Engineering Manager for
> Yahoo, at ApacheCon US 2005 in San Diego[1], entitled 'HTTP Caching and
> Cache-busting for Content Publishers'. Among other things, Y! needs to
> ensure that multiple users at an Internet Cafe checking their mail will
> *never* receive the same content.
>
> On Jan 18, 2006, at 12:32 AM, vijay visu wrote:
>
>> i am doing a code which generates the PDF in a batch
>> process.
>>
>> These PDFs include dynamically built charts by
>> servlets.
>> I am making use of external-graphic tag to pick the
>> images.
>> These servlets throw jpeg image of the charts in the
>> output stream.
>>
>> These servlets should be called for each PDFs
>> generated since each chart will be unique.
>> My problem is that the servlets which builds the
>> dynamic charts are called
>> for the first time only. On the subsequent calls the
>> old charts are
>> only built in PDF and the servlets are not getting
>> called.
>>
>> Please help me out in this problem
>
>
> [1] (click on 'Cache-busting techniques' at the bottom of the navigation)
> http://public.yahoo.com/~radwin/talks/http-caching-apachecon2005.htm
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Dynamic charts issues in batch PDF generation
Posted by Clay Leeds <we...@mac.com>.
On Jan 20, 2006, at 6:28 AM, Jeroen van der Vegt wrote:
> I'm not sure I correctly understand the problem anymore, but this
> might be relevant:
>
> Can't you let the JPEG servlet indicate that its output should not
> be cached? I use this code to disable various cache mechanism:
>
> private void setNoCache(HttpServletResponse resp) {
> resp.setHeader("Pragma","No-Cache");
> resp.setHeader("Cache-Control","no-Cache");
> resp.setDateHeader("Expires", 0 );
> }
>
> Regards,
>
> Jeroen
I understood the OP (pasted at the bottom of this msg) to mean there
is a caching problem with the JPEG image of each chart.
My previous post supported Jeremias 'simple' fix whereby each chart
be given a different URI (PATH, name, etc.)--even if the difference
is just 'dummy' text. I still believe this is the case.
While you can set special caching parameters on the server end (such
as described by Jeroen above), unless there is a change in the URI/
PATH/Filename, there are other places where the file might be cached
(thereby negating any 'NEVER CACHE THIS RESOURCE' settings).
I attended a talk by Michael Radwin, Senior Engineering Manager for
Yahoo, at ApacheCon US 2005 in San Diego[1], entitled 'HTTP Caching
and Cache-busting for Content Publishers'. Among other things, Y!
needs to ensure that multiple users at an Internet Cafe checking
their mail will *never* receive the same content.
On Jan 18, 2006, at 12:32 AM, vijay visu wrote:
> i am doing a code which generates the PDF in a batch
> process.
>
> These PDFs include dynamically built charts by
> servlets.
> I am making use of external-graphic tag to pick the
> images.
> These servlets throw jpeg image of the charts in the
> output stream.
>
> These servlets should be called for each PDFs
> generated since each chart will be unique.
> My problem is that the servlets which builds the
> dynamic charts are called
> for the first time only. On the subsequent calls the
> old charts are
> only built in PDF and the servlets are not getting
> called.
>
> Please help me out in this problem
[1] (click on 'Cache-busting techniques' at the bottom of the
navigation)
http://public.yahoo.com/~radwin/talks/http-caching-apachecon2005.htm
Re: Dynamic charts issues in batch PDF generation
Posted by Jeroen van der Vegt <je...@technolution.nl>.
I'm not sure I correctly understand the problem anymore, but this might
be relevant:
Can't you let the JPEG servlet indicate that its output should not be
cached? I use this code to disable various cache mechanism:
private void setNoCache(HttpServletResponse resp) {
resp.setHeader("Pragma","No-Cache");
resp.setHeader("Cache-Control","no-Cache");
resp.setDateHeader("Expires", 0 );
}
Regards,
Jeroen
Op 19-1-2006 22:11, schreef Glen Mazza:
> Clay Leeds escribió:
>> On Jan 19, 2006, at 10:30 AM, Glen Mazza wrote:
>>
>>> Jeremias Maerki wrote:
>>>
>>>> Or you need to simply make sure that the URLs are unique. You can
>>>> use a
>>>> dummy parameter in the URL to fake uniqueness:
>>>> http://localhost/MyChartServlet?dummy=1234
>>>
>>>
>>> Hmmm...my guess is that for any servlet-related problem for which a
>>> "dummy parameter to fake uniqueness" would solve it, that the
>>> servlet itself can be rewritten to fix the problem instead. (In
>>> this case, have it coded to regenerate the image for every call,
>>> with no dummy parameter needed.) If I'm correct, I would refer the
>>> questioner to the Sun Servlet forum for more assistance.
>>>
>>> Glen
>>
>>
>> In my experience (mainly coming from a background where the user-
>> agent tends to be a web browser), if you call the same thing twice,
>> there are a number of places where the object being served can be
>> 'cached':
>> - server
>> - proxy
>> - client
>>
>
> Oh. My interpretation of the problem was that a different PDF
> document *was* indeed being returned each time, but that the charts
> within the PDF document were incorrectly not being regenerated to
> account for the new data specific to each document. If my assumption
> was the case, that would tend to rule out caching at the client or the
> proxy, because AFAIK they would just have a PDF document to cache (not
> inner parts, such a graphics within the PDF).
>
> But if it is the case that the *same* PDF document is being sent each
> time to the browser, then yes, the caching may be at the client or
> proxy-level, and the URL modifying may be necessary.
>
> Glen
>
>> In some cases, the server itself also might have some sort of
>> 'caching' system as well, which is external to the server.
>>
>> If someone is calling a cacheable resource, I've found it safest to
>> somehow modify the name (even slightly) to ensure there's no caching
>> involved. IMO, this alleviates the potential of cacheability (making
>> words up can be fun!).
>>
>> Web Maestro Clay
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Dynamic charts issues in batch PDF generation
Posted by Glen Mazza <gm...@apache.org>.
Clay Leeds escribió:
> On Jan 19, 2006, at 10:30 AM, Glen Mazza wrote:
>
>> Jeremias Maerki wrote:
>>
>>> Or you need to simply make sure that the URLs are unique. You can use a
>>> dummy parameter in the URL to fake uniqueness:
>>> http://localhost/MyChartServlet?dummy=1234
>>
>>
>> Hmmm...my guess is that for any servlet-related problem for which a
>> "dummy parameter to fake uniqueness" would solve it, that the servlet
>> itself can be rewritten to fix the problem instead. (In this case,
>> have it coded to regenerate the image for every call, with no dummy
>> parameter needed.) If I'm correct, I would refer the questioner to
>> the Sun Servlet forum for more assistance.
>>
>> Glen
>
>
> In my experience (mainly coming from a background where the user- agent
> tends to be a web browser), if you call the same thing twice, there are
> a number of places where the object being served can be 'cached':
> - server
> - proxy
> - client
>
Oh. My interpretation of the problem was that a different PDF document
*was* indeed being returned each time, but that the charts within the
PDF document were incorrectly not being regenerated to account for the
new data specific to each document. If my assumption was the case, that
would tend to rule out caching at the client or the proxy, because AFAIK
they would just have a PDF document to cache (not inner parts, such a
graphics within the PDF).
But if it is the case that the *same* PDF document is being sent each
time to the browser, then yes, the caching may be at the client or
proxy-level, and the URL modifying may be necessary.
Glen
> In some cases, the server itself also might have some sort of 'caching'
> system as well, which is external to the server.
>
> If someone is calling a cacheable resource, I've found it safest to
> somehow modify the name (even slightly) to ensure there's no caching
> involved. IMO, this alleviates the potential of cacheability (making
> words up can be fun!).
>
> Web Maestro Clay
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Dynamic charts issues in batch PDF generation
Posted by Clay Leeds <we...@mac.com>.
On Jan 19, 2006, at 10:30 AM, Glen Mazza wrote:
> Jeremias Maerki wrote:
>> Or you need to simply make sure that the URLs are unique. You can
>> use a
>> dummy parameter in the URL to fake uniqueness:
>> http://localhost/MyChartServlet?dummy=1234
>
> Hmmm...my guess is that for any servlet-related problem for which a
> "dummy parameter to fake uniqueness" would solve it, that the
> servlet itself can be rewritten to fix the problem instead. (In
> this case, have it coded to regenerate the image for every call,
> with no dummy parameter needed.) If I'm correct, I would refer the
> questioner to the Sun Servlet forum for more assistance.
>
> Glen
In my experience (mainly coming from a background where the user-
agent tends to be a web browser), if you call the same thing twice,
there are a number of places where the object being served can be
'cached':
- server
- proxy
- client
In some cases, the server itself also might have some sort of
'caching' system as well, which is external to the server.
If someone is calling a cacheable resource, I've found it safest to
somehow modify the name (even slightly) to ensure there's no caching
involved. IMO, this alleviates the potential of cacheability (making
words up can be fun!).
Web Maestro Clay
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Dynamic charts issues in batch PDF generation
Posted by Glen Mazza <gm...@apache.org>.
Jeremias Maerki wrote:
> On 18.01.2006 09:44:57 Chris Bowditch wrote:
>
>>vijay visu wrote:
>>
>><snip/>
>>
>>>These servlets should be called for each PDFs
>>>generated since each chart will be unique.
>>>My problem is that the servlets which builds the
>>>dynamic charts are called
>>>for the first time only. On the subsequent calls the
>>>old charts are
>>>only built in PDF and the servlets are not getting
>>>called.
>>
<snip/>
>
> Or you need to simply make sure that the URLs are unique. You can use a
> dummy parameter in the URL to fake uniqueness:
>
> http://localhost/MyChartServlet?dummy=1234
>
Hmmm...my guess is that for any servlet-related problem for which a
"dummy parameter to fake uniqueness" would solve it, that the servlet
itself can be rewritten to fix the problem instead. (In this case, have
it coded to regenerate the image for every call, with no dummy parameter
needed.) If I'm correct, I would refer the questioner to the Sun
Servlet forum for more assistance.
Glen
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Dynamic charts issues in batch PDF generation
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 18.01.2006 09:44:57 Chris Bowditch wrote:
> vijay visu wrote:
>
> <snip/>
>
> > These servlets should be called for each PDFs
> > generated since each chart will be unique.
> > My problem is that the servlets which builds the
> > dynamic charts are called
> > for the first time only. On the subsequent calls the
> > old charts are
> > only built in PDF and the servlets are not getting
> > called.
>
> You don't say which version of FOP you are using. You need to clear the
> image cache between rendering runs. For 0.20.5 this is described in the
> following web page:
>
> http://xmlgraphics.apache.org/fop/0.20.5/graphics.html#caching
>
> <snip/>
Or you need to simply make sure that the URLs are unique. You can use a
dummy parameter in the URL to fake uniqueness:
http://localhost/MyChartServlet?dummy=1234
Note that since FOP 0.90 there is no possibility anymore to clear the
image cache. URLs must be unique. An alternative that could be
investigated is to implement an extension attribute on external-graphic
that causes FOP to bypass the image cache.
Jeremias Maerki
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Dynamic charts issues in batch PDF generation
Posted by Chris Bowditch <bo...@hotmail.com>.
vijay visu wrote:
<snip/>
> These servlets should be called for each PDFs
> generated since each chart will be unique.
> My problem is that the servlets which builds the
> dynamic charts are called
> for the first time only. On the subsequent calls the
> old charts are
> only built in PDF and the servlets are not getting
> called.
You don't say which version of FOP you are using. You need to clear the
image cache between rendering runs. For 0.20.5 this is described in the
following web page:
http://xmlgraphics.apache.org/fop/0.20.5/graphics.html#caching
<snip/>
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Dynamic charts issues in batch PDF generation
Posted by Prakash R <ra...@yahoo.com>.
Instead of running just the servlet, can you also pass
a unique number/string along with the servlet which
makes it a unique call.
eg. instead of using ChartServlet maybe you can use
ChartServlet?id=<unique_id>
where unique_id is different for each image.
The charts are probably being cached. This will force
it to generate the chart each time.
Hope this helps.
Prakash
--- vijay visu <vi...@yahoo.com> wrote:
> hi
>
> i am doing a code which generates the PDF in a batch
> process.
>
> These PDFs include dynamically built charts by
> servlets.
> I am making use of external-graphic tag to pick the
> images.
> These servlets throw jpeg image of the charts in the
> output stream.
>
> These servlets should be called for each PDFs
> generated since each chart will be unique.
> My problem is that the servlets which builds the
> dynamic charts are called
> for the first time only. On the subsequent calls the
> old charts are
> only built in PDF and the servlets are not getting
> called.
>
> Please help me out in this problem
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail:
> fop-users-help@xmlgraphics.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org