More or less.

Note that you can set the response headers with methods of the response
object. Far safer. The example Niall posted does this.

>
> So, you mean something like this?
>
> public class FileXferAction extends Action {
>    public ActionForward execute(
>         ActionMapping actionMapping, ActionForm actionForm,
>         ServletRequest servletRequest, ServletResponse
> servletResponse )
>         throws Exception {
>       System.out.println( "Here we are!" );
>       OutputStream os = servletResponse.getOutputStream();
>       os.write( "Content-Type: application/pdf\n".getBytes() );
>       FileInputStream fis = new FileInputStream( "/tmp/test.pdf" );
>       int len;
>       byte[] bytes = new byte[1024];
>       while ((len = fis.read( bytes )) > 0) {
>          os.write( bytes, 0, len );
>       }
>       fis.close();
>       return null;
>    }
> }
>
> Unfortunately that just gives me a blank screen.
> Importantly, "Here we
> are!" does NOT show up in the log, so . . . apparently the
> action isn't
> even getting invoked.  Probably something to do with
> struts-config.xml:
>
>       <action path="/xferFile"
>          type="action.FileXferAction"
>          validate="false"/>
>
> I just guessed at this.  Since it doesn't forward, doesn't use a JSP
> page, etc, I'm leaving those attributes empty.  If they shouldn't be
> empty, what should they be?
>
> Mike
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to