Update of /cvsroot/freenet/freenet/src/freenet/node/http
In directory sc8-pr-cvs1:/tmp/cvs-serv25857/src/freenet/node/http
Modified Files:
Tag: stable
BookmarkManagerServlet.java DistributionServlet.java
NodeInfoServlet.java
Added Files:
Tag: stable
ColoredPixelServlet.java
Log Message:
5029: Merge from unstable after months of work. MASSIVE changes.
Highlights:
* Next Generation Routing, massive related changes
* Major changes to handling of messages and connections (PeerHandler and related
changes)
* Even more non-blocking I/O
* Documentation improvements
* Lots of new diagnostics and config options
* Lots of bug fixes and performance tweaking
* Probably lots of new bugs too!
--- NEW FILE: ColoredPixelServlet.java ---
/*
* Created on Oct 18, 2003
*
*/
package freenet.node.http;
import java.io.IOException;
import java.io.OutputStream;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import freenet.support.graph.Bitmap;
import freenet.support.graph.BitmapEncoder;
import freenet.support.graph.Color;
import freenet.support.graph.DibEncoder;
/**
* @author Iakin
* Utility servlet. Renders a pixel (sort of, it actually is 2x2 to work
* around with some Mozilla limitation re. 1x1 bmp:s) of the specified color.
* Useful for displaying bars etc. in web pages (use width and height attributes
* in the <IMG> tag to work around the fact that the pixel is 2x2 instead of 1x1)
*/
public class ColoredPixelServlet extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
String sColor = req.getParameter("color");
if(sColor == null || sColor.length() != 6)
throw new ServletException("Invalid color '"+sColor+"'
specified");
int r=Integer.parseInt(sColor.subSequence(0,2).toString(),16);
int g=Integer.parseInt(sColor.subSequence(2,4).toString(),16);
int b=Integer.parseInt(sColor.subSequence(4,6).toString(),16);
Bitmap bmp = new Bitmap(2,2);
bmp.clear(new Color(r,g,b));
BitmapEncoder enc = new DibEncoder();
enc.setBitmap(bmp);
//resp.setContentType(enc.getMimeType()); //This doesn't do it
for the browser..
resp.setContentType("image/bmp");
OutputStream os = resp.getOutputStream();
enc.encode(os);
os.close();
}
}
Index: BookmarkManagerServlet.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/http/BookmarkManagerServlet.java,v
retrieving revision 1.2.2.5
retrieving revision 1.2.2.6
diff -u -w -r1.2.2.5 -r1.2.2.6
--- BookmarkManagerServlet.java 29 Jul 2003 21:08:07 -0000 1.2.2.5
+++ BookmarkManagerServlet.java 28 Oct 2003 20:20:38 -0000 1.2.2.6
@@ -114,7 +114,7 @@
bookmarks = loadDefaultBookmarks();
thisPath = "/servlet/bookmarkmanager";
pendingNewBookmark = null;
- logDEBUG = Core.logger.shouldLog(Logger.DEBUG);
+ logDEBUG = Core.logger.shouldLog(Logger.DEBUG,this);
try {
pageTemplate =
HtmlTemplate.createTemplate("BookmarkManagerServletTmpl.html");
} catch (IOException ioe) {
@@ -132,7 +132,7 @@
private ArrayList loadDefaultBookmarks() {
ArrayList bmks = new ArrayList();
try {
- Params params = new Params(Node.config.getOptions());
+ Params params = new Params(Node.getConfig().getOptions());
if (params != null) {
Option countOpt = params.getOption(BOOKMARK_PATH+".count");
@@ -189,7 +189,7 @@
* @return success/fail message
*/
private String addBookmark(String key, String title, String description, String
activelinkFile) {
- logDEBUG = Core.logger.shouldLog(Logger.DEBUG);
+ logDEBUG = Core.logger.shouldLog(Logger.DEBUG,this);
if (!allowUpdatingBookmarks) {
return "Bookmarks cannot be updated on public nodes";
}
@@ -211,7 +211,7 @@
* @return success/fail message
*/
private String confirmAddBookmark(long secret) {
- logDEBUG = Core.logger.shouldLog(Logger.DEBUG);
+ logDEBUG = Core.logger.shouldLog(Logger.DEBUG,this);
if (!allowUpdatingBookmarks) {
return "Bookmarks cannot be updated on public nodes";
}
@@ -233,7 +233,7 @@
* @return success/fail message
*/
private String removeBookmark(int num, String key) {
- logDEBUG = Core.logger.shouldLog(Logger.DEBUG);
+ logDEBUG = Core.logger.shouldLog(Logger.DEBUG,this);
if (!allowUpdatingBookmarks) {
return "Bookmarks cannot be updated on public nodes";
}
@@ -264,7 +264,7 @@
* @return success/fail message
*/
private String updateBookmark(int num, String key, String newKey, String
newTitle, String newDesc, String newActivelinkFile) {
- logDEBUG = Core.logger.shouldLog(Logger.DEBUG);
+ logDEBUG = Core.logger.shouldLog(Logger.DEBUG,this);
if (!allowUpdatingBookmarks) {
return "Bookmarks cannot be updated on public nodes";
}
@@ -714,7 +714,7 @@
* a.b.c.d and a.b.c.e, fs will contain d and e)
*/
public void configPropertyUpdated(String path, Params fs) {
- logDEBUG = Core.logger.shouldLog(Logger.DEBUG);
+ logDEBUG = Core.logger.shouldLog(Logger.DEBUG,this);
if(logDEBUG)
Core.logger.log(this, "configPropertyUpdated called w/ path [" +
path + "]", Logger.DEBUG);
Index: DistributionServlet.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/http/DistributionServlet.java,v
retrieving revision 1.11.4.12.2.10
retrieving revision 1.11.4.12.2.11
diff -u -w -r1.11.4.12.2.10 -r1.11.4.12.2.11
--- DistributionServlet.java 15 Aug 2003 03:05:49 -0000 1.11.4.12.2.10
+++ DistributionServlet.java 28 Oct 2003 20:20:38 -0000 1.11.4.12.2.11
@@ -75,7 +75,7 @@
private HtmlTemplate pageTmp, titleBoxTmp;
public void init() throws ServletException {
- logDEBUG = Core.logger.shouldLog(Logger.DEBUG);
+ logDEBUG = Core.logger.shouldLog(Logger.DEBUG,this);
Core.logger.log(this, "init()", Logger.DEBUG);
try {
synchronized(staticSync) {
@@ -481,7 +481,7 @@
} else {
if(initDistFiles()) {
byte[] bs = new byte[8];
- node.randSource.nextBytes(bs);
+ node.getRandSource().nextBytes(bs);
String name = Base64.encode(bs);
dp = new DistributionPage(name,
System.currentTimeMillis());
@@ -559,7 +559,7 @@
public static final String[] keys =
{ "[EMAIL PROTECTED],qe6uUARsHatu~gqjoEFsLg", // start-freenet.sh
"[EMAIL PROTECTED],jzDS30pQ53Qjdxn2rMfcfg", // stop-freenet.sh
- "[EMAIL PROTECTED],igcGCARj645d213es4g3Pg", // README
+ "[EMAIL PROTECTED],IouirP0XUEMT20rfM9EGlA", // README
"[EMAIL PROTECTED],CPIgvJUZQb2xm9vdJlPTwg", // preconfig.sh
"[EMAIL PROTECTED],LW77sGa18EkcvHTJd71q0Q", // update.sh
"[EMAIL PROTECTED],plfo5EJ1SVj~vMHYw2PiSQ", // freenet-webinstall.exe
@@ -602,7 +602,7 @@
StringWriter sw = new StringWriter(200);
PrintWriter pw = new PrintWriter(sw);
byte[] bs = new byte[8];
- node.randSource.nextBytes(bs);
+ node.getRandSource().nextBytes(bs);
String name = Base64.encode(bs);
pages.put(name, new DistributionPage(name,
@@ -1108,7 +1108,7 @@
ComparableInteger s;
for (int i = 0 ; i < Math.min(SEEDREFS, size) ; i++) {
do {
- s = new ComparableInteger(node.randSource.nextInt(size));
+ s = new ComparableInteger(node.getRandSource().nextInt(size));
} while(selected.contains(s));
selected.add(s);
}
Index: NodeInfoServlet.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/http/NodeInfoServlet.java,v
retrieving revision 1.25.2.2.2.14
retrieving revision 1.25.2.2.2.15
diff -u -w -r1.25.2.2.2.14 -r1.25.2.2.2.15
--- NodeInfoServlet.java 23 Jul 2003 16:21:13 -0000 1.25.2.2.2.14
+++ NodeInfoServlet.java 28 Oct 2003 20:20:38 -0000 1.25.2.2.2.15
@@ -102,9 +102,9 @@
registerInfolet(internal, new TickerContents());
registerInfolet(internal, new FailureTableInfolet());
registerInfolet(internal, new EnvironmentInfolet());
- if(!Main.publicNode) {
- registerInfolet(internal, new RTInfolet());
- }
+// if(!Main.publicNode) {
+// registerInfolet(internal, new RTInfolet());
+// }
Group docs = new Group("Documentation", "documentation");
registerGroup(docs);
// REDUNDANT registerInfolet(internal, new ThreadFactoryInfolet());
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs