Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.blojsom.extension.xmlrpc.handler
Class PingbackHandler

    java.lang.Object
      org.blojsom.extension.xmlrpc.handler.APIHandler
          org.blojsom.extension.xmlrpc.handler.PingbackHandler

public class PingbackHandler
extends APIHandler

Pingback handler provides support for the Pingback 1.0 specification.

Since:
  blojsom 3.0
Version:
  $Id: PingbackHandler.java,v 1.3 2006/03/25 07:10:30 czarneckid Exp $
Author:
  David Czarnecki

Field Summary
`protected static java.lang.String` | `API_NAME`
`protected static int` | `PINGBACK_ACCESS_DENIED_CODE`
`protected static int` | `PINGBACK_ALREADY_REGISTERED_CODE`
`protected static int` | `PINGBACK_GENERIC_FAULT_CODE`
`protected static int` | `PINGBACK_NO_LINK_TO_TARGET_URI_CODE`
`protected static java.lang.String` | `PINGBACK_SOURCE_URI_METADATA`
`protected static int` | `PINGBACK_SOURCE_URI_NON_EXISTENT_CODE`
`protected static java.lang.String` | `PINGBACK_TARGET_URI_METADATA`
`protected static int` | `PINGBACK_TARGET_URI_NON_EXISTENT_CODE`
`protected static int` | `PINGBACK_TARGET_URI_NOT_ENABLED_CODE`
`protected static int` | `PINGBACK_UPSTREAM_SERVER_ERROR_CODE`

Fields inherited from class org.blojsom.extension.xmlrpc.handler.APIHandler
`_authorizationProvider, _blog, _eventBroadcaster, _fetcher, _httpServletRequest, _httpServletResponse, _properties, _servletConfig, AUTHORIZATION_EXCEPTION, AUTHORIZATION_EXCEPTION_MSG, INVALID_POSTID, INVALID_POSTID_MSG, NOBLOGS_EXCEPTION, NOBLOGS_EXCEPTION_MSG, PERMISSION_EXCEPTION, PERMISSION_EXCEPTION_MSG, UNKNOWN_EXCEPTION, UNKNOWN_EXCEPTION_MSG, UNSUPPORTED_EXCEPTION, UNSUPPORTED_EXCEPTION_MSG`

Constructor Summary
`PingbackHandler()` Construct a new Pingback handler

Method Summary
`protected java.lang.Integer` | `addPingback(java.lang.String title, java.lang.String excerpt, java.lang.String url, java.lang.String blogName, java.util.Map pingbackMetaData, Pingback pingback)` Add a pingback for a given blog ID
`protected java.lang.String` | `getExcerptFromSource(java.lang.String source, java.lang.String targetURI)` Try to extract an excerpt from the source text.
`java.lang.String` | `getName()` Gets the name of API Handler.
`protected java.lang.String` | `getTitleFromSource(java.lang.String source)` Try to find the <title></title> tags from the source text
`java.lang.String` | `ping(java.lang.String sourceURI, java.lang.String targetURI)` Notifies the server that a link has been added to sourceURI, pointing to targetURI.

Methods inherited from class org.blojsom.extension.xmlrpc.handler.APIHandler
`checkXMLRPCPermission, setAuthorizationProvider, setBlog, setEventBroadcaster, setFetcher, setHttpServletRequest, setHttpServletResponse, setProperties, setServletConfig`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### API_NAME

    protected static final java.lang.String API_NAME

See Also:
  Constant Field Values

### PINGBACK_GENERIC_FAULT_CODE

    protected static final int PINGBACK_GENERIC_FAULT_CODE

See Also:
  Constant Field Values

### PINGBACK_SOURCE_URI_NON_EXISTENT_CODE

    protected static final int PINGBACK_SOURCE_URI_NON_EXISTENT_CODE

See Also:
  Constant Field Values

### PINGBACK_NO_LINK_TO_TARGET_URI_CODE

    protected static final int PINGBACK_NO_LINK_TO_TARGET_URI_CODE

See Also:
  Constant Field Values

### PINGBACK_TARGET_URI_NON_EXISTENT_CODE

    protected static final int PINGBACK_TARGET_URI_NON_EXISTENT_CODE

See Also:
  Constant Field Values

### PINGBACK_TARGET_URI_NOT_ENABLED_CODE

    protected static final int PINGBACK_TARGET_URI_NOT_ENABLED_CODE

See Also:
  Constant Field Values

### PINGBACK_ALREADY_REGISTERED_CODE

    protected static final int PINGBACK_ALREADY_REGISTERED_CODE

See Also:
  Constant Field Values

### PINGBACK_ACCESS_DENIED_CODE

    protected static final int PINGBACK_ACCESS_DENIED_CODE

See Also:
  Constant Field Values

### PINGBACK_UPSTREAM_SERVER_ERROR_CODE

    protected static final int PINGBACK_UPSTREAM_SERVER_ERROR_CODE

See Also:
  Constant Field Values

### PINGBACK_SOURCE_URI_METADATA

    protected static final java.lang.String PINGBACK_SOURCE_URI_METADATA

See Also:
  Constant Field Values

### PINGBACK_TARGET_URI_METADATA

    protected static final java.lang.String PINGBACK_TARGET_URI_METADATA

See Also:
  Constant Field Values

Constructor Detail

### PingbackHandler

    public PingbackHandler()

  Construct a new Pingback handler

Method Detail

### getName

    public java.lang.String getName()

  Gets the name of API Handler. Used to bind to XML-RPC

  Specified by:
    `getName` in class `APIHandler`
  Returns:
    The API Name (ie: pingback)

### getTitleFromSource

    protected java.lang.String getTitleFromSource(java.lang.String source)

  Try to find the <title></title> tags from the source text

  Parameters:
    `source` - Source URI text
  Returns:
    Title of text or `null` if title tags are not found

### getExcerptFromSource

    protected java.lang.String getExcerptFromSource(java.lang.String source,
                                                    java.lang.String targetURI)

  Try to extract an excerpt from the source text. Currently looks ahead 200 and ahead 200 characters from the location of the targetURI within the source.

  Parameters:
    `source` - Source URI text
    `targetURI` - Target URI from which to start the excerpt
  Returns:
    Excerpt of text or `null` if we cannot find the targetURI

### ping

    public java.lang.String ping(java.lang.String sourceURI,
                                 java.lang.String targetURI)
                          throws org.apache.xmlrpc.XmlRpcException

  Notifies the server that a link has been added to sourceURI, pointing to targetURI.

  Parameters:
    `sourceURI` - The absolute URI of the post on the source page containing the link to the target site.
    `targetURI` - The absolute URI of the target of the link, as given on the source page.
  Returns:
  Throws:
    `org.apache.xmlrpc.XmlRpcException`

### addPingback

    protected java.lang.Integer addPingback(java.lang.String title,
                                            java.lang.String excerpt,
                                            java.lang.String url,
                                            java.lang.String blogName,
                                            java.util.Map pingbackMetaData,
                                            Pingback pingback)
                                     throws org.apache.xmlrpc.XmlRpcException

  Add a pingback for a given blog ID

  Parameters:
    `title` - Pingback title
    `excerpt` - Pingback excerpt
    `url` - Pingback URL
    `blogName` - Pingback blog name
    `pingbackMetaData` - Pingback meta-data
    `pingback` - `Pingback`
  Returns:
    `0` if the pingback was registered, otherwise a fault code is returned
  Throws:
    `org.apache.xmlrpc.XmlRpcException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD