• 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

Content-Encoding

 
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am unclear about the header "Content-Encoding" and what its corresponding value does. When we setHeader to be "Content-Encoding", "x-gzip", does it send out the requested file in the zip format?
What is the differences between "x-gzip" and "gzip"?
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Cameron Park:
Hi, I am unclear about the header "Content-Encoding" and what its corresponding value does. When we setHeader to be "Content-Encoding", "x-gzip", does it send out the requested file in the zip format?


No. These MIME types are merely a label telling the browser what type of content you're sending. It is up to you to ensure that what you are sending actually matches the encoding you set.
If you'd like to see this in action then just do this little experiment. Write a one-line JSP

and check it out with a browser. Now try setting set the content type:

and check it out again. The second time round, you're telling the browser that you are going to send plain text. As a consequence, it makes no attempt interpreting the HTML tags and will show your HTML source.

What is the differences between "x-gzip" and "gzip"?


The difference is that all "x-" types are unregistered and experimental. I guess that support for "x-gzip" was retained even after proper registration of the "gzip" type and don't think there is any difference in practice. MIME types are governed by the Internet Engineering Task Force (IETF) RFCs. For a thorough overview, look at RFC 2045-2049.
- Peter
 
reply
    Bookmark Topic Watch Topic
  • New Topic