You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kent lai <ma...@virtuallyonline.net> on 2007/11/07 10:38:51 UTC

Possible to use wicket to serve non-HTML content?

Hi,
	for my current project I had to serve some PDF files. I am using  
Velocity to some of my HTML content as printable, and this is done as  
plain Velocity code, and then have a Wicket page serve that content  
(by simply having a plain page with <span wicket:id="content"> 
[content]</span> and setting the renderBodyOnly as true).
	I need to serve PDF next, which I would use the same way to generate  
my HTML, integrate with a HTML->PDF library (might be looking into  
iText), done on the fly.
	The flow is as this for the end user
	1. User reach a page of document (Wicket)
	2. User is presented two options, view as Printable, or download as PDF
	3. User clicked on view as Printable, and the above mentioned  
velocity generated HTML is embedded into the Wicket page, and then  
served to the user
	4. User clicked on download as PDF, and should reach a page where he  
can download a PDF version of the document, generated on the fly.

	I could do this with a servlet or filter, but I was wondering if  
there is a Wicket way to have a page serve non-html content, as most  
of my 'business service objects' are currently in Wicket, injected  
with Spring. And if I do so with a servlet/filter, does a  
WebApplication.get() allow me to gain access to the same spring  
context from the servlet? This is essential for me now because my  
current data storage are all in memory, which are singletons from the  
spring context (this allows me to do rapid prototyping, testing and  
development without worrying about the storage implementation at this  
stage)

	Thanks for any advices.

Kent


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