Sample Atom Server sample

Build SampleAtomServer example

First, use Ant to build the example to the dist/sampleatomserver directory.

For example on UNIX:
   $ cd examples/atomserver
   $ ant
        
Or on Windows:
   > cd examples/atomserver
   > ant
        
Note: This would generate SampleAtomServer.war under SWDP_HOME/atom-impl/samples/SamplAtomServer/dist directory

Deploy SampleAtomServer example

Use container provided deployment mechanism to deploy SampleAtomServer.war into the container. Please make sure that the war contents are expanded. The data generated would be put under directory associated with webapp context root. File based persistence is used for demonstrating the use of Atom Server framework.

Using SampleAtomServer example

You can get the Service/Introspection document of the sample service, Weblog Manager at Introspection Document: http://<serverName>:<serverPort>/SampleAtomServer/atom

( Note: For username&password you can use admin/admin or test/test. Sample implementation class com.sun.syndication.atomprotocol.samples.SampleAtomHandlerImpl extends com.sun.syndication.atomprotocol.impl.GenericAtomHandlerImpl class and overrides public boolean validateUser( String login, String password ). It then returns true if loginId/password combination is either admin/admin or test/test. For any other combination user validation would fail and AtomServer won't allow users to do any operations. )

To get collection of entries available you can use Collection of Entries: http://<serverName>:<serverPort>/SampleAtomServer/atom/admin/entries

(Note: Replace "admin" with the login_id you used for login )

To access specific Entry

You can access
http://://atom//entry/
to access specific entry. Here entry_id is the id of the entry. By default if specific id is not mentioned in the Entry, we will use the title of the entry with spaces replaced with "-".

Accessing Sample Atom Server with BlogClient, Shipped in SWDP

You can use the following steps to use BlogClient application which provides Atom Client library, that support publishing to blogs via Atom Publishing Protocol.
  • Build the BlogClient example

    First, use Ant to build the example to the dist/blogclient directory.

    For example on UNIX:
       $ cd $BLOGAPPS/blogclient
       $ ant
                    
    Or on Windows:
       > cd %BLOGAPPS%\blogclient
       > ant
                    

    Run the BlogClient example

    To run the example and change directories into the dist/blogclient directory. Run the example using either blogclient.bat (for Windows) or blogclient.sh (for UNIX).

    For example on UNIX:
       $ cd $BLOGAPPS/blogclient/dist/blogclient
       $ ./blogclient.sh 
                    
    Or on Windows:
       > cd %BLOGAPPS%\blogclient\dist\blogclient
       > blogclient 
    
                    
    • In the BlogClient Login screen enter
      Username: admin
      Password: admin
      Server URL: http://:/SampleAtomServer/atom
      Protocol: Atom
    • In the next screen with title, RSS and Atom in Action - Blog Client, You can enter values for
      Title
      Category
      Content
      and press Publish button to publish Blog entry on the SampleAtomServer.

      You should see Entry Saved dialog box. You can submit OK.
      (Note: From Entries TAB at the top you can go ahead and see the weblog entries of the user which we got submitting GET request to the Entry collection on the Sample Atom Server.
    • Go back to Edit Entry tab screen and submit other entry information along with uploading and image. This would upload the image by issuing POST request to the resources collection.
    • You can select an Entry and Submit Delete, which would send Delete message for the Entry and then Blogclient issues the GET request on the Entry collecion.