]> err.no Git - sope/blob - sope-appserver/NGXmlRpc/XmlRpcMethodResponse+WO.m
define some default defaults for the simple http parser (when the Defaults.plist...
[sope] / sope-appserver / NGXmlRpc / XmlRpcMethodResponse+WO.m
1 /*
2   Copyright (C) 2000-2003 SKYRIX Software AG
3
4   This file is part of OGo
5
6   OGo is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #include <NGXmlRpc/XmlRpcMethodResponse+WO.h>
24 #include <NGObjWeb/WOResponse.h>
25 #include "common.h"
26
27 @implementation XmlRpcMethodResponse(WO)
28
29 // TODO: not required anymore by NGXmlRpcClient, can be removed ?
30
31 - (id)initWithResponse:(WOResponse *)_response {
32   /* 
33      should be based on NSData, so that the XML parser can decide the string
34      encoding (based on the <?xml > declaration) !
35   */
36   NSString *xmlRpcString;
37   
38   xmlRpcString = [[NSString alloc] initWithData:[_response content]
39                                    encoding:[_response contentEncoding]];
40   
41   self = [self initWithXmlRpcString:xmlRpcString];
42   [xmlRpcString release];
43   return self;
44 }
45
46 - (WOResponse *)generateResponse {
47   WOResponse *response;
48   
49   response = [[[WOResponse alloc] init] autorelease];
50   [response setStatus:200];
51   [response setHTTPVersion:@"HTTP/1.0"];
52   [response setContentEncoding:NSUTF8StringEncoding];
53   [response setHeader:@"text/xml" forKey:@"content-type"];
54   [response appendContentString:[self xmlRpcString]];
55   return response;
56 }
57
58 @end /* XmlRpcMethodResponse(WO) */