~ubuntu-branches/ubuntu/trusty/smuxi/trusty-proposed

« back to all changes in this revision

Viewing changes to lib/ServiceStack/src/ServiceStack.Common/ServiceClient.Web/JsvServiceClient.cs

  • Committer: Package Import Robot
  • Author(s): Mirco Bauer
  • Date: 2013-05-25 22:11:31 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20130525221131-nd2mc0kzubuwyx20
Tags: 0.8.11-1
* [22d13d5] Imported Upstream version 0.8.11
* [6d2b95a] Refreshed patches
* [89eb66e] Added ServiceStack libraries to smuxi-engine package
* [848ab10] Enable Campfire engine
* [c6dbdc7] Always build db4o for predictable build result
* [13ec489] Exclude OS X specific libraries from dh_clideps

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using System.IO;
 
3
using ServiceStack.ServiceHost;
 
4
using ServiceStack.Text;
 
5
 
 
6
namespace ServiceStack.ServiceClient.Web
 
7
{
 
8
    public class JsvServiceClient
 
9
        : ServiceClientBase
 
10
    {
 
11
        public override string Format
 
12
        {
 
13
            get { return "jsv"; }
 
14
        }
 
15
 
 
16
        public JsvServiceClient()
 
17
        {
 
18
        }
 
19
 
 
20
        public JsvServiceClient(string baseUri) 
 
21
        {
 
22
            SetBaseUri(baseUri);
 
23
        }
 
24
 
 
25
        public JsvServiceClient(string syncReplyBaseUri, string asyncOneWayBaseUri) 
 
26
            : base(syncReplyBaseUri, asyncOneWayBaseUri)
 
27
        {
 
28
        }
 
29
 
 
30
        public override string ContentType
 
31
        {
 
32
            get { return String.Format("application/{0}", Format); }
 
33
        }
 
34
 
 
35
        public override void SerializeToStream(IRequestContext requestContext, object request, Stream stream)
 
36
        {
 
37
            using (var writer = new StreamWriter(stream))
 
38
            {
 
39
                TypeSerializer.SerializeToWriter(request, writer);
 
40
            }
 
41
        }
 
42
 
 
43
        public override T DeserializeFromStream<T>(Stream stream)
 
44
        {
 
45
            using (var reader = new StreamReader(stream))
 
46
            {
 
47
                return TypeSerializer.DeserializeFromReader<T>(reader);
 
48
            }
 
49
        }
 
50
 
 
51
        public override StreamDeserializerDelegate StreamDeserializer
 
52
        {
 
53
            get { return TypeSerializer.DeserializeFromStream; }
 
54
        }
 
55
    }
 
56
}
 
 
b'\\ No newline at end of file'