atomsite.net

The AtomPub server for .NET

News Blog - For August 2008

  1. Release 0.4

    CodePlex I have posted the fourth release to CodePlex. This release contains new support for the Atom Threading Extensions.  This means that BlogSvc supports threaded comments.  The website was also updated with new annotation controls using special jQuery support.  As part of this release we have created/updated the following documentation.

    There is a known issue with this release where media uploads fail with a 404 not found.  It has been fixed in latest source code.

    Looking forward to the next release, we will focus on testing, documentation, and installation.  There will be some great new features on the website such as:

    1. Rating entries (jQuery Stars)
    2. Approval system (comment moderation)
    3. New pages for browsing by category, date, or person (author or contributor).
    Posted by JarrettV on August 28 at 11:43 PM

  2. BlogSvc Now Supports Comments

    Capture The WCF annotation support in BlogSvc has been updated with the standardized Atom Threading Extensions.  The website has also been updated with a very unique method of creating new comments.  Lets just say, classic forms + jquery + ajax + rest = awesome.  Most of the new code is in the Annotate.ascx.  And most of that code is javascript/jquery code.

    Currently, BlogSvc only supports anonymous comments.  I do plan to support OpenID. In the meantime, all commentators are required to supply an email and website.  Commentators can use html in their comments.  I am using some anti-xss code to sanitize the html.

    Thanks to jquery there is some pretty validation going on.  I must say, I really like jquery.  However, there are some quarks when working with jquery and calling a service that returns xml with a custom content-type such as application/xml+atom.  However, I found workarounds to get things working.

    Finally, BlogSvc does support threading comments.  However, the website does not yet support annotating an annotation.  It should be very easy to add using jquery.

    I've also added some technical information to the Documentation.

    Feel free to leave a comment to test things out.

    kick it on DotNetKicks.com
    Posted by JarrettV on August 23 at 9:49 PM

  3. Refactor Session

    I have rearranged the solution during a large refactor session. Any non-domain specific logic has been moved into a new services project.  The provider pattern has been replaced with a repository.  The repositories and services all have interfaces to support future extensibility.  I've already leveraged the authenticate interface to support multiple authentication schemes.

    DomainProject  RepoServicesProjects

    Posted by JarrettV on August 19 at 8:37 AM

  4. From Urn to Tag URIs

    I'm migrating the usage of the urn scheme for IDs to the tag scheme.  Only registered types are allowed to use the urn scheme.  The tag scheme actually fits in very close to how I was using the urn scheme so the migration should be pretty painless.  I've posted a new entry about URIs and URLs in BlogSvc that give plenty of examples of how BlogService will ID and locate resources.

    Posted by JarrettV on August 11 at 4:31 PM

  5. BlogSvc AtomPub Release 0.3

    I've uploaded a new release to CodePlex. This is the first release containing solid AtomPub support. Also, the website has been improved.  This release contains the following new/improved features:

    1. Object model usage improvements (such as ToString)
    2. FileAtomPubProvider configuration extensions including file and folder paths
    3. Administrator support added to AppService
    4. WSSE authentication that supports anonymous and token expiration
    5. Roles added based on AppService
    6. Saving of AppService and AppCategories documents
    7. Add category (fixed, unfixed) to internal or external categories
    8. ETag support for caching and improved Live Writer performance
    9. HEAD request supported on entry and media resources
    10. New website, with new controls
    11. Load RSS feed using Syndication support in .NET 3.5

    This release has been tested on both IIS 6 and IIS 7 integrated.  The next release may leave IIS 6 support behind in favor of IIS 7 integrated mode.  This would improve the URI formats throughout the system.  However, the ID's would remain unchanged as they were designed to support many URL schemes.

    BlogSvc creates IDs that are made up of 3 to 4 parts:

    urn:{workspace*}.{domain}:{collection},{entryPath}

    The workspace is optional unless there are multiple workspaces on the same site. The domain typically matches the domain of where the site is being hosted. The collection signifies the collection in the workspace. The entry path is a comma separated listing of the entry location in an optional thread.

    Examples
    Blog Collection urn:blogsvc.net:blog
    About Entry in Info Collection urn:blogsvc.net:info,About
    Blog Post on Multi-user Site urn:kristin.jvance.com:blog,2008-08-08-AnotherPost
    Comment to Blog Post urn:blogsvc.net:blog,2008-08-08-MyBlogPost,1
    Response to a Comment urn:blogsvc.net:blog,2008-08-08-MyBlogPost,1,1

    See the release page for more details.

    kick it on DotNetKicks.com
    Posted by JarrettV on August 11 at 3:22 AM

  6. New Website

    BlogSvc just got a new website.  There are plenty of tweaks that still need to be done.  This site can be used as an example of using BlogSvc directly through the provider API.  With the strongly typed Atom and AtomPub objects, it is very simple to program against.  And if you prefer to work directly with the Xml then that is also available.  Also, live writer support is fully functional with WSSE authentication.

    image

    Posted by JarrettV on August 11 at 3:21 AM

  7. Ape Results 8/7

    APP Service doc: http://atomsite.net/blog.svc/service

    Summary: 0 errors, 6 warnings.

    1. TESTING: Service document and collections.

    2. ✓ Retrieval of Service Document: it exists and is served properly.

    3. Found these collections:

      • 'FrontPage Blog' accepts application/atom+xml;type=entry

      • 'Image Store' accepts image/png, image/jpeg, image/gif

    4. Will use collection 'FrontPage Blog' for entry creation.

    5. ✓ Page 1 of Entry collection: it exists and is served properly.

    6. ✓ Entry collection has correct app:edited value order.

    7. TESTING: Entry-posting basics.

    8. Now in the Entries feed:

      • Test Multi-pic Post

      • BlogSvc Preview Release 0.2

    9. ✓ Posting of new entry to the Entries collection reported success, Location: http://atomsite.net/blog.svc/www/blog/2008-08-07-Ape-64739

    10. Examining the new entry as returned in the POST response

    11. ✓ Returned entry is consistent with posted entry.

    12. ✓ Provided categories included in Returned entry.

    13. ✓ Server preserved foreign markup in Returned entry.

    14. ✓ Retrieval of newly created entry: it exists and is served properly.

    15. Examining the new entry as retrieved using Location header in POST response:

    16. ? Client-provided slug 'ape-64739' not used in server-generated URI.

    17. ✓ Retrieved entry is consistent with posted entry.

    18. ✓ Provided categories included in Retrieved entry.

    19. ✓ Server preserved foreign markup in Retrieved entry.

    20. Examining the new entry as it appears in the collection feed:

    21. ✓ Entry from collection feed is consistent with posted entry.

    22. ✓ Provided categories included in Entry from collection feed.

    23. ✓ Server preserved foreign markup in Entry from collection feed.

    24. ✓ Update of new entry reported success.

    25. ✓ Title of new entry successfully updated.

    26. ✓ Entry deletion reported success.

    27. ✓ Entry not found in feed after deletion.

    28. TESTING: Collection re-ordering after PUT.

    29. ✓ Page 1 of Entries with multi-post: it exists and is served properly.

    30. ✓ Entries with multi-post has correct app:edited value order.

    31. ✓ Entries correctly ordered after multi-post.

    32. ✓ Page 1 of Entries post-update: it exists and is served properly.

    33. ✓ Entries post-update has correct app:edited value order.

    34. ✓ Entry deletion reported success.

    35. ✓ Entry deletion reported success.

    36. ✓ Entry deletion reported success.

    37. ✓ Entries correctly ordered after update of multi-post.

    38. TESTING: Content sanitization

    39. ✓ Retrieval of unclean XHTML entry: it exists and is served properly.

    40. ? Published entry retains xhtml:script element.

    41. ? Published entry retains 'background' attribute.

    42. ? Published entry retains 'style' attribute.

    43. ? Published entry retains dangerous hyperlink: 'javascript:evil'.

    44. ✓ Entry deletion reported success.

    45. Will use collection 'Image Store' for media creation.

    46. TESTING: Posting to media collection.

    47. ✓ Post of image file reported success, media link location: http://atomsite.net/blog.svc/www/media/2008-08-07-Apix-70783

    48. ✓ Retrieval of media link entry: it exists and is served properly.

    49. ? Client-provided slug 'apix-70783' not used in Media Resource URI.

    50. ✓ Retrieval of media resource: it exists and is served properly.

    51. ✓ Media resource was apparently stored and retrieved properly.

    52. ✓ Entry deletion reported success.

    53. ✓ Media link entry no longer in feed.

    54. ✓ Media resource no longer fetchable.

    55. TESTING: Media collection re-ordering after PUT.

    56. ✓ Page 1 of Pictures from multi-post: it exists and is served properly.

    57. ✓ Pictures from multi-post has correct app:edited value order.

    58. ✓ Fetch image to get ETag: it exists and is served properly.

    59. ✓ Update one of newly posted pictures went OK.

    60. ✓ Page 1 of MLEs post-update: it exists and is served properly.

    61. ✓ MLEs post-update has correct app:edited value order.

    62. ✓ Entry deletion reported success.

    63. ✓ Entry deletion reported success.

    64. ✓ Entry deletion reported success.

    65. ✓ Entries correctly ordered after update of multi-post.

    Posted by JarrettV on August 07 at 8:58 AM

  8. Test Multi-pic Post

    Test update

    Forest  Desert Landscape

    Posted by JarrettV on August 07 at 1:57 AM

  9. BlogSvc Preview Release 0.2

    I've put a new release up on codeplex. This release includes an implementation of Atom Publishing Protocol on WCF 3.5.  In the words of Tim Bray:

    An Atompub implementation lets you create, retrieve, update, and delete (CRUD) Web Resources. ... Atompub starts with a Service Document, which contains one or more named Workspaces, which contain Collections, which are what you actually POST to in order to start up the CRUD process.  So the idea is simple; have a collection that when you POST to it, creates a new publication.

    The object model is based off of the Atom Syndication Format and the AtomPub specs.  All of the objects are based off of Xml or the new XElement. This means that each object has an Xml property that points to the underlying xml. The object's propeties have getters and setters which access the xml as strongly typed values.

    Atom Syndication Format Atom Publishing Protocol
    AtomCategory AppCategories
    AtomContent AppCollection
    AtomEntry* AppControl
    AtomFeed AppService
    AtomGenerator AppWorkspace
    AtomLink*  
    AtomPerson Atom Threading Extension
    AtomSource ThreadInReplyTo
    AtomText * Extended

    The objects listed above all support extensions and furthermore, it is very easy to add strongly typed access to those extensions. Note: .NET 3.5 already contains objects that are close to the Atom objects above and .NET 3.5 SP1 will have objects for AtomPub. See System.ServiceModel.Syndication namepace. In a future blog post, I will explain why I decided to go with the above object model over what is provided in the framework.

    This release should work in IIS6 or IIS7 with .NET 3.5.  Also the SVC handler must support all verbs.  Since AtomPub is RESTful, you'll need PUT and DELETE to go along with the usual GET and POST verbs.

    The WCF service is built using the new Web Programming Model available in 3.5.  However, it is designed to support normal web services as well (more on this in a future post).  A neat WCF feature with this release is the support of media entries allowing a user to post images to a collection.  I found the trick to supporting raw data on Carlos' blog.  However, there is a catch. Anytime you want to accept unknown content types and known content types, you must only deal with Stream objects.  For example, although CreateEntry will always return an AtomEntry document you must specify a Stream because the input could be an AtomEntry or say a JPG image.

    [ServiceContract]
            public interface IAtomPub
            {
            [WebGet(BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "{workspaceName}/{collectionName}/{entryName}/media")]
            Stream RetrieveMedia(string workspaceName, string collectionName, string entryName);
    
            [WebInvoke(BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "{workspaceName}/{collectionName}")]
            Stream CreateEntry(string workspaceName, string collectionName, Stream stream);
    
            [WebGet(UriTemplate = "{workspaceName}/{collectionName}/{entryName}")]
            Stream RetrieveEntry(string workspaceName, string collectionName, string entryName);
    
            [WebInvoke(BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "{workspaceName}/{collectionName}/{entryName}", Method = "PUT")]
            Stream UpdateEntry(string workspaceName, string collectionName, string entryName, Stream stream);
    
            [WebInvoke(UriTemplate = "{workspaceName}/{collectionName}/{entryName}", Method = "DELETE")]
            void DeleteEntry(string workspaceName, string collectionName, string entryName);
    
            [WebGet(UriTemplate = "service")]
            AppService RetrieveService();
    
            [WebGet(UriTemplate = "{workspaceName}/{collectionName}/category?scheme={scheme}")]
            AppCategories RetrieveCategories(string workspaceName, string collectionName, string scheme);
    
            [WebGet(UriTemplate = "{workspaceName}/{collectionName}")]
            AtomFeed RetrieveFeed(string workspaceName, string collectionName);
            }
    

    You can direct it to a strongly typed implementation by checking the content type.

    public Stream CreateEntry(string workspaceName, string collectionName, Stream stream)
            {
            string contentType = WebOperationContext.Current.IncomingRequest.ContentType;
            AtomEntry entry;
            if (contentType == Atom.ContentType || contentType == Atom.ContentTypeEntry)
            {
            entry = new AtomEntry();
            XmlReader reader = new XmlTextReader(stream);
            entry.Xml = XElement.Load(reader);
            entry = CreateEntry(workspaceName, collectionName, entry);
            }
            else entry = CreateMedia(workspaceName, collectionName, stream);
            return GetStream(entry);
            }
    

    Please see the release page for more details.

    In the next post, I will discuss workspace, collection, entry names, id's, links, etc.

    Posted by JarrettV on August 04 at 5:22 PM

© Copyright 2012 Powered by AtomSite 1.4.0.0