Exyus is an HTTP/REST engine written for the Windows/ASP.NET platform. this blog lists code changes and other important updates to the code base.

2008-04-02

Codebreaker game is now online

as part on my ongoing effort to exercise the exyus web engine, i posted a simple online game called Codebreaker. it's pretty simple - you have ten tries to guess a four-letter code generated by the computer. the game is similar to Mastermind.

the version that's posted is pretty basic. you can play games and the syustem will keep track of your past games (using a browser-based cookie). in the future, i'll proly allow folks to create a login account that you can use to recall your games from any browser. i also have plans to add more stats and other 'community kinda stuff - all in the name of testing the web engine.

anyway, now that it's posted, i am looking for folks to test it out and provide feedback. so, take a few minutes and give it a try.

2008-03-27

new code commited to tree

i committed a handful of changes to the exyus @ googlecode project this evening. updated the error-rendering for all the Resource classes. they now all honor the media-types requested by the client.

i also broke down and added a protected Hashtable shared-args to the base class (HTTPResource). this allows child classes to collect custom name/value pairs and pass that down to parent classes. needed this to handle generated ids for the codebreaker game and i can see it for other cases. i want to stay clear of too much 'property-bag' stuff, but since this is within the same class instance, i think this is ok.

i also did more work on the codebreaker game project. the code checked in is still rough, but it's starting to come together (and i'm having fun playing it!). i suspect it will be posted as a live demo this weekend.

finally, i suspect another round of refactoring is in the near future. i can see several places where the code looks the same and could be moved to a shared routine. doing a good job of refactoring will make creating custom classes off the base much easier, too.

2008-03-23

UGData Tutorial Posted

I added a new tutorial to the site. This one covers the details of using SQL Server as the data-store for HTTP/REST-compliant apps. Here's the abstract:

In this tutorial you'll learn how to build database-backed REST-ful applications using the exyus engine. You'll learn how to build stored procedures for SQL Server that output XML for use with the XmlSqlResource class in exyus. You'll learn how to use the XmlSqlResource base class to define your own database-backed HTTP Resource. And you'll learn how to use XSL transforms and XSD Schema documents to control the processing of inbound client requests and generating outbound server responses. Finally, you'll learn how you can use simple HTML FORMs to support not just GET and POST, but also PUT and DELETE HTTP methods.

You can test the online version of the UGData application.

2008-03-18

V0.6 release of exyus includes DB Support

i finally got around to packaging up the db support for exyus. turns out it has been four weeks since the last release - wow.

i also incremented the version from 0.05 to 0.06 since the database support is a major change. i built a couple of sample db-based apps as part of testing. the strongest one right now is the User Group Members example. this one is interesting because it offers a way to handle DELETE and PUT via FORM POST. even though DELETE and PUT were in the HTTP web spec early on, it remains unsupported by the common browsers. my solution is to overload the document id that is the target of the POST. for example:


-- standard HTTP methods
POST /resource/ (creates a new document)
GET /resource/1 (gets an existing document)
PUT /resource/1 (updates an existing document)
DELETE /resource/1 (deletes an existing document)

-- handling PUT and DELETE via FORM POST
POST /resource/1;update (updates an existing document)
POST /resource/1;delete (deletes an existing document)

the last two examples show the overloaded document id in action. on the server tehre is a URI roule that accepts the /resource/{id};update pattern and then executes the PUT or DELETE as expected. this makes sure the actual PUT/DELETE are logged in the server logs and reduces the amount of special coding needed to support POSTed PUT/DELETE. it also makes sure that any cache invalidation rules you have for PUT or DELETE will be properly honored.

anyway, lots of other cool stuff are in this update. i'll post about them over the next few days.

2008-03-11

Committed DB Support to exyus basline

i've spent a good chunk of time beating on the XmlSqlResource class in exyus this week. and i found a few glitches. along the way i've revamped the support for handling exception rendering (now tied more closely to the representation headers ((Accept/Content-Type) and i've improved the details of POST-ing for update and delete (via a 'proxy pattern' that i'll blog about soon). i also tweaked a few other things in the engine this week. all good stuff.

however...

because of the time i spent updating *and* because of some personal issues this week, i'm not ready to release a new runtime update [sigh]. this next one will be a version bump (0.5 to 0.6) and i still need to sort out some details. that means it will be three weeks (at least) since the last runtime update - bad stuff.

hopefully, i can put together the details of the runtime during the week and release soon.

2008-03-03

t-sql for exyus all checked in

i was able to power through the rest of t-sql support for the XmlSqlResource class in exyus this evening. full support for PUT(create/update) w/ ETags. it went easier than i thought it would. the ETag code from the XmlFileResource was very easy to drop in and tweak. nice to see that HTTP calls (HEAD w/ ETag) work like a champ for any representation [grin]!

i still need to beat this up for a bit and clean out the cobwebs and such. but i should have a solid release within a day or so. i had fun whipping up transforms for text/xml and text/html representations for a simple resource. i find myself starting to think pretty easily in mime-types and transformations - at least for HTML and XML types. i still have to do some work to get my head to easily think in JSON, tho.

anyway, fun evening and it's all booked into source control - sweet!

2008-03-02

rewriting t-sql support in exyus

data i finally bit the bullet and started a complete rewrite of the t-sql support in exyus this weekend. i'd been dreading it for a while, but knew it had to be done. so much has changed since i wrote the SqlXmlResource class late last year. in fact, so much drift had occurred since i last used the t-sql resource, i just marked is as // not working! in order to keep folks from getting hurt.

anyway, the rewrite has been going very well. i've got GET/HEAD, POST, and DELETE support done. still need to implement the full PUT (create/update) w/ ETag support, tho. i've also run into a few new items regarding redirection options for POST and DELETE. i've got a bit of work to do to make sure the proper URI is composed for redirects for POST, too. but, all in all, it's gone well and i a should have a new release posted early this week. it's been a while since i had a meaningful update and it will be nice to get some good stuff out there.

once the t-sql support is updated and tested, i'm looking forward to some new demo apps and articles covering how easy it is to publish database-backed end-points with exyus.

2008-02-27

checked in minor changes to exyus

p>i checked in two minor changes to the exyus code tree this evening.

the first is a spelling change for an internal argument for one of the constructors of the HTTPClient class. the second change is the addition of public bool NoCache property to the CollectionRequestor class in the same code file. this does not change the default behavior (defaults to true) but offers the option of turning off the "no-cache" behavior of the CollectionRequestor class.

these are minor, i know. i've been swamped with other things over the last two weeks. i hope to dive back into coding this coming weekend. i have some tutorial articles to finish up as well. maybe i can post one of those before the weekend arrives.

2008-02-17

Update Source and Binaries Posted

I posted an updated set of source & binaries this evening: http://code.google.com/p/exyus/downloads/list

This set has the most recent changes to the SMTPResource as well as updated samples (SendMail and Server-Side Mashup). The SMTPResource might be a bit flaky. I need to complete some tests and update the SendMail sample, too.

As usual, feedback is welcome!

Server-Side Mashups w/ Exyus

i completed a simple server-side mashup example using exyus last night.

this pulls info from two remote sites (National Geographic News and USGS Earthquake Hazards Program) and combines that with some local XML content into a single page. This is done using the XmlPageResouce class. i added a bit of CSS to the thing to spruce it up, but otherwise, there's nothing fancy there. just exyus coolness[g]!

i plan on doing a short tutorial on doing server mashups and posting it to the Articles section of the main site later this evening.

2008-02-16

SMTPResource - take 2

i completed the update of my SMTPResource this evening.

this one has an expanded object model. no longer are you limited to to, from, subject, body elements. now there is a replyto element an the to, cc, bcc elements are all collections of name/email pairs. this offers quite a bit of flexibility. i am also adding a priority and content-type for the body element. i've started testing, but still need to tweak things a bit more.

the text/xml version works fine. however, i need to work up the transforms and validators for application/json and application/x-www-urlencoded versions. not planning on a plain/text or application/atom+xml implementation right now, but that's just more XML/XSD work - no new code.

i hope to have this solid by tomorrow and will roll it into the weekly update release (if all goes well). not too bad, eh?

2008-02-11

SMTPResource class checked in

i checked into the source code a new resource class to exyus this evening. the new SMTPResource class handles the details of accepting POSTed values and using them to send an SMTP email message. this first implementation is very rudimentary (no support for CC/BCC, etc.) but it gets things started. i'll refine it over the next few days and then roll it up into the weekly builds for next weekend.

the code for declaring an instance class is pretty simple. here's my current test version:

using System;
using Exyus.Web;

namespace Exyus.Samples
{
    [UriPattern(@"/sendmail/\.xcs")]
    [MediaTypes("application/x-www-form-urlencoded", "text/xml")]
    class SendMail : SMTPResource
    {
        public SendMail()
        {
            this.AllowPost = true;
            this.ContentType = "text/xml";
            this.DocumentsFolder = "~/documents/sendmail/";
            this.PostLocationUri = "/sendmail/thankyou";
            this.RedirectOnPost = true;
            this.XHtmlNodes = new string[] {"//body"};
        }
    }

    [UriPattern(@"/sendmail/thankyou\.xcs")]
    [MediaTypes("text/html")]
    class SendMailThankyou : StaticResource
    {
        public SendMailThankyou()
        {
            this.Content = Helper.ReadFile("/xcs/content/sendmail/thankyou.html");
        }
    }
}

the redirect to the StaticResource class is an added flourish, but handy. i'm not sure if this will be part of the final release or if i'll roll something else into the base class (like a pointer to a document, etc.).

anyway, i've been wanting to implement an SMTP-based resource for quite some time and i finally sat down and pulled one together. nice to have!

2008-02-09

New Demo Added, Runtime Updated

A new demo app (ZipCheck)is now available. This demo shows how to use HTTP/REST constraints to build web apps that provide immediate feedback without using Ajax or other scripting services. The source is viewable online and is included in the latest exyus runtime. Also, a new version of the exyus runtime install kit has been updated and posted to the exyus googlecode site. This is a minor update that cleans up some utility functions and cookie-handling code.

2008-02-03

Exyus runtime updated : now with JSON inside

i updated the exyus runtime this afternoon. i also updated the exyus main site. finally, i updated the TaskList. i even posted a new article covering a new command-line demo app called TaskList Client. it's been a fun week!

the biggest news for this release is the inclusion of JSON support 'in the box.' now, exyus can accept POST/PUT representations in JSON format. technically, exyus has supported JSON for HTTP GET - it's just a transform [g]. but now exyus has full support for JSON. i was able to do this relatively quickly because i found a solid C# library for JSON called Nii.JSON at the json.org site. not sure who wrote it. i think it was a port from a java library. anyway, it's solid and sweet. i needed to add my own routine to consistently convert incoming JSON into valid XML. took al bit of effort, but it's all cool now.

anyway, the new runtime is up and available. i had a good week!

2008-02-02

Tasklist-cmd Tutorial Posted

i posted a new tutorial (TaskList Client Tutorial) on the exyus site this evening. this one shows how to use the HTTPClient class inside exyus to create full-featured HTTP clients that run on your desktop instead of in your browser.

it was fun to put together. the app was easy (see my previous post on that). writing the tutorial was also pretty cool. not a lot to it, but it all falls together pretty nicely. the app allows you to list, add, edit, and delete records stored on the server. it uses HTTP commands (GET, PUT, POST, DELETE) and works like a champ. here's a sample of the code in the client app.

public XmlDocument GetList()
{
    client.RequestHeaders.Set("cache-control", "no-cache");
    string results = client.Execute(Uri, "get", "text/xml");
    XmlDocument doc = new XmlDocument();
    doc.LoadXml(results);
    return doc;
}

public XmlDocument GetItem(string id)
{
    string results = client.Execute(Uri + id, "get", "text/xml");
    p_etag = client.ResponseHeaders["etag"];
    XmlDocument doc = new XmlDocument();
    doc.LoadXml(results);
    return doc;
}

public void AddItem(string name)
{
    AddItem(name, "0");
}

public void AddItem(string name, string completed)
{
    client.Execute(Uri, "post", "text/xml", string.Format(p_new_task, name, completed));
}

you can check out the entire app (TaskList Client) at the exyus googlecode site.

2008-01-29

installed cmd applet on my server

more fun w/ exyus today.

last night i built a simple command-line app (tasklist-cmd that can "talk" to the TaskList server. that was fun. a simple desktop app that does clean HTTP work (including handling headers for etags, cache-control, user-agent, etc.) without a lot of fuss and bother. nice. you can download the source and a windows executable from the exyus code site.

today i installed this applet on a server as a tool for clearing out old tasks from the demo site as well as poking some "fun" tasks in myself. it was also really easy. after copying the exe (and dlls) to the server, i whipped up the following set-task.cmd file:

@echo off

tasklist-cmd -clear
tasklist-cmd -add "read tutorials" 1
tasklist-cmd -add "download exyus"
tasklist-cmd -add "check out newsgroup" 1
tasklist-cmd -add "start writing my own cool apps!"
schedule it up and we're cookin'!

Posted Tasklist commandline sample app

i posted a sample commandline app (tasklist-cmd) that shows off the HTTPClient in exyus.

it does all the things the web app does (TaskList), but using a command-line app instead of a browser. the UI is totally clunky (hey, it's the command line!) but it's still kinda helpful. i plan on using to to script some interactions with the task list to keep i cleaned out regularly. i'll also poke some stuff in the list every once in a while, just for fun.

only took me a short itme to do this app. i really like working with HTTP this way!

2008-01-28

Adding exyus user to the IIS logs

i checked in a change this weekend that adds the logged-in exyus user to the IIS logs. this is a 'hack' but at least you can find the user in the logs now.

since exyus uses it's own Digest and Basic HTTP Auth, IIS never knows who is the authenticated user. that means the cs-username is always empty in the logs. now, by using the Response.AppendToLog(exyus_user) pattern, any time a user authenticates within exyus, the data is added to the log - as part of the cs-query field. it looks like this: +[exyus-user=mike].

check out the source code at the google code site (see sidebar) for details.

2008-01-27

TastList Sample and Tutorial Posted

I posted a live sample app (TaskList) this week and I posted the TaskList Tutorial in the Articles section of the exyus web site. This is my first article on exyus. but i hope it's not the last.

Feedback is welcome!

2008-01-20

Welcome to the exyus blog!

I posted the first round of source code and examples on the public web this weekend. Lots of things to do over the next several weeks. I'm looking forward to the feedback.