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.pluginmanager.PluginHTTPException;
import freenet.pluginmanager.PluginRespirator;

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

import freenet.support.api.HTTPRequest;
import freenet.support.Logger;


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


You will have to have the following 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


Fetching

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 WikkaWiki