OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 class GetSpreadsheet { |
| 6 |
| 7 static void getSample(HTTPRequest req, HTTPResponse res) { |
| 8 switch (req.method) { |
| 9 case 'GET': |
| 10 String name = req.queryParameters['name']; |
| 11 res.writeString(new SYLKProducer().makeExample(name)); |
| 12 res.writeDone(); |
| 13 break; |
| 14 case 'POST': // Fall through intended |
| 15 default: |
| 16 res.statusCode = HTTPStatus.METHOD_NOT_ALLOWED; |
| 17 res.writeDone(); |
| 18 break; |
| 19 } |
| 20 } |
| 21 |
| 22 static void listSamples(HTTPRequest req, HTTPResponse res) { |
| 23 switch (req.method) { |
| 24 case 'GET': |
| 25 res.writeString(new SYLKProducer().listSamples()); |
| 26 res.writeDone(); |
| 27 break; |
| 28 case 'POST': // Fall through intended |
| 29 default: |
| 30 res.statusCode = HTTPStatus.METHOD_NOT_ALLOWED; |
| 31 res.writeDone(); |
| 32 break; |
| 33 } |
| 34 } |
| 35 } |
| 36 |
| 37 |
| 38 |
OLD | NEW |