38 Web Science/Part1: Foundations of the web Web Science/Part1: Foundations of the web/MoocIndex Web Science/Part1: Foundations of the web/Hypertext Transfer Protocol/Content negotiation edit MOOC index Learning goals Video Script Quiz Further reading Discussion no learning goals defined You can define learning goals here. Mainly the following function was added to SimpleWebServer.java. There are some slighte adoptions to the Request class but this is mainly code completion displayed inside the video. private static String fetchAsciiFile(String path, String accept) { try { StringBuilder body = new StringBuilder(100000); BufferedReader br = new BufferedReader(new FileReader(new File(System.getProperty("user.dir") + "/webdirectory" + path))); String tmp = null; if (accept != null && accept.equals("text/xml")){ body.append("\n\n"); } while ((tmp = br.readLine())!= null){ if (accept == null) body.append(tmp + "\n"); else if (accept.equals("text/plain")){ body.append(tmp + "\n"); } else if (accept.equals("text/xml")){ String []values = tmp.split(" - "); body.append("\n\t"+values[0]+"\n\t"+values[2]+"\n\t"+values[3]+"\n\n"); } } if (accept != null && accept.equals("text/xml")){ body.append("\n"); } br.close(); return body.toString(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } understand that you can request certain forms of content this is useful to understand how http could be extended e.g. by licence information similar to: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 1 Which of the following HTTP requests should be used to request an XML file from a server 2 Which of the following HTTP requests would technically work (if implemented) to request an XML file from a server 3 What is the main aim of content negotiation? Content negotiation blog article on content negotiation Navigation Ethernet Communication over a shared Medium Ethernet header Minimum package length vs maximum cable length Collision detection Summary, further reading, homework Internet Protocol Motivation for IP Classful IPv4 networks IP forwarding algorithm IP header Summary, further reading, homework Transmission Control Protocol End to end principle and connection oriented communication Three way handshake Port numbers Sliding window and flow control Summary, further reading, homework Domain Name System Tree structure Terminology Zones Review some facts about DNS Delegating DNS queries DNS address resolution Summary, further reading, homework Internet vs World Wide Web Summary of the internet architecture Motivation and requirements for the World Wide Web Design principles of the web Uniform Resource Identifier Summary, further reading, homework Hypertext Transfer Protocol Making HTTP requests A simple web client A simple web server HTTP header Content negotiation Summary, further reading, homework Web content Problem setting for web content formats Working with XML HTML for web document structures Layout elements in HTML Motivating separation of content and layout Cascading Style Sheets Media content Metadata Summary, further reading, homework Dynamic Web Content Basics of server side web programming Forms and HTTP post request Handling a post request in a Java Servlet Client side JavaScript Ajax and the XMLHttpRequest class Summary, further reading, homework Play media HTTP header Play media Summary, further reading, homework
{'wiki_source': 'wikiversity', 'other_info': "{'content_model': 'wikitext', 'language': 'en', 'title': 'Web Science/Part1: Foundations of the web/Hypertext Transfer Protocol/Content negotiation', 'type': 'text'}"}