created mirror

This commit is contained in:
whatever
2026-09-14 20:19:29 -04:00
commit 6764738d92
600 changed files with 87187 additions and 0 deletions

View File

@@ -0,0 +1,144 @@
/*
VCServlet.java
*
* Copyright (c) 2001, Ted Nelson and Tuomas Lukka
*
* You may use and distribute under the terms of either the GNU Lesser
* General Public License, either version 2 of the license or,
* at your choice, any later version. Alternatively, you may use and
* distribute under the terms of the XPL.
*
* See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of
* the licenses.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the README
* file for more details.
*
*/
/*
* Written by Tuomas Lukka
*/
package org.gzigzag.module;
import org.gzigzag.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
/** A Virtual Community demo servlet.
*/
public class VCServlet extends ZZServlet {
public static final String rcsid = "$Id: VCServlet.java,v 1.2 2001/02/28 03:02:56 tjl Exp $";
String getURL(ZZCell c) {
return "org.gzigzag.module.VCServlet?"+c.getID();
}
void printAuthor(ZZCell txt, PrintWriter wr) {
ZZCell h = txt.h("d.author", true);
if(h != null) {
wr.print("<a style=\"color: #FF0000;\" href=\""+getURL(h)
+"\">"+h.getText()+"</a>");
}
}
void printmsg(ZZCell h, PrintWriter wr) {
printAuthor(h, wr);
wr.print(": ");
wr.print("<a href=\""+getURL(h) + "\">"+ h.getText() + "</a>");
}
void printRefs(ZZCell thing, PrintWriter wr) {
wr.print("<p>Referenced in: <ul>");
while((thing = thing.s("d.kahva")) != null) {
ZZCell h = thing.h("d.text");
wr.print("<li>");
printmsg(h, wr);
}
wr.print("</ul>\n");
}
void printAuthored(ZZCell thing, PrintWriter wr) {
wr.print("<p>Messages written: <ul>");
while((thing = thing.s("d.author")) != null) {
ZZCell h = thing.h("d.text");
wr.print("<li>");
wr.print("<a href=\""+getURL(h) + "\">"+ h.getText() + "</a>");
}
wr.print("</ul>\n");
}
void printReplies(ZZCell thing, PrintWriter wr) {
thing = thing.s("d.replies");
if(thing == null) return;
wr.print("<p>Replies: <ul>");
while((thing = thing.s("d.replies-list")) != null) {
ZZCell h = thing.h("d.text");
wr.print("<li>");
printmsg(h, wr);
}
wr.print("</ul>\n");
}
void printText(ZZCell start, PrintWriter wr) {
wr.print("<h1>"+start.getText()+"</h1>");
ZZCell im = start.h("d.images", true);
if(im != null) {
wr.print("<img src=\""+im.getText()+"\">");
}
printAuthor(start, wr);
wr.print("<p>");
ZZCell orig = start;
while((start = start.s("d.text")) != null) {
ZZCell h = start.h("d.kahva", true);
String txt = start.getText();
if(h != null) {
txt = "<a href=\""+getURL(h) + "\">"+ txt + "</a>";
}
wr.print(txt);
}
if(orig.s("d.author", -1) == null)
printAuthored(orig, wr);
ZZCell inreply = orig.h("d.replies-list").s("d.replies",-1);
if(inreply != null) {
wr.print("<p>In reply to ");
printmsg(inreply, wr);
}
printReplies(orig, wr);
printRefs(orig, wr);
}
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException {
try {
synchronized(space) {
// resp.getWriter().print("HELLO\n\n!!\n\n");
String s = req.getQueryString();
PrintWriter wr = resp.getWriter();
wr.print("HELLO\n\n!!\n\n Query: '"+s+"'\n");
ZZCell c;
if(s == null || s.equals(""))
c = space.getHomeCell().s("d.1");
else
c = space.getCellByID(s);
wr.print("<br>Cell content: '"+c.getText()+"'\n");
printText(c, wr);
wr.close();
}
} catch(Exception e) {
throw new ServletException("doGet: ", e);
}
}
}

View File

