Frequently Asked Questions

Since the initial release of Exyus in January 2008, I occasionally receive questions about the Exyus engine and the thinking behind it. As the questions come up, I'll post them here. The items below are in no particular order. The most recent questions appear at the top of the list.

Feel free to post your own questions by joining the Exyus Discussion Group.

View all

Why don't any of the Exyus URLs have a file extension?

Usually the "file extension" (.html, .xml, etc.) is used to tell the web server what kind of file the client expects. Instead, Exyus uses a form of Content Negotiation to determine the proper file to send to the client. This is done using the Accept HTTP header. When you define a resource in Exyus, you set the "default" content-type. This is the type most web browsers will get when they request the page. Other clients (desktop or command line apps as well as XmlHttpRequest objects) will set the Accept header to make sure they get the proper representation.

The code examples look too simple. Is this just a 'toy' system?

It's a compliment that many think the code examples look 'too simple.' In fact, Exyus makes it possible to publish a read/write resource (like an HTML page editor) with just one class and a handful of settings. That's because Exyus is 'tuned' to publishing read/write Web end-points. Exyus handles caching, accepting PUT, POST, and DELETE commands as well as allowing the standard GET operations.

But you can implement sophisticated applications with Exyus, too. Since Exyus is programmed in C#, you have all the power and flexibility of the .NET runtime at your disposal. You can connect to databases, process XML documents, and more the same way you would if you were using any other web framework. Really, there is no limit to the possibilities.

Isn't this just like Microsoft's ASP.NET MVC?

Microsoft's ASP.NET MVC is a new (still unreleased as of this writing) web framework that uses classic Model-View-Controller patterns. While this is a new start, the currently available version still falls short in a number of areas. It's URL routing, by default, uses function names as part of the URL. It also places HTTP methods like DELETE in the URL. There's is no clear support for multiple representations and there is no built-in expiration and validation caching services.

Exyus provides full control over URLs via the [UriPatterns(...)] attribute. HTTP methods are the actual function names in Exyus resource classes (Get(), Put(), Post(), Delete(), etc.) so there is no need to map them or decorate URLs with method names. And Exyus supports multiple representations using the [MediaTypes(...)] attribute. Finally, full support for caching is built into Exyus.

Why don't you use Microsoft's WCF instead?

Microsoft's WCF started out as a way to improve support for SOAP services in .NET. Later support for direct HTTP was added using the WebGet and WebInvoke attributes (along with several others). While this is a good effort, WCF is still focused primarily on the WS-* stack. Exyus offers no support for SOAP services and treats HTTP methods as "first-class" programming elements. Finally, by steering clear of the WCF programming pattern, it will be easier to implement Exyus using other editions of .NET and even other platforms and languages.

How do I map my functions to an HTTP method?

In Exyus, there is no need to map a function to an HTTP method. Exyus automatically maps HTTP methods (GET, HEAD, POST, PUT, DELETE, OPTION) to a function of the same name in your resource class. If there is no function defined, Exyus returns 405 Method Not Allowed to the client.

Why do you use regular expressions for UriPatterns instead of URI Templates?

Exyus uses regular expressions because they offer more control than standard URI Templates. Exyus UriPatterns allow you to create rules that inspect not just the path and document portion of the URL, but also filter for the presence specific arguments or other values. For example, the UriPattern below checks for the presence of the ?make= argument in the URL:

[UriPattern(@"/cars/\.xcs\?make=(.+)")]
class ShowCar : HTTPResource {...}

match:
http://api.example.com/cars/.xcs?make=toyota
http://api.example.com/cars/.xcs?make=ford

no match:
http://api.example.com/cars/.xcs
http://api.example.com/cars/.xcs?make=
Why don't you use routing tables?

Instead of creating classes and methods and then creating a table to match these classes and methods with HTTP methods, Exyus takes a different approach. When you create an Exyus resource, you mark it with an attribute that indicates one or more UriPatterns. These are rules (using regular expressions) that tell Exyus how to map incoming requests to the proper resource class. The example below tells Exyus that any request to /zipcheck/.xcs or /zipcheck/[some-value].xcs should be handled by this resource class.

[UriPattern(@"/zipcheck/(?<zipid>[^/?]*)?(?:\.xcs)")]
class ZipCheck : HTTPResource {....}
What is an Exyus Resource?

Exyus uses Resoruces to expose data to clients on the web. A resource might be an HTML page with a FORM or it might be one or more "content objects" such as users, products, news articles, etc. When you define a resource in Exyus, you are defining the rules for how clients can read, and possibly write, content.

What does Exyus mean?

"Exyus" is an invented word. It is derived from the sounding out of the letters "XCS" which is used as the file extension (.xcs) Windows Internet Information Server uses to map requests to the Exyus engine.

View all