Dashboard > blojsom 3.0 > About blojsom > Advanced XML-RPC Configuration
  blojsom 3.0 Log In   View a printable version of the current page.  
  Advanced XML-RPC Configuration
Added by David Czarnecki, last edited by David Czarnecki on Jan 23, 2007  (view change)
Labels: 

The XML-RPC servlet is configured through the /WEB-INF/web.xml file.

Setting a default XML-RPC handler

A special key, $default is used to specify which of the registered XML-RPC handlers will be used as the default XML-RPC handler if one is not specified in an XML-RPC call. For example, the following shows what the xmlrpcProperties bean definition in the /WEB-INF/classes/blojsom-xmlrpc.xml file looks like where the default XML-RPC handler is set to the MetaWeblog API handler.

<bean id="xmlrpcProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="properties">
            <props>
                <prop key="blogger">org.blojsom.extension.xmlrpc.handler.BloggerAPIHandler</prop>
                <prop key="metaWeblog">org.blojsom.extension.xmlrpc.handler.MetaWeblogAPIHandler</prop>
                <prop key="mt">org.blojsom.extension.xmlrpc.handler.MovableTypeAPIHandler</prop>
                <prop key="pingback">org.blojsom.extension.xmlrpc.handler.PingbackHandler</prop>
                <prop key="$default">metaWeblog</prop>
            </props>
        </property>
    </bean>

Writing a custom XML-RPC handler

If you are writing a custom XML-RPC handler for blojsom, you must write your class to implement the org.blojsom.extension.xmlrpc.handler.APIHandler interface. Take a look at the source code for the BloggerAPIHandler or the MetaWeblogAPIHandler to see how it's done.

Registering a custom XML-RPC handler

To register your custom XML-RPC handler with blojsom, you must modify the /WEB-INF/classes/blojsom-xmlrpc.xml file and change settings for the xmlrpcProperties bean.

The contents of the bean definition looks similar to the following:

<bean id="xmlrpcProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="properties">
            <props>
                <prop key="blogger">org.blojsom.extension.xmlrpc.handler.BloggerAPIHandler</prop>
                <prop key="metaWeblog">org.blojsom.extension.xmlrpc.handler.MetaWeblogAPIHandler</prop>
                <prop key="mt">org.blojsom.extension.xmlrpc.handler.MovableTypeAPIHandler</prop>
                <prop key="pingback">org.blojsom.extension.xmlrpc.handler.PingbackHandler</prop>
                <prop key="$default">metaWeblog</prop>
            </props>
        </property>
    </bean>

You simply register a particular API handler under a given name. In the first case above, the "blogger" API handler is handled by the org.blojsom.extension.xmlrpc.handler.BloggerAPIHandler class.

Notes on Blogger API 1.0 Handler

The Blogger API 1.0 does not handle categories. Because of this, blojsom returns each category as a separate blog for the getUsersBlogs() call.

Blogger API Permission

As of blojsom 2.23, users must have the global permission or the post_via_blogger_api_permission permission to use the Blogger API.

Notes on MetaWeblog API Handler

The MetaWeblog API supports file uploads through its newMediaObject method. You can change the allowed MIME types that you are allowed to upload using this MetaWeblog API method by changing the blojsom-extension-metaweblog-accepted-types property in your blog's properties.

For example:

blojsom-extension-metaweblog-accepted-types=image/jpeg, image/jpg, image/gif, image/png, img

This would allow you to upload JPG, GIF, PNG, and other image types to your blog.

As of blojsom 2.19:

  • The MetaWeblog API handler will look for the <categories> member that gets passed in the data structure sent to the handler when posting an entry. If available, the handler will use the first category in this structure as the category in which to post the entry. Otherwise, the handler will fallback to the blog ID passed to the method to post the entry.
Metaweblog API Permission

As of blojsom 2.23, users must have the global permission or the post_via_metaweblog_api_permission permission to use the MetaWeblog API.

Notes on MovableType API Handler

As of blojsom 2.20, a MovableType API handler is included with blojsom.

MovableType API Permission

As of blojsom 2.23, users must have the global permission or the post_via_movabletype_api_permission permission to use the MovableType API.

Site running on a free Atlassian Confluence Open Source Project License granted to blojsom. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators