summaryrefslogtreecommitdiff
path: root/trunk/ACE/apps/JAWS3/http/HTTP_Service_Handler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/ACE/apps/JAWS3/http/HTTP_Service_Handler.cpp')
-rw-r--r--trunk/ACE/apps/JAWS3/http/HTTP_Service_Handler.cpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/trunk/ACE/apps/JAWS3/http/HTTP_Service_Handler.cpp b/trunk/ACE/apps/JAWS3/http/HTTP_Service_Handler.cpp
new file mode 100644
index 00000000000..56e2d2c7e92
--- /dev/null
+++ b/trunk/ACE/apps/JAWS3/http/HTTP_Service_Handler.cpp
@@ -0,0 +1,67 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+
+#include "ace/OS.h"
+#include "ace/Get_Opt.h"
+
+#include "jaws3/Concurrency.h"
+
+#include "HTTP_Service_Handler.h"
+#include "HTTP_States.h"
+#include "HTTP_Data.h"
+
+JAWS_HTTP_Service_Handler::JAWS_HTTP_Service_Handler (void)
+ : JAWS_Protocol_Handler (JAWS_HTTP_Read_Request::instance (), & this->data_)
+ , data_ (this)
+{
+}
+
+int
+JAWS_HTTP_Service_Handler::open (void *)
+{
+ int result = JAWS_Concurrency::instance ()->putq (this);
+ if (result < 0)
+ return -1;
+
+ return 0;
+}
+
+int
+JAWS_HTTP_Service_Handler::close (unsigned long)
+{
+ delete this;
+ return 0;
+}
+
+int
+JAWS_HTTP_Acceptor::init (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt opt (argc, argv, "p:");
+
+ unsigned short p = 0;
+
+ int c;
+ while ((c = opt ()) != -1)
+ switch (c)
+ {
+ case 'p':
+ p = (unsigned short) ACE_OS::atoi (opt.optarg);
+ break;
+ default:
+ break;
+ }
+
+ if (p == 0)
+ p = 8000;
+
+ if (this->open (ACE_INET_Addr (p)) == -1)
+ {
+ ACE_DEBUG ((LM_DEBUG, "%p\n", "ACE_Acceptor::open"));
+ return -1;
+ }
+
+ return 0;
+}
+
+ACE_SVC_FACTORY_DEFINE (JAWS_HTTP_Acceptor)