Advertisement
leticiaf

searchResource

Aug 31st, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. import IResource = require("../iResource");
  2. import IService = require("../../service/iService");
  3. import $inject = require("../../core/inject");
  4. /**
  5. * ItineraryResource class
  6. *
  7. * Defines a Resource and it's characteristics
  8. * @class ItineraryResource
  9. */
  10. class SearchResource implements IResource{
  11.  
  12. public constructor(private context: IService = $inject("service/searchService")) {}
  13.  
  14. /**
  15. * GET method handler
  16. *
  17. * @param request
  18. * @param response
  19. * @param next
  20. */
  21. public get(request: any, response: any, next: any): void {
  22. var searchData: any = request.params.data;
  23. var userAgent: string = request.headers['user-agent'];
  24. if(userAgent===undefined) userAgent = "desconhecido";
  25. console.log("teste");
  26. //response.jsonp(this.context.processData(searchData));
  27. //response.jsonp(this.context.retrieve(userAgent, searchData));
  28. }
  29.  
  30. /**
  31. * POST method handler
  32. *
  33. * @param request
  34. * @param response
  35. * @param next
  36. */
  37. public post(request: any, response: any, next: any): void {
  38. response.json({type: "error", message: "Operation not implemented"});
  39. }
  40.  
  41. /**
  42. * PUT method handler
  43. *
  44. * @param request
  45. * @param response
  46. * @param next
  47. */
  48. public put(request: any, response: any, next: any): void {
  49. response.json({type: "error", message: "Operation not implemented"});
  50. }
  51.  
  52. /**
  53. * DELETE method handler
  54. *
  55. * @param request
  56. * @param response
  57. * @param next
  58. */
  59. public delete(request: any, response: any, next: any): void {
  60. response.json({type: "error", message: "Operation not implemented"});
  61. }
  62. }
  63. export = SearchResource;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement