Package org.apache.wiki.xmlrpc

# Class MetaWeblogHandler

java.lang.Object
org.apache.wiki.xmlrpc.MetaWeblogHandler

All Implemented Interfaces:
  `WikiRPCHandler`

public class MetaWeblogHandler extends Object implements WikiRPCHandler
Provides handlers for all RPC routines of the MetaWeblog API.

JSPWiki does not support categories, and therefore we always return an empty list for getCategories(). Note also that this API is not suitable for general Wiki editing, since JSPWiki formats the entries in a wiki-compatible manner. And you cannot choose your page names either. Since 2.1.94 the entire MetaWeblog API is supported.

Since:
  2.1.7

## Constructor Summary

Constructors
Constructor
Description
`MetaWeblogHandler()`

## Method Summary

Modifier and Type
Method
Description
`Hashtable<Object,Object>`
`getCategories(String blogid, String username, String password)`
JSPWiki does not support categories, therefore JSPWiki always returns an empty list for categories.
`Hashtable`
`getRecentPosts(String blogid, String username, String password, int numberOfPosts)`
Returns a list of the recent posts to this weblog.
`void`
`initialize(Context context)`
`Hashtable<String,Object>`
`newMediaObject(String blogid, String username, String password, Hashtable<String,Object> content)`
Creates an attachment and adds it to the blog.
`String`
`newPost(String blogid, String username, String password, Hashtable<String,Object> content, boolean publish)`
Adds a new post to the blog.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### MetaWeblogHandler

public MetaWeblogHandler()

## Method Details

### initialize

public void initialize(Context context)

Specified by:
  `initialize` in interface `WikiRPCHandler`

### getCategories

public Hashtable<Object,Object> getCategories(String blogid, String username, String password) throws org.apache.xmlrpc.XmlRpcException
JSPWiki does not support categories, therefore JSPWiki always returns an empty list for categories.

Parameters:
  `blogid` - The id of the blog.
  `username` - The username to use
  `password` - The password
Returns:
  An empty hashtable.
Throws:
  `org.apache.xmlrpc.XmlRpcException` - If something goes wrong

### getRecentPosts

public Hashtable getRecentPosts(String blogid, String username, String password, int numberOfPosts) throws org.apache.xmlrpc.XmlRpcException
Returns a list of the recent posts to this weblog.

Parameters:
  `blogid` - The id of the blog.
  `username` - The username to use
  `password` - The password
  `numberOfPosts` - How many posts to find
Returns:
  As per MetaweblogAPI specification
Throws:
  `org.apache.xmlrpc.XmlRpcException` - If something goes wrong

### newPost

public String newPost(String blogid, String username, String password, Hashtable<String,Object> content, boolean publish) throws org.apache.xmlrpc.XmlRpcException
Adds a new post to the blog.

Parameters:
  `blogid` - The id of the blog.
  `username` - The username to use
  `password` - The password
  `content` - As per Metaweblogapi contract
  `publish` - This parameter is ignored for JSPWiki.
Returns:
  Returns an empty string
Throws:
  `org.apache.xmlrpc.XmlRpcException` - If something goes wrong

### newMediaObject

public Hashtable<String,Object> newMediaObject(String blogid, String username, String password, Hashtable<String,Object> content) throws org.apache.xmlrpc.XmlRpcException
Creates an attachment and adds it to the blog. The attachment is created into the main blog page, not the actual post page, because we do not know it at this point.

Parameters:
  `blogid` - The id of the blog.
  `username` - The username to use
  `password` - The password
  `content` - As per the MetaweblogAPI contract
Returns:
  As per the MetaweblogAPI contract
Throws:
  `org.apache.xmlrpc.XmlRpcException` - If something goes wrong