00001 // ////////////////////////////////////////////////////////////////////// 00002 // Import section 00003 // ////////////////////////////////////////////////////////////////////// 00004 // STL 00005 #include <cassert> 00006 #include <string> 00007 #include <fstream> 00008 #include <sstream> 00009 // Boost 00010 #include <boost/lexical_cast.hpp> 00011 // StdAir 00012 // AirInv 00013 #include <airinv/server/Reply.hpp> 00014 #include <airinv/server/Request.hpp> 00015 #include <airinv/server/RequestHandler.hpp> 00016 00017 namespace AIRINV { 00018 00019 // ////////////////////////////////////////////////////////////////////// 00020 RequestHandler::RequestHandler (const stdair::AirlineCode_T& iAirlineCode) 00021 : _airlineCode (iAirlineCode) { 00022 } 00023 00024 // ////////////////////////////////////////////////////////////////////// 00025 bool RequestHandler:: 00026 handleRequest (Request& ioRequest, Reply& ioReply) const { 00027 bool hasBeenSuccessfull = false; 00028 00029 // Decode request string to a flight-date details (airline code, 00030 // flight number and departure date) 00031 hasBeenSuccessfull = ioRequest.parseFlightDate(); 00032 00033 if (hasBeenSuccessfull == false) { 00034 ioReply._status = FlightRequestStatus::INTERNAL_ERROR; 00035 return hasBeenSuccessfull; 00036 } 00037 00045 // Fill out the reply to be sent to the client. 00046 ioReply._status = FlightRequestStatus::OK; 00047 ioReply.content = "Your are looking for: '" + ioRequest._flightDetails + "'. Ok, I have found your flight-date. Be patient until I give you more information about it"; 00048 00049 return hasBeenSuccessfull; 00050 } 00051 00052 }