source: xmlrpcnet/trunk/fuentes/src/XmlRpcListenerService.cs @ 379

Last change on this file since 379 was 379, checked in by hectorgh, 5 years ago

adding project files

File size: 2.1 KB
Line 
1
2/*
3XML-RPC.NET library
4Copyright (c) 2001-2007, Charles Cook <charlescook@cookcomputing.com>
5
6Permission is hereby granted, free of charge, to any person
7obtaining a copy of this software and associated documentation
8files (the "Software"), to deal in the Software without restriction,
9including without limitation the rights to use, copy, modify, merge,
10publish, distribute, sublicense, and/or sell copies of the Software,
11and to permit persons to whom the Software is furnished to do so,
12subject to the following conditions:
13
14The above copyright notice and this permission notice shall be
15included in all copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24DEALINGS IN THE SOFTWARE.
25*/
26
27#if !FX1_0
28
29namespace CookComputing.XmlRpc
30{
31  using System;
32  using System.Net;
33
34  public abstract class XmlRpcListenerService : XmlRpcHttpServerProtocol
35  {
36    bool _sendChunked = false;
37
38    public virtual void ProcessRequest(HttpListenerContext RequestContext)
39    {
40      try
41      {
42        IHttpRequest req = new XmlRpcListenerRequest(RequestContext.Request);
43        IHttpResponse resp = new XmlRpcListenerResponse(RequestContext.Response);
44        resp.SendChunked = _sendChunked;
45        HandleHttpRequest(req, resp);
46      }
47      catch (Exception ex)
48      {
49        // "Internal server error"
50        RequestContext.Response.StatusCode = 500;
51        RequestContext.Response.StatusDescription = ex.Message;
52      }
53      finally
54      {
55        RequestContext.Response.OutputStream.Close();
56      }
57    }
58
59    public bool SendChunked
60    {
61      get { return _sendChunked; }
62      set { _sendChunked = value; }
63    }
64  }
65}
66
67#endif
Note: See TracBrowser for help on using the repository browser.