You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Sheridan, Gaëtan" <gs...@vds.ca> on 2001/11/21 22:49:48 UTC
RE: Mixing Velocity output with binary output: Problem closed.
Hi Geir,
I glad to report that the problem had nothing to do with Velocity.
I was able to reproduce it with an ordinary servlet, outputting HTML "by
hand".
The problem is when Windows Media Player (version 7.01.00.3055) gets the
file
it generates a bunch of additional HTTP GET requests to the server (don't
ask),
which brought my servlet to a wrong state. Other players don't exhibit that
kind
if weird behavior...
Sorry for the trouble and thanks again for your help.
Gaëtan Sheridan
-----Original Message-----
From: Geir Magnusson Jr. [mailto:geirmagnussonjr@yahoo.com]
Sent: November 15, 2001 03:56
To: velocity-user@jakarta.apache.org
Subject: Re: Mixing Velocity output with binary output
On 11/14/01 5:51 PM, "Sheridan, Gaëtan" <gs...@vds.ca> wrote:
> Hi,
>
> I am trying to build a servlet that first displays a login screen (using a
> template), and then handles a request for a binary file (specifically a
.wav
> file). Something like:
>
> if (already logged in)
> return the contents of a wav file
> else
> output a login template
>
> The problem is the wav file player report the data to be corrupted.
> If I bypass the login template (that is, no call to createTemplate and
> mergeTemplate because I return the wav file at the first get) then
> everything is fine (and I hear the wav file).
>
>
> I was wondering if maybe Velocity does something to the
ServletOutputStream
> obtained from the HttpServletResponse that somehow remains even during
> subsequent requests (character set, etc).
Well, there are a few issues, one of which is output encoding. Otherwise,
you can see exactly what velocity is doing - take a look at the
VelocityServlet base class.
Note that you don't actually have to use that if you don¹t' want to.
Another thing is that it appears to me that the decision of wav vs login is
a decision that could (should?) be made in the Servlet itself, not in the
template...
The other thing to be careful of is that Velocity is precise on output, so
you have to be careful there aren't spaces or other drek before or after the
.wav data...
> I am using:
> - Velocity 1.2-rc3
> - a slithly modified VelocityServlet (because I use the "separate
> instances" model, as opposed to the Singleton model)
>
> Thanks,
>
> Gaetan Sheridan
>
> BTW Velocity is *really nice*. Keep the good work. In my opinion it is
much
> more "java" than JSPs. Too bad...
Not 'too bad' -> 'Very good'
:)
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - Benjamin Franklin
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>