PDF Generating Tool Support Forum

HOME   Login   Register    Search




  Subject: Url resolving for CSS and images
   PostPosted: 11 Oct 2016, 15:23 
Good afternoon,

We are using your product PD4ML for some time.
For resolving the urls for css-files and images we use the URL parameter in the PDML.render function.
But recently we had the problem with one off our customers, that resolving this URL wasn't working. The server could not connect to his own URL.
For now we changed the host-file, so it redirect it's own url to localhost.

But I would like to fix to problem by letting PD4ML get the file directly through our Tomcat instance.
I found the options:
- http://pd4ml.com/api/org/zefer/pd4ml/PD4ML.html#useServletContext(ServletContext)
- http://pd4ml.com/api/org/zefer/pd4ml/PD4ML.html#useHttpRequest(HttpServletRequest,%20HttpServletResponse)
But the documentation off those functions are minimal.
What do those functions do, do they use the context or the request to calculate the URL, or do they use some functionality off it's container, in this case Tomcat .


  Subject: Re: Url resolving for CSS and images
   PostPosted: 18 Oct 2016, 17:02 
> What do those functions do, do they use the context or the request to calculate
> the URL, or do they use some functionality off it's container, in this case Tomcat .

When httpRequest/httpResponse are set, PD4ML uses a request dispatcher to load local (probably, dynamic) resources, like "/WEBAPP/images/logo.png" or "/page.jsp"

It is done like that:

RequestDispatcher dispatcher = httpRequest.getRequestDispatcher(url);
BufferedHttpResponseWrapper wrapper = new BufferedHttpResponseWrapper(httpResponse, debugOn);
dispatcher.include(httpRequest, wrapper);
...				
byte[] ret = wrapper.getOutputAsArray();


  Subject: Re: Url resolving for CSS and images
   PostPosted: 19 Oct 2016, 14:26 
Thank you for the response.
This makes it perfectly clear how it works. It will probably fix my problem I have with server how can't connect to themselves.



[Reply]     [ 3 posts ] 

cron
Copyright ©2004-10 zefer|org. All rights reserved. Bookmark and Share