sysstatwebservice-handout

sysstatwebservice-handout - CS3214 Fall 2011 Project 6 The...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS3214 Fall 2011 Project 6 - “The sysstatd Web Service” Due Date: Thursday, Dec 8, 11:59pm (Late days may be used.) This project can be done in groups of 2 students. 1 Introduction This assignment introduces you to the principles of internetwork communication using the HTTP and TCP protocols, which form two of the most widely used protocols in to- day’s Internet. In addition, the assignment will give you some insights into how to con- struct web services that are based on the popular REST [3, 4] architectural style, and show an example of how to implement a multi-threaded server. 2 Functionality In this part of the assignment, you will implement a basic HTTP web server that provides access to web services and files. The web server should implement persistent connections as per the HTTP/1.1 [2] protocol. 2.1 System Status Web Service The system status web service is a basic HTTP web service that publishes a Linux system’s status as reported by the kernel via the / proc file system. The web service must provide this information in JSON [1] format. The web service shall respond to requests for at least the following resources: Service URL Example JSON Output Based On /loadavg { "total threads": "174", "loadavg": ["0.00", "0.00", "0.03"], "running threads": "1" } /proc/loadavg /meminfo { "SwapTotal": "5799928", "SwapFree": "5793240", "MemFree": "2434304", ... } /proc/meminfo In addition, you must support query arguments as per RFC 2616, Section 3.2.2. You must support a ’callback’ argument. If given, you must return proper syntax for a JavaScript function call in which the value of the field appears as function name and the JSON object appears as argument. You should check that the argument provided to the ’callback’ field consists of only alphanumeric characters, underscore ( ), and periods (.). You must ignore all additional argument=value pairs. For example, a request to /loadavg?callback=jsonp1258749550540& =1258749554624 Created by G. Back ([email protected]) 1 Revision : 1 . 9 November 20, 2011
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CS3214 Fall 2011 Project 6 - “The sysstatd Web Service” would return jsonp1258749550540( { "total threads": "174", "loadavg": ["0.00", "0.00", "0.03"], "running threads": "1" } ) . (The second field is ignored.) Note that the order of the attributes within the returned JSON object (e.g., SwapTotal, SwapFree, etc.) is arbitrary. You can see a demo at http://cs3214.cs.vt.edu:9011/loadavg and http://cs3214.cs.vt.edu:9011/meminfo. You should return appropriate error codes for requests to URLs you do not support. 2.2 Serving Files Your web server should, like a traditional web server, support serving files from a direc- tory (the ’root’) in the server’s file system. These files should appear under the /files URL. For instance, if the URL /files/widget/plugins/jqplot.barRenderer.js is visited, and the root directory is set to the parent directory (widget), the content of the file widget/plugins/jqplot.barRenderer.js should be served. You should re- turn appropriate content type headers, based on the served file’s suffix. Support at least .html, .js, and .css files; see /etc/mime.types for a complete list.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern