Presentation is loading. Please wait.

Presentation is loading. Please wait.

DSA Week 22 MIME types and Meta data. Agenda Google Maps and MyMap Coursework Placement opportunity Tutorial – Multiple Choice questions Lecture – MIME.

Similar presentations


Presentation on theme: "DSA Week 22 MIME types and Meta data. Agenda Google Maps and MyMap Coursework Placement opportunity Tutorial – Multiple Choice questions Lecture – MIME."— Presentation transcript:

1 DSA Week 22 MIME types and Meta data

2 Agenda Google Maps and MyMap Coursework Placement opportunity Tutorial – Multiple Choice questions Lecture – MIME types and Meta data

3 The problem How does a browser know what to do with a data stream returned from a server by an HTTP request? How does an operating system know what to do when a user clicks on a filename in a directory list? Blog entry

4 Extensions, MIME type, Application fileMIME-type processing application File manage r Web server browse r HTTP response

5 Terminology Extension –File name suffix House.jpeg –Can be multiple mycontract.de.xml –A document expressed in xml in German MIME type –Multipurpose Internet Mail Extension –media-type –Content-type Application/ Processing –How a file is opened (or printed..)

6 Answer(s) additional information - ‘metadata’ –Embedded File extension ‘Magic’ in the contents e.g. ‘GIF89a’ as the first five characters –File system (e.g. NTFS for Windows) Date and Time of creation and modification Access control –Wrapper Content-type in HTTP package –Separate data stream (fork or ADS) NTFS uses Alternate Data Streams for supplementary data such as image thumbnails –Deduced File size

7 Meta data For a photo (EXIF) –Camera –Aperture and speed –Location –Date and time For a file (File system) –The date a file was created –The character encoding used –The file format For a document (Dublin Core) –Creator –Subject category

8 Knockon Problems Inconsistancies and lies –a file extension says.html but its really a Microsoft Word Document, or plain text or xml –the subject category says the document is about London when it’s about Bristol? –A document created by X is copied and the the creator changed to Y –A program copies the file but doesn’t know about the associated metadata

9 Meta data mistrust Google ignore metadata for the purposes of searching IE ‘sniffs’ the file contents to determine the content type

10 Extensions, MIME type, Application fileMIME-type processing application File manage r Web server browse r HTTP response

11 File Manager Change the settings to show the file extension Windows Explorer –Tools\Folder Options\File types Edit mapping between extension, action and application (file associations) Metadata held in registry file application Action (open, print)

12 Web server fileMIME-type Web server

13 How Apache determines mime type File.xhtml http request for file.xhtml Apache Determine type Create HTTP response http response Content-type: application/xhtml+xml Fetch file mime.type File may contain media type data.htaccess

14 Apache Metadata Language Encoding Handler (to interpret the file server-side) Type (in mime-type)

15 Apache mime types Global - mime.types Local -.htaccess –AddType audio/x-midi mid # MIME type Extensions application/xhtml+xml xhtml xht application/xslt+xml xslt application/xml xml xsl image/png png image/svg+xml svg audio/mpeg mpga mp2 mp3 image/jpeg jpeg jpg jpe text/html html htm text/plain asc txt

16 Browser fileMIME-type Processing mode HTTP Respons e Render as X Validate against Schema Launch Application Launch Plugin

17 Browser behaviour IE has complex sniffing algorithm which can override the specified MIME type Firefox –Tools/Page Info shows the mime type and other data –Sniffs content of images to determine the file format (which is why your photo album code worked with GIF images)

18 XHTML Content-type –application/xhtml+xml Compliant –Firefox, Opera and Safari Non-complaint - IE (6 or 7) –either fails to open the file, or asks what you want to do with it. Cross browser support –Need to detect which browser has made the request (sniff the user-agent) and set content-type to text/html if User-agent contains ‘MSIE’.


Download ppt "DSA Week 22 MIME types and Meta data. Agenda Google Maps and MyMap Coursework Placement opportunity Tutorial – Multiple Choice questions Lecture – MIME."

Similar presentations


Ads by Google