This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using NServiceBus; | |
using NServiceBus.ObjectBuilder.Common; | |
using Nancy; | |
using Nancy.Bootstrapper; | |
using Nancy.Diagnostics; | |
public class NServiceBusContainerBootstrapper : NancyBootstrapperWithRequestContainerBase<IContainer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location ^~ /cgi-bin/munin-cgi-graph/ { | |
fastcgi_split_path_info ^(/cgi-bin/munin-cgi-graph)(.*); | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
fastcgi_pass unix:/var/run/munin/fastcgi-graph.sock; | |
include fastcgi_params; | |
} | |
location /munin/static/ { | |
alias /etc/munin/static/; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spawn-fcgi -s /var/run/munin/fastcgi-graph.sock -U www-data \ | |
-u munin -g munin /usr/lib/cgi-bin/munin-cgi-graph | |
spawn-fcgi -s /var/run/munin/fastcgi-html.sock -U www-data \ | |
-u munin -g munin /usr/lib/cgi-bin/munin-cgi-html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Location | |
{ | |
public double Latitude { get; set; } | |
public double Longitude { get; set; } | |
} | |
public class LocationProcessor : Processor<string, string, Location> | |
{ | |
public LocationProcessor() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = new HttpClient(); | |
client.DefaultHeaders.Accept.Add("text/xml"); | |
var resp = client.Get("http://contoso.com/contacts/1"); | |
resp.Content.ReadAsXmlSerializable<Contact>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ServiceContract] | |
public class DocumentResource | |
{ | |
[WebGet(UriTemplate="{name}")] | |
public Document Get(string name, HttpResponseMessage resp) | |
{ | |
Document doc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ServiceContract] | |
public class HelloWorldResource { | |
[WebGet(UriTemplate="")] | |
public void Get(HttpRequestMessage req, HttpResponseMessage resp) { | |
if (req.IfNoneMatch.Contains("HW")) { | |
resp.StatusCode = HttpStatusCode.NotModified; | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IEnumerable<Order> GetApprovedOrders() | |
{ | |
string address = "http://contoso.com/orders"; | |
HttpClient client = new HttpClient(address); | |
WebQuery<Order> orders = client.CreateQuery<Contact>(); | |
return orders.Where<Order>(o=>o.State == OrderState.Approved). OrderBy(o=o.OrderID); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[WebGet(UriTemplate = "")] | |
[QueryComposition] | |
public IEnumerable<Contact> Get() | |
{ | |
return contacts.AsQueryable(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JsonValueSampleConfiguration : HostConfiguration | |
{ | |
public override void RegisterRequestProcessorsForOperation( HttpOperationDescription operation, IList<Processor> processors, MediaTypeProcessorMode mode) | |
{ | |
processors.Add(new FormUrlEncodedProcessor(operation, mode)); | |
} | |
public override void RegisterResponseProcessorsForOperation( HttpOperationDescription operation, IList<Processor> processors, MediaTypeProcessorMode mode) | |
{ | |
processors.ClearMediaTypeProcessors(); |