Author: bombe
Date: 2006-08-05 12:30:36 +0000 (Sat, 05 Aug 2006)
New Revision: 9899
Modified:
trunk/freenet/src/freenet/clients/http/HTTPRequest.java
trunk/freenet/src/freenet/clients/http/PageMaker.java
trunk/freenet/src/freenet/clients/http/QueueToadlet.java
trunk/freenet/src/freenet/clients/http/Toadlet.java
trunk/freenet/src/freenet/node/fcp/ClientPut.java
trunk/freenet/src/freenet/node/fcp/ClientPutBase.java
trunk/freenet/src/freenet/node/fcp/ClientPutMessage.java
trunk/freenet/src/freenet/node/fcp/ClientRequest.java
trunk/freenet/src/freenet/node/fcp/FCPServer.java
Log:
add insert file box on queue page
add new constructors for client put (including base)
expose global fcp client from fcp server
add convenience methods in toadlet
fix http request multipart parsing
Modified: trunk/freenet/src/freenet/clients/http/HTTPRequest.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/HTTPRequest.java 2006-08-05
10:59:41 UTC (rev 9898)
+++ trunk/freenet/src/freenet/clients/http/HTTPRequest.java 2006-08-05
12:30:36 UTC (rev 9899)
@@ -61,6 +61,9 @@
*/
private HashMap parts;
+ /** A map for uploaded files. */
+ private Map uploadedFiles = new HashMap();
+
private final BucketFactory bucketfactory;
/**
@@ -438,33 +441,45 @@
Bucket filedata = null;
String name = null;
+ String filename = null;
+ String contentType = null;
while(is.available() > 0) {
name = null;
+ filename = null;
+ contentType = null;
// chomp headers
- while( (line = lis.readLine(100, 100, false)) /* see
above */ != null) {
+ while( (line = lis.readLine(200, 200, false)) /* see
above */ != null) {
if (line.length() == 0) break;
String[] lineparts = line.split(":");
if (lineparts == null) continue;
String hdrname = lineparts[0].trim();
- if (lineparts.length < 2) continue;
- String[] valueparts = lineparts[1].split(";");
-
- for (int i = 0; i < valueparts.length; i++) {
- String[] subparts =
valueparts[i].split("=");
- if (subparts.length != 2) {
- continue;
- }
- if
(hdrname.equalsIgnoreCase("Content-Disposition")) {
- if
(subparts[0].trim().equalsIgnoreCase("name")) {
- name =
subparts[1].trim();
- if (name.charAt(0) ==
'"') name = name.substring(1);
- if
(name.charAt(name.length() - 1) == '"')
- name =
name.substring(0, name.length() - 1);
+ if
(hdrname.equalsIgnoreCase("Content-Disposition")) {
+ if (lineparts.length < 2) continue;
+ String[] valueparts =
lineparts[1].split(";");
+
+ for (int i = 0; i < valueparts.length;
i++) {
+ String[] subparts =
valueparts[i].split("=");
+ if (subparts.length != 2) {
+ continue;
}
+ String fieldname =
subparts[0].trim();
+ String value =
subparts[1].trim();
+ if (value.startsWith("\"") &&
value.endsWith("\"")) {
+ value =
value.substring(1, value.length() - 1);
+ }
+ if
(fieldname.equalsIgnoreCase("name")) {
+ name = value;
+ } else if
(fieldname.equalsIgnoreCase("filename")) {
+ filename = value;
+ }
}
+ } else if
(hdrname.equalsIgnoreCase("Content-Type")) {
+ contentType = lineparts[1].trim();
+ } else {
+
}
}
@@ -480,7 +495,7 @@
byte[] buf = new byte[boundary.length()];
byte[] bbound = boundary.getBytes("UTF-8");
int offset = 0;
- while ((is.available() > 0) && !boundary.equals(new
String(buf))) {
+ while ((is.available() > 0) && (offset < buf.length)) {
byte b = (byte)is.read();
if (b == bbound[offset]) {
@@ -499,9 +514,16 @@
bucketos.close();
this.parts.put(name, filedata);
+ if (filename != null) {
+ this.uploadedFiles.put(name, new File(filename,
contentType, filedata));
+ }
}
}
+ public File getUploadedFile(String name) {
+ return (File) uploadedFiles.get(name);
+ }
+
public Bucket getPart(String name) {
return (Bucket)this.parts.get(name);
}
@@ -551,4 +573,68 @@
return defaultValue;
}
}
+
+ /**
+ * Container for uploaded files in HTTP POST requests.
+ *
+ * @author David 'Bombe' Roden <bombe at freenetproject.org>
+ * @version $Id$
+ */
+ public static class File {
+
+ /** The filename. */
+ private final String filename;
+
+ /** The content type. */
+ private final String contentType;
+
+ /** The data. */
+ private final Bucket data;
+
+ /**
+ * Creates a new file with the specified filename, content
type, and
+ * data.
+ *
+ * @param filename
+ * The name of the file
+ * @param contentType
+ * The content type of the file
+ * @param data
+ * The data of the file
+ */
+ public File(String filename, String contentType, Bucket data) {
+ this.filename = filename;
+ this.contentType = contentType;
+ this.data = data;
+ }
+
+ /**
+ * Returns the content type of the file.
+ *
+ * @return The content type of the file
+ */
+ public String getContentType() {
+ return contentType;
+ }
+
+ /**
+ * Returns the data of the file.
+ *
+ * @return The data of the file
+ */
+ public Bucket getData() {
+ return data;
+ }
+
+ /**
+ * Returns the name of the file.
+ *
+ * @return The name of the file
+ */
+ public String getFilename() {
+ return filename;
+ }
+
+ }
+
}
Modified: trunk/freenet/src/freenet/clients/http/PageMaker.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PageMaker.java 2006-08-05
10:59:41 UTC (rev 9898)
+++ trunk/freenet/src/freenet/clients/http/PageMaker.java 2006-08-05
12:30:36 UTC (rev 9899)
@@ -19,10 +19,10 @@
public class PageMaker {
private static final String DEFAULT_THEME = "clean";
- public String theme;
+ private String theme;
/** Cache for themes read from the JAR file. */
- public List jarThemesCache = null;
+ private List jarThemesCache = null;
PageMaker(String t) {
if (t == null) {
Modified: trunk/freenet/src/freenet/clients/http/QueueToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/QueueToadlet.java 2006-08-05
10:59:41 UTC (rev 9898)
+++ trunk/freenet/src/freenet/clients/http/QueueToadlet.java 2006-08-05
12:30:36 UTC (rev 9899)
@@ -12,14 +12,16 @@
import freenet.client.HighLevelSimpleClient;
import freenet.keys.FreenetURI;
+import freenet.node.Node;
+import freenet.node.RequestStarter;
import freenet.node.fcp.ClientGet;
import freenet.node.fcp.ClientPut;
import freenet.node.fcp.ClientPutDir;
+import freenet.node.fcp.ClientPutMessage;
import freenet.node.fcp.ClientRequest;
import freenet.node.fcp.FCPServer;
+import freenet.node.fcp.IdentifierCollisionException;
import freenet.node.fcp.MessageInvalidException;
-import freenet.node.Node;
-import freenet.node.RequestStarter;
import freenet.support.HTMLDecoder;
import freenet.support.HTMLEncoder;
import freenet.support.Logger;
@@ -43,14 +45,17 @@
}
public void handlePost(URI uri, Bucket data, ToadletContext ctx) throws
ToadletContextClosedException, IOException, RedirectException {
- if(data.size() > 1024*1024) {
+ HTTPRequest request = new HTTPRequest(uri, data, ctx);
+ if ((data.size() > 1024 * 1024) &&
(request.getPartAsString("insert", 128).length() == 0)) {
this.writeReply(ctx, 400, "text/plain", "Too big",
"Data exceeds 1MB limit");
return;
}
- HTTPRequest request = new HTTPRequest(uri, data, ctx);
-
+
String pass = request.getParam("formPassword");
- if((pass == null) || !pass.equals(node.formPassword)) {
+ if (pass.length() == 0) {
+ pass = request.getPartAsString("formPassword", 128);
+ }
+ if ((pass.length() == 0) || !pass.equals(node.formPassword)) {
MultiValueTable headers = new MultiValueTable();
headers.put("Location", "/queue/");
ctx.sendReplyHeaders(302, "Found", headers, null, 0);
@@ -86,7 +91,7 @@
}else if(request.isParameterSet("download")) {
// Queue a download
if(!request.isParameterSet("key")) {
- writeError("No key specified to download", "No
key specified to download");
+ writeError("No key specified to download", "You
did not specify a key to download.", ctx);
return;
}
String expectedMIMEType = null;
@@ -97,7 +102,7 @@
try {
fetchURI = new
FreenetURI(HTMLDecoder.decode(request.getParam("key")));
} catch (MalformedURLException e) {
- writeError("Invalid URI to download", "Invalid
URI to download");
+ writeError("Invalid URI to download", "The URI
is invalid and can not be downloaded.", ctx);
return;
}
String persistence = request.getParam("persistence");
@@ -117,13 +122,46 @@
}
writePermanentRedirect(ctx, "Done", "/queue/");
return;
+ } else if (request.getPartAsString("insert", 128).length() > 0)
{
+ FreenetURI insertURI;
+ String keyType = request.getPartAsString("keytype", 3);
+ if ("chk".equals(keyType)) {
+ insertURI = new FreenetURI("CHK@");
+ } else if ("ksk".equals(keyType)) {
+ try {
+ insertURI = new
FreenetURI(request.getPartAsString("key", 128));
+ } catch (MalformedURLException mue1) {
+ writeError("Invalid URI to insert",
"You did not specify a valid URI to insert the file to.", ctx);
+ return;
+ }
+ } else {
+ writeError("Invalid URI to insert", "You fooled
around with the POST request. Shame on you.", ctx);
+ return;
+ }
+ boolean dontCompress =
request.getPartAsString("dontCompress", 128).length() > 0;
+ HTTPRequest.File file =
request.getUploadedFile("filename");
+ String identifier = file.getFilename() + "-fred-" +
System.currentTimeMillis();
+ try {
+ ClientPut clientPut = new
ClientPut(fcp.getGlobalClient(), insertURI, identifier, Integer.MAX_VALUE,
RequestStarter.BULK_SPLITFILE_PRIORITY_CLASS, ClientRequest.PERSIST_FOREVER,
null, false, dontCompress, -1, ClientPutMessage.UPLOAD_FROM_DIRECT, new
File(file.getFilename()), file.getContentType(), file.getData(), null);
+ clientPut.start();
+ fcp.forceStorePersistentRequests();
+ } catch (IdentifierCollisionException e) {
+ e.printStackTrace();
+ }
+ writePermanentRedirect(ctx, "Done", "/queue/");
+ return;
}
this.handleGet(uri, ctx);
}
- private void writeError(String string, String string2) {
- // TODO Auto-generated method stub
-
+ private void writeError(String string, String string2, ToadletContext
context) throws ToadletContextClosedException, IOException {
+ StringBuffer buffer = new StringBuffer();
+ context.getPageMaker().makeHead(buffer, "Error processing
request");
+ writeBigHeading(string, buffer, null);
+ buffer.append(string2);
+ writeBigEnding(buffer);
+ context.getPageMaker().makeTail(buffer);
+ writeReply(context, 400, "text/html; charset=utf-8", "Error",
buffer.toString());
}
public void handleGet(URI uri, ToadletContext ctx)
@@ -166,6 +204,7 @@
buf.append("</form>\n");
buf.append("</div>\n");
buf.append("</div>\n");
+ writeInsertBox(buf);
ctx.getPageMaker().makeTail(buf);
writeReply(ctx, 200, "text/html", "OK", buf.toString());
return;
@@ -235,6 +274,8 @@
node.alerts.toSummaryHtml(buf);
+ writeInsertBox(buf);
+
writeBigHeading("Legend", buf, "legend");
buf.append("<table class=\"queue\">\n");
buf.append("<tr>");
@@ -609,11 +650,11 @@
private void writePriorityCell(String identifier, short priorityClass,
StringBuffer buf) {
buf.append("<td class=\"nowrap\">");
buf.append("<form action=\"/queue/\" method=\"post\">");
- buf.append("<input type=\"hidden\" name=\"formPassword\"
value=\"").append(node.formPassword).append("\">");
- buf.append("<input type=\"hidden\" name=\"identifier\"
value=\"").append(HTMLEncoder.encode(identifier)).append("\">");
+ buf.append("<input type=\"hidden\" name=\"formPassword\"
value=\"").append(node.formPassword).append("\" />");
+ buf.append("<input type=\"hidden\" name=\"identifier\"
value=\"").append(HTMLEncoder.encode(identifier)).append("\" />");
buf.append("<select name=\"priority\">");
for (int p = 0; p < RequestStarter.NUMBER_OF_PRIORITY_CLASSES;
p++) {
- buf.append("<option name=\"priority\"
value=\"").append(p);
+ buf.append("<option value=\"").append(p);
if (p == priorityClass) {
buf.append("\" selected=\"selected");
}
@@ -630,10 +671,10 @@
private void writeDeleteCell(ClientRequest p, StringBuffer buf) {
buf.append("<td>");
buf.append("<form action=\"/queue/\" method=\"post\">");
- buf.append("<input type=\"hidden\" name=\"formPassword\"
value=\""+node.formPassword+"\">");
+ buf.append("<input type=\"hidden\" name=\"formPassword\"
value=\""+node.formPassword+"\" />");
buf.append("<input type=\"hidden\" name=\"identifier\"
value=\"");
buf.append(HTMLEncoder.encode(p.getIdentifier()));
- buf.append("\"><input type=\"submit\" name=\"remove_request\"
value=\"Delete\">");
+ buf.append("\" /><input type=\"submit\" name=\"remove_request\"
value=\"Delete\" />");
buf.append("</form>\n");
buf.append("</td>\n");
}
@@ -641,8 +682,8 @@
private void writeDeleteAll(StringBuffer buf) {
buf.append("<td>");
buf.append("<form action=\"/queue/\" method=\"post\">");
- buf.append("<input type=\"hidden\" name=\"formPassword\"
value=\""+node.formPassword+"\">");
- buf.append("<input type=\"submit\" name=\"remove_AllRequests\"
value=\"Delete Everything\">");
+ buf.append("<input type=\"hidden\" name=\"formPassword\"
value=\""+node.formPassword+"\" />");
+ buf.append("<input type=\"submit\" name=\"remove_AllRequests\"
value=\"Delete Everything\" />");
buf.append("</form>\n");
buf.append("</td>\n");
}
@@ -751,6 +792,25 @@
buf.append("</div>\n");
buf.append("</div>\n");
}
+
+ private void writeInsertBox(StringBuffer buf) {
+ /* the insert file box */
+ buf.append("<div class=\"infobox\">");
+ buf.append("<div class=\"infobox-header\">Insert File</div>");
+ buf.append("<div class=\"infobox-content\">");
+ buf.append("<form action=\".\" method=\"post\"
enctype=\"multipart/form-data\">");
+ buf.append("<input type=\"hidden\" name=\"formPassword\"
value=\"").append(node.formPassword).append("\" />");
+ buf.append("Insert as: <input type=\"radio\" name=\"keytype\"
value=\"chk\" checked /> CHK ");
+ buf.append("<input type=\"radio\" name=\"keytype\"
value=\"ksk\" /> KSK ");
+ buf.append("<input type=\"text\" name=\"key\" value=\"KSK@\" />
");
+ buf.append("File: <input type=\"file\" name=\"filename\"
value=\"\" /> ");
+ buf.append("<input type=\"checkbox\" name=\"dontCompress\" />
Don’t Compress ");
+ buf.append("<input type=\"submit\" name=\"insert\"
value=\"Insert File\" /> ");
+ buf.append("<input type=\"reset\" value=\"Reset Form\" />");
+ buf.append("</form>");
+ buf.append("</div>");
+ buf.append("</div>\n");
+ }
public String supportedMethods() {
return "GET, POST";
Modified: trunk/freenet/src/freenet/clients/http/Toadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/Toadlet.java 2006-08-05 10:59:41 UTC
(rev 9898)
+++ trunk/freenet/src/freenet/clients/http/Toadlet.java 2006-08-05 12:30:36 UTC
(rev 9899)
@@ -131,16 +131,28 @@
* Client calls to write a reply to the HTTP requestor.
*/
protected void writeReply(ToadletContext ctx, int code, String
mimeType, String desc, Bucket data) throws ToadletContextClosedException,
IOException {
- ctx.sendReplyHeaders(code, desc, null, mimeType, data.size());
- ctx.writeData(data);
+ writeReply(ctx, code, mimeType, desc, null, data);
}
+
+ protected void writeReply(ToadletContext context, int code, String
mimeType, String desc, MultiValueTable headers, Bucket data) throws
ToadletContextClosedException, IOException {
+ context.sendReplyHeaders(code, desc, headers, mimeType,
data.size());
+ context.writeData(data);
+ }
protected void writeReply(ToadletContext ctx, int code, String
mimeType, String desc, String reply) throws ToadletContextClosedException,
IOException {
- byte[] buf = reply.getBytes("UTF-8");
- ctx.sendReplyHeaders(code, desc, null, mimeType, buf.length);
- ctx.writeData(buf, 0, buf.length);
+ writeReply(ctx, code, mimeType, desc, null, reply);
}
+ protected void writeReply(ToadletContext context, int code, String
mimeType, String desc, MultiValueTable headers, String reply) throws
ToadletContextClosedException, IOException {
+ byte[] buffer = reply.getBytes("UTF-8");
+ writeReply(context, code, mimeType, desc, headers, buffer, 0,
buffer.length);
+ }
+
+ protected void writeReply(ToadletContext context, int code, String
mimeType, String desc, MultiValueTable headers, byte[] buffer, int startIndex,
int length) throws ToadletContextClosedException, IOException {
+ context.sendReplyHeaders(code, desc, headers, mimeType, length);
+ context.writeData(buffer, startIndex, length);
+ }
+
protected void writePermanentRedirect(ToadletContext ctx, String msg,
String location) throws ToadletContextClosedException, IOException {
MultiValueTable mvt = new MultiValueTable();
mvt.put("Location", location);
Modified: trunk/freenet/src/freenet/node/fcp/ClientPut.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientPut.java 2006-08-05 10:59:41 UTC
(rev 9898)
+++ trunk/freenet/src/freenet/node/fcp/ClientPut.java 2006-08-05 12:30:36 UTC
(rev 9899)
@@ -30,6 +30,94 @@
/** We store the size of inserted data before freeing it */
private long finishedSize;
+ /**
+ * Creates a new persistent insert.
+ *
+ * @param uri
+ * The URI to insert data to
+ * @param identifier
+ * The identifier of the insert
+ * @param verbosity
+ * The verbosity bitmask
+ * @param handler
+ * The FCP connection handler
+ * @param priorityClass
+ * The priority for this insert
+ * @param persistenceType
+ * The persistence type of this insert
+ * @param clientToken
+ * The client token of this insert
+ * @param global
+ * Whether this insert appears on the global queue
+ * @param getCHKOnly
+ * Whether only the resulting CHK is requested
+ * @param dontCompress
+ * Whether the file should not be compressed
+ * @param maxRetries
+ * The maximum number of retries
+ * @param uploadFromType
+ * Where the file is uploaded from
+ * @param origFilename
+ * The original filename
+ * @param contentType
+ * The content type of the data
+ * @param data
+ * The data (may be <code>null</code> if
+ * <code>uploadFromType</code> is UPLOAD_FROM_DISK or
+ * UPLOAD_FROM_REDIRECT)
+ * @param redirectTarget
+ * The URI to redirect to (if <code>uploadFromType</code> is
+ * UPLOAD_FROM_REDIRECT)
+ * @throws IdentifierCollisionException
+ */
+ public ClientPut(FCPClient globalClient, FreenetURI uri, String
identifier, int verbosity,
+ short priorityClass, short persistenceType, String
clientToken, boolean getCHKOnly,
+ boolean dontCompress, int maxRetries, short
uploadFromType, File origFilename, String contentType,
+ Bucket data, FreenetURI redirectTarget) throws
IdentifierCollisionException {
+ super(uri, identifier, verbosity, null, globalClient,
priorityClass, persistenceType, null, true, getCHKOnly, dontCompress,
maxRetries);
+ this.uploadFrom = uploadFromType;
+ this.origFilename = origFilename;
+ // Now go through the fields one at a time
+ String mimeType = contentType;
+ this.clientToken = clientToken;
+ if(persistenceType != PERSIST_CONNECTION)
+ client.register(this, false);
+ Bucket tempData = data;
+ ClientMetadata cm = new ClientMetadata(mimeType);
+ boolean isMetadata = false;
+ Logger.minor(this, "data = "+tempData+", uploadFrom =
"+ClientPutMessage.uploadFromString(uploadFrom));
+ if(uploadFrom == ClientPutMessage.UPLOAD_FROM_REDIRECT) {
+ this.targetURI = redirectTarget;
+ Metadata m = new Metadata(Metadata.SIMPLE_REDIRECT,
targetURI, cm);
+ cm = null;
+ byte[] d;
+ try {
+ d = m.writeToByteArray();
+ } catch (MetadataUnresolvedException e) {
+ // Impossible
+ Logger.error(this, "Impossible: "+e, e);
+ onFailure(new
InserterException(InserterException.INTERNAL_ERROR, "Impossible: "+e+" in
ClientPut", null), null);
+ this.data = null;
+ clientMetadata = null;
+ inserter = null;
+ return;
+ }
+ tempData = new SimpleReadOnlyArrayBucket(d);
+ isMetadata = true;
+ } else
+ targetURI = null;
+ this.data = tempData;
+ this.clientMetadata = cm;
+ Logger.minor(this, "data = "+data+", uploadFrom =
"+ClientPutMessage.uploadFromString(uploadFrom));
+ inserter = new ClientPutter(this, data, uri, cm,
+ ctx, client.node.chkPutScheduler,
client.node.sskPutScheduler, priorityClass,
+ getCHKOnly, isMetadata, client, null);
+ if(persistenceType != PERSIST_CONNECTION) {
+ FCPMessage msg = persistentTagMessage();
+ client.queueClientRequestMessage(msg, 0);
+ }
+ }
+
public ClientPut(FCPConnectionHandler handler, ClientPutMessage
message) throws IdentifierCollisionException {
super(message.uri, message.identifier, message.verbosity,
handler,
message.priorityClass, message.persistenceType,
message.clientToken, message.global,
Modified: trunk/freenet/src/freenet/node/fcp/ClientPutBase.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientPutBase.java 2006-08-05
10:59:41 UTC (rev 9898)
+++ trunk/freenet/src/freenet/node/fcp/ClientPutBase.java 2006-08-05
12:30:36 UTC (rev 9899)
@@ -59,6 +59,17 @@
ctx.maxInsertRetries = maxRetries;
}
+ public ClientPutBase(FreenetURI uri, String identifier, int verbosity,
FCPConnectionHandler handler,
+ FCPClient client, short priorityClass, short
persistenceType, String clientToken, boolean global,
+ boolean getCHKOnly, boolean dontCompress, int
maxRetries) {
+ super(uri, identifier, verbosity, handler, client,
priorityClass, persistenceType, clientToken, global);
+ this.getCHKOnly = getCHKOnly;
+ ctx = new InserterContext(client.defaultInsertContext, new
SimpleEventProducer(), persistenceType == ClientRequest.PERSIST_CONNECTION);
+ ctx.dontCompress = dontCompress;
+ ctx.eventProducer.addEventListener(this);
+ ctx.maxInsertRetries = maxRetries;
+ }
+
public ClientPutBase(SimpleFieldSet fs, FCPClient client2) throws
MalformedURLException {
super(fs, client2);
getCHKOnly = Fields.stringToBool(fs.get("CHKOnly"), false);
Modified: trunk/freenet/src/freenet/node/fcp/ClientPutMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientPutMessage.java 2006-08-05
10:59:41 UTC (rev 9898)
+++ trunk/freenet/src/freenet/node/fcp/ClientPutMessage.java 2006-08-05
12:30:36 UTC (rev 9899)
@@ -52,9 +52,9 @@
final boolean global;
final FreenetURI redirectTarget;
- static final short UPLOAD_FROM_DIRECT = 0;
- static final short UPLOAD_FROM_DISK = 1;
- static final short UPLOAD_FROM_REDIRECT = 2;
+ public static final short UPLOAD_FROM_DIRECT = 0;
+ public static final short UPLOAD_FROM_DISK = 1;
+ public static final short UPLOAD_FROM_REDIRECT = 2;
public ClientPutMessage(SimpleFieldSet fs) throws
MessageInvalidException {
identifier = fs.get("Identifier");
Modified: trunk/freenet/src/freenet/node/fcp/ClientRequest.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientRequest.java 2006-08-05
10:59:41 UTC (rev 9898)
+++ trunk/freenet/src/freenet/node/fcp/ClientRequest.java 2006-08-05
12:30:36 UTC (rev 9899)
@@ -110,9 +110,9 @@
// Persistence
- static final short PERSIST_CONNECTION = 0;
- static final short PERSIST_REBOOT = 1;
- static final short PERSIST_FOREVER = 2;
+ public static final short PERSIST_CONNECTION = 0;
+ public static final short PERSIST_REBOOT = 1;
+ public static final short PERSIST_FOREVER = 2;
public static String persistenceTypeString(short type) {
switch(type) {
Modified: trunk/freenet/src/freenet/node/fcp/FCPServer.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPServer.java 2006-08-05 10:59:41 UTC
(rev 9898)
+++ trunk/freenet/src/freenet/node/fcp/FCPServer.java 2006-08-05 12:30:36 UTC
(rev 9899)
@@ -694,4 +694,14 @@
canStartPersister = true;
}
+
+ /**
+ * Returns the global FCP client.
+ *
+ * @return The global FCP client
+ */
+ public FCPClient getGlobalClient() {
+ return globalClient;
+ }
+
}