2012/8/25 Mark Eggers <its_toas...@yahoo.com>:
> On 8/25/2012 5:01 AM, Konstantin Kolinko wrote:
>>
>> That PDF-generating library - where it sits? Is it on Server?
>>
>
> It sits in the application. It's actually two jar files - one that does the
> PDF translation proper and the other is a tag library.
>
>
>> How does the library get its source data (an XSL-FO document?) that is
>> converted to PDF? Which of the following:
>>
>
> This I don't know, but I suspect not. The library is obfuscated, but there
> doesn't appear to be the standard XSL-FO translation.
>
>
>> a) It uses HTTP to request a JSP page. Then it uses HTTP to request the
>> image.
>>
>
> This is the way I think it operates when you use a tag library. Why the
> library requires a relative URL or a fully qualified URL but does not work
> with an absolute URL I do not know.
>

A tag can easily get its content as a String or as a Reader.

E.g. see attributes in <jsp:doBody/> and <jsp:invoke/> standard
actions,  JspFragment.invoke(Writer),  BodyContent.getReader(),
BodyContent.getString().

A tag also has access to the request object and to the servlet
context, so it can use those to create an URL, or it uses
ServletContext.getResource[AsStream]() to get the file.

A debugger + a breakpoint in URL.openConnection() or in
ServletContext.getResource(), or in some java.io classes can tell how
the data are loaded. (Or just ask the library authors).

>> (...)
>
>
> Hmm, I think I tried UrlRewriteFilter before, but maybe not in quite the
> right way. You are thinking along the lines of rewriting
>
> http://some-host:80/context/servlet?name=imagename
>
> to
>
> ../servlet-location/servlet?name=imagename
>
> and letting the servlet dig it out of java.io.tmpdir?
>

I was thinking about naming the images in some specific way and using
that to forward requests to the servlet, regardless of actual path.

On second thought, it might be even easier to just use suffix matching
in web.xml.
E.g. if the images are named *.dynamic.png and the servlet (or filter)
is mapped like

    <servlet-mapping>
        <url-pattern>*.dynamic.png</url-pattern>

and then the servlet can ignore all the path except the file name.


BTW, if it were Tomcat 7 (and not 6.0.20) you would also have an
option of using <Context aliases="..." /> to map the temporary folder
into some subdirectory of your web application.


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to