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]
>
>

Reply via email to