@@ -0,0 +1,78 @@
/*
ZZServlet.java
*
* Copyright (c) 2001, Ted Nelson and Tuomas Lukka
*
* You may use and distribute under the terms of either the GNU Lesser
* General Public License, either version 2 of the license or,
* at your choice, any later version. Alternatively, you may use and
* distribute under the terms of the XPL.
*
* See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of
* the licenses.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the README
* file for more details.
*
*/
/*
* Written by Tuomas Lukka
*/
package org.gzigzag.module;
import org.gzigzag.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
/** A base class for servlets based on ZZ spaces.
*/
public class ZZServlet extends HttpServlet {
public static final String rcsid = "$Id: ZZServlet.java,v 1.1 2001/01/17 14:27:20 tjl Exp $";
static Hashtable spaces = new Hashtable();
static Object lock = new Object();
static ZZSpace getSpace(String name) {
synchronized(lock) {
ZZSpace s = (ZZSpace)spaces.get(name);
if(s == null) {
File f = new File(name);
s = new ZZCacheDimSpace(new DirStreamSet(f));
spaces.put(name, s);
}
return s;
}
}
ZZSpace space;
public void init(ServletConfig config) throws ServletException {
synchronized(lock) {
String s = config.getInitParameter("space");
if(s == null) {
// throw new ServletException("No space specified!");
s = "/tmp/testspace";
}
space = getSpace(s);
}
}
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException {
try {
synchronized(space) {
resp.getWriter().print("HELLO\n\n!!\n\n");
}
} catch(Exception e) {
throw new ServletException("doGet: ", e);
}
}
}

View File

@@ -0,0 +1,4 @@
#!/bin/sh
# java com.mortbay.HTTP.Configure.ServletServer 8080 . .
java com.mortbay.Jetty.Server ../Modules/servlet/zzserv2.prp

View File

@@ -0,0 +1,42 @@
*.CLASS : com.mortbay.HTTP.HttpServer
*.LISTENER.*.CLASS : com.mortbay.HTTP.HttpListener
*.*.Log.CLASS : com.mortbay.HTTP.Handler.LogHandler
*.*.Auth.CLASS : com.mortbay.HTTP.Handler.BasicAuthHandler
*.*.Alias.CLASS : com.mortbay.HTTP.Handler.TranslateHandler
*.*.Filter.CLASS : com.mortbay.HTTP.Handler.FilterHandler
*.*.Html.CLASS : com.mortbay.HTTP.Filter.HtmlFilter
*.*.Param.CLASS : com.mortbay.HTTP.Handler.ParamHandler
*.*.Session.CLASS : com.mortbay.HTTP.Handler.SessionHandler
*.*.Servlet.CLASS : com.mortbay.HTTP.Handler.ServletHandler
*.*.File.CLASS : com.mortbay.HTTP.Handler.FileHandler
*.*.Forward.CLASS : com.mortbay.HTTP.Handler.ForwardHandler
*.*.NotFound.CLASS : com.mortbay.HTTP.Handler.NotFoundHandler
*.*.Proxy.CLASS : com.mortbay.HTTP.Handler.ProxyHandler
*.*.DefaultEx.CLASS : com.mortbay.HTTP.Handler.DefaultExceptionHandler
*.*.TerseEx.CLASS : com.mortbay.HTTP.Handler.TerseExceptionHandler
*.*.ZZServer.CLASS : org.gzigzag.module.ZZServlet
*.*.Servlet.PROPERTY.SERVLET.ZZServer.CLASS : org.gzigzag.module.ZZServlet
*.*.Servlet.PROPERTY.SERVLET.ZZServer.PROPERTY.space : /home/tjl/tspc
*.*.Servlet.PROPERTY.CLASSPATH : /home/tjl/gzigzag/Java/org/gzigzag:/home/tjl/gzigzag/Java/org/gzigzag/module:/home/tjl/gzigzag/Java/
SERVERS : main
main.root.PATHS : /
main.LISTENER.all.ADDRS : 0.0.0.0:8080;127.0.0.1:8888
main.LISTENERS : all
main.STACKS : root
main.root.HANDLERS : Servlet;NotFound
*.*.Servlet.PROPERTY.PATHS : /
*.*.Servlet.PROPERTY.Loader : com.mortbay.HTTP.Handler.FileJarServletLoader
*.*.Servlet.PROPERTY.AutoReloadDynamicServlets : True
*.*.Servlet.PROPERTY.SERVLET.*.Initialize : False
*.*.Servlet.PROPERTY.SERVLET.Dump.Initialize : True
*.*.Filter.PROPERTY.Html.CLASS : com.mortbay.HTTP.Filter.HtmlFilter

205
Modules/servlet/zzserv2.prp Normal file
View File

@@ -0,0 +1,205 @@
# ========================================================================
# Abbreviated Configuration file for com.mortbay.Jetty.Demo
#
# The format of this file is parsed by the com.mortbay.Util.PropertyTree
# class and interpreted by the com.mortbay.Jetty.Server class to
# construct, configure and start 1 or more HttpServer instances.
#
# This configuration file is abbrevited using the features of
# com.mortbay.Util.PropertyTree. It can be run with the command
# java com.mortbay.Jetty.Server etc/JettyMinimalDemo.prp
#
# A none abbreviated version of this configuration can be seen in
# JettyDemo.prp and associated files
# ------------------------------------------------------------------------
# ========================================================================
# Default CLASS definitions
# ------------------------------------------------------------------------
*.CLASS : com.mortbay.HTTP.HttpServer
*.LISTENER.*.CLASS : com.mortbay.HTTP.HttpListener
*.*.Log.CLASS : com.mortbay.HTTP.Handler.LogHandler
*.*.Auth.CLASS : com.mortbay.HTTP.Handler.BasicAuthHandler
*.*.Alias.CLASS : com.mortbay.HTTP.Handler.TranslateHandler
*.*.Filter.CLASS : com.mortbay.HTTP.Handler.FilterHandler
*.*.Html.CLASS : com.mortbay.HTTP.Filter.HtmlFilter
*.*.Param.CLASS : com.mortbay.HTTP.Handler.ParamHandler
*.*.Session.CLASS : com.mortbay.HTTP.Handler.SessionHandler
*.*.Servlet.CLASS : com.mortbay.HTTP.Handler.ServletHandler
*.*.File.CLASS : com.mortbay.HTTP.Handler.FileHandler
*.*.Forward.CLASS : com.mortbay.HTTP.Handler.ForwardHandler
*.*.NotFound.CLASS : com.mortbay.HTTP.Handler.NotFoundHandler
*.*.Proxy.CLASS : com.mortbay.HTTP.Handler.ProxyHandler
*.*.DefaultEx.CLASS : com.mortbay.HTTP.Handler.DefaultExceptionHandler
*.*.TerseEx.CLASS : com.mortbay.HTTP.Handler.TerseExceptionHandler
# ========================================================================
# Default Servlet CLASS definitions
# ------------------------------------------------------------------------
*.*.Servlet.PROPERTY.SERVLET.Dump.CLASS : com.mortbay.Servlets.Dump
*.*.Servlet.PROPERTY.SERVLET.Exit.CLASS : com.mortbay.Servlets.Exit
*.*.Servlet.PROPERTY.SERVLET.Session.CLASS : com.mortbay.Servlets.SessionDump
*.*.Servlet.PROPERTY.SERVLET.PropertyTree.CLASS: com.mortbay.Servlets.PropertyTreeEditor
*.*.Servlet.PROPERTY.SERVLET.Config.CLASS : com.mortbay.Servlets.ConfigDump
*.*.Servlet.PROPERTY.SERVLET.Debug.CLASS : com.mortbay.Servlets.DebugServlet
*.*.Servlet.PROPERTY.SERVLET.Laf.CLASS : com.mortbay.Servlets.LookAndFeelServlet
# ========================================================================
# Default ServletHandler Properties
# ------------------------------------------------------------------------
*.*.Servlet.PROPERTY.PATHS : /servlet/;/SERVLET/;/Servlet/
*.*.Servlet.PROPERTY.CLASSPATH : ./servlets
*.*.Servlet.PROPERTY.Loader : com.mortbay.HTTP.Handler.FileJarServletLoader
*.*.Servlet.PROPERTY.AutoReloadDynamicServlets : True
*.*.Servlet.PROPERTY.SERVLET.*.Initialize : False
*.*.Servlet.PROPERTY.SERVLET.Dump.Initialize : True
*.*.Filter.PROPERTY.Html.CLASS : com.mortbay.HTTP.Filter.HtmlFilter
# ========================================================================
# Default FileHandler Properties
# ------------------------------------------------------------------------
*.*.File.PROPERTY.AllowPut : False
*.*.File.PROPERTY.AllowDelete : False
*.*.File.PROPERTY.AllowDir : True
*.*.File.PROPERTY.Indexes : index.html;index.htm
*.*.File.PROPERTY.MaxCachedFiles : 100
*.*.File.PROPERTY.MaxCachedFileSize : 8192
# ========================================================================
# Define the server instances to be configured by this file:
# SERVERS - list if defined server names
# PROPERTY.* - Definition of global properties
# PROPERTIES - File of globl properties
# servername.* - PropertyTree describing server "servername".
#
# Defined global properties are:
# DefaultPageType - The class name of the default com.mortbay.HTML.Page
# type.
# ------------------------------------------------------------------------
SERVERS : main;proxy
PROPERTY.DefaultPageType : com.mortbay.Jetty.JettyLaF
# ========================================================================
# Define the server instance named "main"
# CLASS - The class name of the server. Must either be
# com.mortbay.HTTP.HttpServer or a decendant.
# LISTENER.name.CLASS - HttpListener classname or decendant
# LISTENER.name.ADDRS - List of addresses and ports to listen on
# STACKS - List of handler stack names.
# EXCEPTIONS - List of exception handler stack names.
# PROPERTY.* - Properties for this server
# PROPERTIES - File of properties for this server.
#
# Defined server properties are:
# SessionMaxInactiveInterval - Max idle time Ms before session death
# MinListenerThreads - Min listener threads per listener
# MaxListenerThreads - Max listener threads per listener
# MaxListenerThreadIdleMs - Max idle time Ms before listen thread
# death
# MimeMap - Property file of MIME mappings
#
# ------------------------------------------------------------------------
main.LISTENERS : all
main.LISTENER.all.ADDRS : 0.0.0.0:8080;127.0.0.1:8888
main.STACKS : root;files
main.EXCEPTIONS : defaultEx
main.PROPERTY.SessionMaxInactiveInterval : 3600
main.PROPERTY.MinListenerThreads : 3
main.PROPERTY.MaxListenerThreads : 20
main.PROPERTY.MaxListenerThreadIdleMs : 60000
# XXX
# main.PROPERTY.MimeMap : ./etc/Mime.prp
# ========================================================================
# Define the handler instances handler stack "root" in server "main"
# PATHS - List of PathMap path specifiactions for this stack
# HANDLERS - List of handler names for this stack.
# EXCEPTIONS - List of exception handler names for this stack.
# name.CLASS - The classname for the handler "name"
# name.PROPERTY.* - Properties defined for handler "name"
# name.PROPERTIES - file of properties defined for handler "name"
# ------------------------------------------------------------------------
main.root.PATHS : /
main.root.HANDLERS : Log;Auth;Alias;Filter;Param;Session;Servlet;File;Forward;NotFound
main.root.Log.PROPERTY.File : ./log/demo.log
main.root.Log.PROPERTY.Append : False
main.root.Log.PROPERTY.LongForm : True
main.root.Log.PROPERTY.CountContentLength : False
main.root.Log.PROPERTY.DateFormat : dd/MMM/yyyy:HH:mm:ss
# main.root.Auth.PROPERTIES : ./etc/JettyDemoRealms.prp
# main.root.Alias.PROPERTIES : ./etc/JettyDemoAlias.prp
main.root.Filter.PROPERTY.Html.PATHS : /
main.root.Param.PROPERTY.CookiesAsParameters : False
# ------------------------------------------------------------------------
main.root.Servlet.PROPERTY.SERVLET.Dump.PATHS : /Dump%;*.DUMP
main.root.Servlet.PROPERTY.SERVLET.Dump.CHUNK : True
main.root.Servlet.PROPERTY.SERVLET.Dump.PROPERTY.AttrX : ValueX
main.root.Servlet.PROPERTY.SERVLET.Dump.PROPERTY.AttrY : ValueY
main.root.Servlet.PROPERTY.SERVLET.Dump.PROPERTY.AttrZ : ValueZ
# main.root.Servlet.PROPERTY.SERVLET.Dump.PROPERTIES : ./etc/JettyDemoDump.prp
main.root.Servlet.PROPERTY.SERVLET.Exit.PATHS : /Exit
main.root.Servlet.PROPERTY.SERVLET.Session.PATHS : /SessionDump
main.root.Servlet.PROPERTY.SERVLET.PropertyTree.PATHS : /PropertyTree
main.root.Servlet.PROPERTY.SERVLET.Config.PATHS : /Config$
main.root.Servlet.PROPERTY.SERVLET.Debug.PATHS : /Debug$
main.root.Servlet.PROPERTY.SERVLET.Multi.PATHS : /Demo/push
main.root.Servlet.PROPERTY.SERVLET.Multi.CLASS : com.mortbay.Jetty.MultiPartCount
main.root.Servlet.PROPERTY.SERVLET.Gen.PATHS : /Demo/generate
main.root.Servlet.PROPERTY.SERVLET.Gen.CLASS : com.mortbay.Jetty.GenerateServlet
main.root.Servlet.PROPERTY.SERVLET.GenL.PATHS : /Demo/generateLaf
main.root.Servlet.PROPERTY.SERVLET.GenL.CLASS : com.mortbay.Jetty.GenerateLafServlet
main.root.Servlet.PROPERTY.SERVLET.Upload.PATHS : /Upload$
main.root.Servlet.PROPERTY.SERVLET.Upload.CLASS : com.mortbay.Jetty.UploadServlet
main.root.Servlet.PROPERTY.SERVLET.Laf.PATHS : /Jetty/Demo/;/Jetty/Info/;/Jetty/Config/;/Jetty/Program/
main.root.Servlet.PROPERTY.SERVLET.Laf.PROPERTY.ResourceBase: /laf
main.root.Servlet.PROPERTY.SERVLET.Index.PATHS : /Jetty|;/Jetty/Info|;/Jetty/Demo|;/Jetty/Program|;/Jetty/Config|
main.root.Servlet.PROPERTY.SERVLET.Index.CLASS : com.mortbay.Jetty.DemoIndex
# ------------------------------------------------------------------------
main.root.File.PROPERTY.FILES.FileBase.PATHS : /;/FileBase%
main.root.File.PROPERTY.FILES.FileBase.DIRECTORY : ./FileBase
# ------------------------------------------------------------------------
main.root.Forward.PROPERTY.FORWARD.demo.PATHS : /Forward%
main.root.Forward.PROPERTY.FORWARD.demo.URL : http://localhost:8080
main.root.Forward.PROPERTY.FORWARD.proxy.PATHS : http
main.root.Forward.PROPERTY.FORWARD.proxy.URL : http://localhost:8081
# ========================================================================
# Exception handler stacks 'default' and 'terse' for server 'main'
# HANDLERS - List of exception handler names for each stack.
# PATHS - List of PathMap path specifiactions for each stack
# name.CLASS - The classname for the handler "name"
# ------------------------------------------------------------------------
main.defaultEx.PATHS : /
main.defaultEx.HANDLERS : DefaultEx
main.defaultEx.DefaultEx.CLASS : com.mortbay.HTTP.Handler.DefaultExceptionHandler
# ========================================================================
# Define the handler stack "files" in server "main"
# ------------------------------------------------------------------------
main.files.HOSTS :
main.files.PATHS : /javadoc%;/laf%
main.files.HANDLERS : File;NotFound
main.files.File.PROPERTY.FILES.Laf.PATHS : /laf
main.files.File.PROPERTY.FILES.Laf.DIRECTORY : ./FileBase
main.files.File.PROPERTY.FILES.Javadoc.PATHS : /javadoc
main.files.File.PROPERTY.FILES.Javadoc.DIRECTORY : ./javadoc
main.files.File.PROPERTY.FILES.Servlet.PATHS : /javadoc/javax/servlet
main.files.File.PROPERTY.FILES.Servlet.DIRECTORY : ./src/javax/servlet/javadoc
# ========================================================================
# Define the server instance named "proxy"
# ------------------------------------------------------------------------
proxy.STACKS : root
proxy.LISTENER.all.ADDRS : 0.0.0.0:8081
# ========================================================================
# Define the handler stack "root" in server "proxy"
# ------------------------------------------------------------------------
proxy.root.HANDLERS : Log;Proxy;NotFound
proxy.root.PATHS : /
proxy.root.Log.PROPERTY.File : /tmp/demo.log
proxy.root.Log.PROPERTY.Append : True
proxy.root.Proxy.PROPERTY.PATHS : /;http;ftp