• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with a filter to alter a gif in the response

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to intercept a gif on its way from a servlet to the browser, so I've got a Filter working, which is called, and which successfully draws on the image and sends it to the response output stream, except that the end of the gif is corrupt. The filter can write the gif out to the filesystem without corrupting it so I know the problem is with my misunderstanding of Filters.

I can see the same thing happening in the example below. It succesfully adds "<HR>PRE<HR>" to the finished page, but for then fails to send the last 11 characters of the file being filtered. It's as if the response stays the same length even though the filter adds stuff to it.

Any ideas? It must be something pretty stupid!

Thanks in advance.

 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



Are you trying mix HTML with the binary data from the image?
 
G Roberts
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Sorry, my posting was not as clear as it should have been. I have this problem with an image modifying servlet, but I also have the same symptom with the much simpler PrePostFilter example.

So, this question only concerns outputting html. I also forgot to say that the html appended after the original output never appears.

Any more ideas welcome because this one is driving me nuts.

G.
 
If you were a tree, what sort of tree would you be? This tiny ad is a poop beast.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic