Well I have almost gotten this to work correctly. One issue I am
running into is that the link that is being created seems to be
filtered. Here is the following link that is created from my service:
app?service=DocDownloaderService&sp=SExhibitor.doc&sp=l2
if i get rid of the 'amp;' in the url the file is downloaded. Any
ideas on how to not have this filtered?
On 8/1/05, Konstantin Ignatyev <[EMAIL PROTECTED]> wrote:
> ServiceLink component
>
> or write one like this
> public abstract class JasperToPDFLinkComponent
> extends AbstractComponent{
>
> public abstract String getPageName();
> public abstract String getJasperPrint();
>
>
> protected void renderComponent(IMarkupWriter w,
> IRequestCycle cycle) {
> if( cycle.isRewinding() ) return;
> IEngineService srv = cycle.getEngine().getService(
> JasperToPDFService.SERVICE_NAME );
> String pageName = ( getPageName() == null)?
> cycle.getPage().getPageName(): getPageName();
> ILink lnk = srv.getLink( cycle, this, new
> Object[]{ pageName, getJasperPrint() });
> w.begin("a");
> w.attribute("href", lnk.getURL() );
> renderInformalParameters( w, cycle);
> renderBody( w, cycle );
> //w.closeTag();
> w.end();
>
> }
> }
>
>
> --- Chris Chiappone <[EMAIL PROTECTED]> wrote:
>
> > Also, how would i reference this service in my html
> > or page file?
> >
> > On 8/1/05, Konstantin Ignatyev
> > <[EMAIL PROTECTED]> wrote:
> > > Simply create a PDF service that will do that,
> > > something like this:
> > > in application.xml
> > >
> > > <service name="JasperToPDFService"
> > > class="xxx.JasperToPDFService" />
> > >
> > >
> > > public class JasperToPDFService extends
> > > AbstractService{
> > >
> > > public static final String SERVICE_NAME =
> > > "JasperToPDFService";
> > >
> > > public String getName(){
> > > return SERVICE_NAME;
> > > }
> > >
> > > /**
> > > * parameters[page,ognlExpressionToGetSource]
> > > * @param iEngineServiceView
> > > * @param cycle
> > > * @param responseOutputStream
> > > * @throws javax.servlet.ServletException
> > > * @throws java.io.IOException
> > > */
> > > public void service( IEngineServiceView
> > > iEngineServiceView, IRequestCycle cycle,
> > > ResponseOutputStream responseOutputStream ) throws
> > > ServletException, IOException{
> > > Object[] params = getParameters( cycle ) ;
> > > String pageName = (String) params[0];
> > > String srcExpression = (String) params[1];
> > > responseOutputStream.setContentType(
> > > "application/pdf" );
> > > HttpServletResponse response =
> > > cycle.getRequestContext().getResponse();
> > > response.setHeader("Expires", "0");
> > > response.setHeader("Cache-Control",
> > > "must-revalidate, post-check=0, pre-check=0");
> > > response.setHeader("Pragma", "public");
> > > response.setHeader("Content-Disposition",
> > > "attachment; filename=\"" + pageName +".pdf\"");
> > > try{
> > > JasperPrint p = (JasperPrint) Ognl.getValue(
> > > Ognl.parseExpression( srcExpression ),
> > cycle.getPage(
> > > pageName ) );
> > >
> > >
> >
> ConsoleServicesFactory.getJasperReportExecutor().exportReportToPDF(
> > > p, response.getOutputStream());
> > > } catch( Exception e ){
> > > throw new ServletException( e );
> > > }
> > > }
> > >
> > > public ILink getLink( IRequestCycle
> > iRequestCycle,
> > > IComponent iComponent, Object[] params ){
> > > return this.constructLink(
> > > iRequestCycle,getName(),null, params,false );
> > > }
> > >
> > > }
> > >
> > > --- Chris Chiappone <[EMAIL PROTECTED]> wrote:
> > >
> > > > To be more clear I am trying to figure out if I
> > > > create an asset that
> > > > is used to bring up the pdf of document. Is
> > that
> > > > the way I should do
> > > > this?
> > > >
> > > > On 8/1/05, Chris Chiappone <[EMAIL PROTECTED]>
> > > > wrote:
> > > > > Hi I was wonder what is the best approach when
> > > > creating a link to a
> > > > > blob in my db. The blob would be a pdf or
> > other
> > > > type of document.
> > > > >
> > > > > --
> > > > > ~chris
> > > > >
> > > >
> > > >
> > > > --
> > > > ~chris
> > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
> > > > [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > > Konstantin Ignatyev
> > >
> > >
> > >
> > >
> > > PS: If this is a typical day on planet earth,
> > humans will add fifteen million tons of carbon to
> > the atmosphere, destroy 115 square miles of tropical
> > rainforest, create seventy-two miles of desert,
> > eliminate between forty to one hundred species,
> > erode seventy-one million tons of topsoil, add 2,700
> > tons of CFCs to the stratosphere, and increase their
> > population by 263,000
> > >
> > > Bowers, C.A. The Culture of Denial: Why the
> > Environmental Movement Needs a Strategy for
> > Reforming Universities and Public Schools. New
> > York: State University of New York Press, 1997: (4)
> > (5) (p.206)
> > >
> >
> >
> > --
> > ~chris
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> >
> >
>
>
> Konstantin Ignatyev
>
>
>
>
> PS: If this is a typical day on planet earth, humans will add fifteen million
> tons of carbon to the atmosphere, destroy 115 square miles of tropical
> rainforest, create seventy-two miles of desert, eliminate between forty to
> one hundred species, erode seventy-one million tons of topsoil, add 2,700
> tons of CFCs to the stratosphere, and increase their population by 263,000
>
> Bowers, C.A. The Culture of Denial: Why the Environmental Movement Needs a
> Strategy for Reforming Universities and Public Schools. New York: State
> University of New York Press, 1997: (4) (5) (p.206)
>
--
~chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]