I think I'm going to make a tiny servlet to hand up the pdf, and define it
in my web.xml, and put in the acegi bypass, and take out the controller for
the pdf.

On 10/21/07, Matt Raible <[EMAIL PROTECTED]> wrote:
>
> Unfortunately, I don't know the solution to your problem as I've never
> dealt with something like this. I'm sure it's something small though -
> likely something that'll take you days to find and seconds to fix. ;-)
>
> Matt
>
> On 10/21/07, John Kwon <[EMAIL PROTECTED]> wrote:
> > The controller for the outside page (the page that contains the IFrame)
> has
> > a backing bean that has an attribute that contains a URL that is built
> > before the outside page opens (it's in the outside page controller).  I
> use
> > getRemoteHost() to build the URL, so it should be fine no matter what
> > machine I'm on.  I then append the param and filename, which is picked
> up by
> > the pdf controller.
> >
> > The url is linked to the src in the IFrame.  The controller acts, and
> pushes
> > the PDF onto the response stream.
> >
> > I can watch it in the debugger on my machine.  But for some reason, on a
> > remote machine, it takes me right to the logon screen.
> >
> > That, and it pops the PDF window out - instead of displaying in the
> IFrame.
> >
> >
> > On 10/21/07, Matt Raible <[EMAIL PROTECTED]> wrote:
> > >
> > > I would use something like Firebug or another tool that allows you to
> > > see the URLs requested. Since Acegi is URL-based, I don't know why it
> > > would work locally, but not when accessing the application from a
> > > different machine. What happens if you use the fully-qualified domain
> > > name of your machine instead of localhost?
> > >
> > > Matt
> > >
> > > On 10/21/07, John Kwon < [EMAIL PROTECTED]> wrote:
> > > > I have a PDF that is put up by a controller I wrote (it puts the pdf
> > right
> > > > on the response stream, and I set the content-type as pdf).
> > > >
> > > > I also specify that this is an attachment, so I am presuming that it
> > won't
> > > > open the PDF in a new window - the controller is called by a url
> that is
> > in
> > > > an IFRAME.
> > > >
> > > > Works just fine, with the anonymous bypass, as long as I open the
> > browser
> > > > window from the same machine that Tomcat is running on.
> > > >
> > > > If I use the app remotely, it doesn't work at all.  I get the login
> page
> > > > inside the IFRAME.
> > > >
> > > > Also, instead of opening in the IFRAME, it opens in a new window,
> which
> > > > isn't what I'm trying to do.
> > > >
> > > > Any ideas?
> > > >
> > > >
> > > >
> > > > String originalFileName = request.getParameter("fileName");
> > > >
> > > > logger.debug("File name " + originalFileName);
> > > >
> > > > response.setContentType( "application/pdf" );
> > > >
> > > > response.setHeader("Content-disposition",
> > > >
> > > > "attachment; filename=" + originalFileName);
> > > >
> > > > String path =
> > > >
> > request.getSession().getServletContext().getRealPath("/");
> > > >
> > > > logger.debug("Real path is: "+ path);
> > > >
> > > > String fullPathName=path+"documents\\";
> > > >
> > > > String fileName = fullPathName + originalFileName;
> > > >
> > > > FileInputStream in = new FileInputStream(fileName);
> > > >
> > > > int length = in.available();
> > > >
> > > > byte[] pdfbytes = new byte [length];
> > > >
> > > > in.read(pdfbytes);
> > > >
> > > > in.close();
> > > >
> > > >
> > > >
> > > > // Send response
> > > >
> > > > response.setContentLength(pdfbytes.length);
> > > >
> > > > ServletOutputStream outputStream = response.getOutputStream();
> > > >
> > > > outputStream.write(pdfbytes, 0, pdfbytes.length);
> > > >
> > > > outputStream.flush();
> > > >
> > > > outputStream.close();
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > http://raibledesigns.com
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
>
>
> --
> http://raibledesigns.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to