FreenetWiki : FreenetPluginInterface

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Work in progress please help to update

Starting

List of good imports:
import freenet.pluginmanager.FredPlugin;
import freenet.pluginmanager.FredPluginHTTP;
import freenet.pluginmanager.FredPluginThreadless;

import freenet.client.FetchException;
import freenet.client.FetchResult;
import freenet.client.HighLevelSimpleClient;


Your class must implement the following:
public class MyPlugin implements FredPlugin, FredPluginHTTP, FredPluginThreadless


You will have to have the folliwing functions:
public void runPlugin(PluginRespirator pr) // Make sure to save that pr somewhere, it will be the starting point in interfacing with the node
public void terminate()
public String handleHTTPGet(HTTPRequest request) throws PluginHTTPException // It is ok to return null
public String handleHTTPPost(HTTPRequest request) throws PluginHTTPException // It is ok to return null
public String handleHTTPPut(HTTPRequest request) throws PluginHTTPException // It is ok to return null


Fetcing

You must
# Create an instance of HighLevelSimpleClient from PluginRespirator
HighLevelSimpleClient hlsc = pr.getHLSimpleClient();

# Create an instance of FetchResult
# use hlsc.fetch(new FreenetURI("CHK@...")) to return you your FetchResult
Watch for the FetchException from that function, it can mean that the redirect was encountered, simple test
if(e.newURI != null)
will tell you if the Exception is an actual error
: See also: freenet.pluginmanager.TestPlugin

Inserting

(coming soon)

See also

* HelloWorldPlugin
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.0396 seconds