GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.servicestack.net — Content Types Content TypesServiceStack supports the following formats:
.NET Service ClientsThe different Content Types can be easily consumed using ServiceStack's Typed Generic Service Clients. HTTP API FormatsServiceStack Services supports a number of Content Negotiation options where you can define which
format should be returned by adding a
Example: http://web.web-templates.io/hello/World.json Or by appending
Example: http://web.web-templates.io/hello/World?format=json Alternatively ServiceStack also recognizes which format should be used with the
Default Content-TypeThe recommended way to request a specific content type is to add it to the Accept HTTP Request Header, e.g:
Alternatively you can specify to use a specific Content-Type as the default Content Type in your AppHost with:
Sometimes when calling web services from a web browser they'll ask for To ensure JSON is always returned you can disable the HTML support with:
Pre-defined Routes
Examples:
Forcing a Content TypeWhilst ServiceStack Services are typically available on any endpoint and format, there are times when you only want adhoc Services available in a particular format, for instance you may only want the View Models for your dynamic Web Views available in HTML. This can now be easily enabled with the new
This feature is also available for other built-in Content Types: Registering a Custom FormatRegistering a custom format is done by registering the Format's Content-Type with to your AppHost's
We recommend encapsulating Custom Formats registrations into a Plugin as done with the built-in CsvFormat which is added by default:
Which makes it easy to register, detect and remove. E.g. to remove built-in support for CSV you can just remove it from the
XmlSerializerFormat PluginThe
The implementation provides a typical example of how to register or override different Content-Types in ServiceStack:
SOAP EndpointConsume ServiceStack Services via SOAP using WCF Add Service Reference or ServiceStack generic SOAP Clients. MQ EndpointConsume ServiceStack Services via Message Queue. On This Page
|
| You are visitor 01402809 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |