kom.gateway
Class Action

java.lang.Object
  |
  +--kom.gateway.DBLow
        |
        +--kom.gateway.DBHigh
              |
              +--kom.gateway.KOMutil
                    |
                    +--kom.gateway.Form
                          |
                          +--kom.gateway.Chat
                                |
                                +--kom.gateway.Grade
                                      |
                                      +--kom.gateway.News
                                            |
                                            +--kom.gateway.Build
                                                  |
                                                  +--kom.gateway.SendMail
                                                        |
                                                        +--kom.gateway.Action
Direct Known Subclasses:
GetMail, NewsNotifier

public class Action
extends SendMail

Processes HTTP requests. The main method is process, which returns the result of a POST request as an HTTP InputStream containing an HTML page.


Inner classes inherited from class kom.gateway.Build
Build.KOMactivity, Build.KOMcategory, Build.KOMhome, Build.KOMmsg, Build.KOMmt, Build.KOMquery, Build.KOMsub, Build.KOMthr, Build.KOMuser
 
Inner classes inherited from class kom.gateway.KOMutil
KOMutil.LookupTables, KOMutil.UFtable
 
Field Summary
(package private) static java.lang.String CR
           
(package private) static java.lang.String CRLF
           
(package private) static java.lang.String LF
           
private  Overview[] ovwt
          Table of Usenet News information for current newsgroup
(package private)  HTTPRequestParser parser
          Provides access to name=value pairs from the request
 
Fields inherited from class kom.gateway.Build
curract, kBalt, kBalt2, kBintro, kBintro2, kBrespondents, kBscale, kBscale2, kCnameq, kCnameq2, kCnewlocname, kCnewmembermail, khead, kPlogin, kPloginpw, kPnewloccat, kPnewlocshort, kPopenness, kPsecret, kPsecret2, kstephead, ksteptail, ktail, modified, qrytable, SM
 
Fields inherited from class kom.gateway.News
format, HTML, limit, NEWSLIMIT, PLAIN, REGULAR, userObject
 
Fields inherited from class kom.gateway.Chat
oldbody, oldpres, reverseChat
 
Fields inherited from class kom.gateway.Form
acceptform, added, bodytext, curform, formcodes, isHTML, isVote, kBase, kBbody, kCname, kCuser, kDColor, kFBase, KFC, kHColor, kIcons, kKFC, kLColor, kPboard, kPcomm, kPdate, kPhtml, kPhtmldef, kPinterval, kPnotif, kPshort, kPtype, kServer, kTarea, oldOutput, outputText, submitted, substkey
 
Fields inherited from class kom.gateway.KOMutil
ACT, anyAccess, arglist, argsep, argtab, attachments, BOK, BOUNDARYSTART, CAT, CHA, cidTable, CLO, config, curNgd, DIC, environment, gateway, gavePassword, GEN, GRA, GRP, inlineCurr, inlines, INT, LINE_CUTOFF, LINE_FUDGE, LIS, lt, MAILIT, messageRecipientTypeCode, MIM, MOD, N_RECTY, N_RECTYPECODE, newsclient, newsClients, newsData, nntpAuth, NWS, NWSART, objCache, oCurr, oldnews, POSTIT, RAT, REC_BCC, REC_CC, REC_TO, recTypeCode, REP, response, rLoc, savednews, sCursor, servletBase, session, THR, userData, USR, VOT
 
Fields inherited from class kom.gateway.DBHigh
AdminURL, cache, HomeURL, UsersURL
 
Fields inherited from class kom.gateway.DBLow
absCDBpath, config, fSep, fSeparator, msgAuth, msgParts
 
Constructor Summary
Action(ServerConfig config, HTTPResponse response, Gateway gateway)
          Class constructor
 
Method Summary
(package private)  java.io.InputStream Accept()
          Accepts or rejects some messages according to form data
private  java.lang.String addAddress(java.lang.String addr, KomData obj, java.lang.String atyp, java.lang.String vis)
          Adds a recipient record to an object.
private  boolean addBatchOfEntries(KomData obj)
          Adds a batch of entries to an activity
private  boolean addBatchOfUsers(KomData obj)
          Adds a batch of users to an activity
(package private)  java.io.InputStream AddChat()
          Creates a chat entry
(package private)  java.io.InputStream AddGen()
          Processes a genealogy form to add family data
(package private)  java.io.InputStream AddGrades()
          Adds grades on some messages
private  void addm(KomData ht, java.lang.String memb, boolean org, boolean add, boolean subrec)
          Adds/subtracts a member to/from an activity and vice versa
(package private)  java.io.InputStream AddMemb()
          Action for ADDMEMB (adds a member or organizer to an activity)
private  void addOneEntry(KomData obj, java.lang.String name, java.lang.String body)
           
private  void addOneUser(KomData obj, java.lang.String name, java.lang.String login, java.lang.String email, java.lang.String pass)
           
(package private)  java.io.InputStream AddRec()
          Forwards a message or thread according to an address form
(package private)  void addReceiver(KomData obj, java.lang.String rectype, java.lang.String rec, java.lang.String type, java.lang.String name)
          Adds a recipient record to an object.
private  java.lang.String addtype(java.lang.String type, java.lang.String key, java.lang.String code, java.lang.String ptyp)
          Updates type codes according to parser data and parent object type
(package private)  void addUser()
          Adds current user object (defined by userData) to user category
 void authData(KomData obj)
          Gets author data
(package private)  java.io.InputStream CastVote()
          Records a vote
(package private)  java.io.InputStream CheckMsgPwd()
          Checks if the correct password is given for access to a message
private  java.lang.String checkNews(java.lang.String name, KomData obj)
          When creating a newsgroup forum, tries to load latest news.
(package private)  java.io.InputStream Create()
          Creates some object (category, forum, message, etc)
private  boolean create1(KomData obj, java.lang.String name, java.lang.String pid, java.lang.String type)
           
 java.io.InputStream CreateForm()
          Creates a query object
 java.lang.String createForum(Build.KOMquery q)
          Creates a new forum in the Kom database.
(package private)  KomData createObject(java.lang.String type)
          Creates an object which is an instance of KomData or a subclass of KomData, depending on the type parameter.
(package private)  void creUser(java.lang.String pass)
          Creates a user object from userData
private  void deleteObj(KomData obj)
          Marks a message as deleted.
(package private)  java.io.InputStream display(java.lang.String uri)
          Causes the page corresponding to the uri to be displayed
(package private)  java.io.InputStream display(java.lang.String uri, java.lang.String arg)
          Causes the page corresponding to the uri to be displayed
private  void distribute(KomData obj, java.lang.String oldobj)
          Distributes an object to its recipients
(package private)  java.lang.String emailCheck(java.lang.String em)
          Makes sure of no illegal characters (i e embedded spaces) in an e-mail address.
(package private)  KomData findDraftObject(java.lang.String ref, java.lang.String xnr)
          Creates an object from a draft
private  java.lang.String findRef(java.lang.String name)
           
private  java.lang.String getAddress(KomData obj, java.lang.String vis)
          Gets addresses from To: and Cc: form input text fields.
private  java.lang.String getAllRecs(KomData obj)
          Gathers recipients for an object from the submission form
private  java.lang.String getBoard(java.lang.String type)
          Gets "board id" (object classification)
private  void getEmail(java.lang.String name, java.lang.String loginid, java.lang.String email)
          Determines user email address and saves it in userData.
private  java.lang.String getRecs(KomData obj, java.lang.String vis)
          Updates message recipients from form data.
private  boolean getShort(java.lang.String type, java.lang.String name, KomData obj, java.lang.String pid)
          Gets a short name, suitable as mailbox part of an email address, for the new object.
(package private)  java.lang.String getType()
          Determines a type code string from form data and parent type.
private  java.lang.String getUser(java.lang.String name, java.lang.String login, java.lang.String email, java.lang.String board, java.lang.String pass)
          Gets/creates a user reference
private  java.lang.String getXrecs(KomData obj, java.lang.String vis)
          Updates recipient list for message from ticked boxes
(package private)  java.io.InputStream Login()
          Processes a login form
private  KomData makeAddress(java.lang.String addr)
          Makes an "address object"
 java.io.InputStream process()
          Creates an HTTP stream according to value of "command" in URL
(package private)  java.io.InputStream queryinvite(Build.KOMthr thr, java.lang.String rec)
           
(package private)  java.io.InputStream Register()
          Processes a registration form
(package private)  void resetUpdate(java.util.Vector ngrcv)
          Resets update time for some newsgroup(s) to trigger prompt reload
(package private)  void setPartHeaders(Upload u, java.lang.String uid, java.lang.String desc, java.lang.String imgloc)
           
(package private)  java.io.InputStream SnetLogin()
          Processes a Seniornet login form
 
Methods inherited from class kom.gateway.SendMail
addmailaddr, addRecipients, addReferences, closed, disconnected, getFrom, getSender, inetAddr, makeCid, makeContent, makeMime, messageDelivered, messageNotDelivered, messagePartiallyDelivered, mkIadd, opened, post, reduceRecipients, sameAddr, sendEmail
 
Methods inherited from class kom.gateway.Build
addParts, addrecs, build, buildReferences, checkCDB, contentHeaders, copyParts, delete, dispdelete, dispexcl, disphelp, dispinfo, displogin, dispmain, dispnormal, dispparent, disppreview, disprecs, dispreg, doLogin, expunge, getAct, getHier, getKOMmsg, getKOMmsg, getMessageId, getMimeRef, getMt, getNewsClient, getNewsGroupData, getObj, getRecop, getThreads, getUserNews, handleOverviews, history, logout, makeBodyPart, makecont, makeform, makehtml, makeoper, makerec, makerec, makerec, makeRelatedPart, makeSimpleHTMLpart, menufoot, menuhead, messageid, messageid, mimeChange, mkmbox, mkmbox, moderate, modifytype, newMimeBodyPart, nntpServer, outpreview, page, setDefault, setDefaults, setUserValue, showatts, special, store, xform, xform, xform, xform
 
Methods inherited from class kom.gateway.News
addMem, bookmarks, checkNewMemb, checkUnseen, countmod, dispActNews, dispBook, dispCatNews, dispForumNews, dispLetterNews, dispModNews, dispMods, dispPersNews, dispSavedNews, dispSavedQueries, getRead, makeNews, markCat, markPres, markrecs, markSeen, newVote, nextUnread, putShort, storeNews, threadno
 
Methods inherited from class kom.gateway.Grade
catover, cretab, fetchGrade, fetchRate, getEvaluation, getgrade, isTeacher, listover, newGrade, printRatings, showcat, showgrades, shownumbers, showover, showstud, showuser
 
Methods inherited from class kom.gateway.Chat
addChat, chat, chatFetch, chatHeader, chatIndex, chatInput, chatList, chatOut, chatOutput, chatStore, checkEnter, enter, isActive, leave, leaveChat, pres, qchat, setUser, transform
 
Methods inherited from class kom.gateway.Form
, add, addBody, addv, checkHTML, checkHTTP, checkTag, checkVote, complete, contains, dispauth, dispbody, dispcheck, dispname, dispselect, disptype, form, form, form, form, formsegment, getAreaResult, getForm, getHTML, getOutputText, getQryValues, getResultBox, getResultText, getSelect1, getSelect2, getSelectResult, getTag, getVote, getVoteArea, getVoteCheck, getVoteSelect, getVoteSubmit, getVoteTag, getVoteText, insertSelect, makeHTML, nextmatching, normalize, restoreOutput, saveOutput, textareaSubst, transform, translate, trbody
 
Methods inherited from class kom.gateway.KOMutil
a, accessCont, accessCont, accessObj, addInfoData, addrToLocal, changeEnvironment, cidReplace, contType, decodeText, deleted, dispMailMessage, doAction, equal, excluded, fetchNews, findId, findId, findlocal, findLogin, findOwner, findUser, getActId, getcont, getcont, getcontV, getcontV, getCurNgd, getmemb, getMsgParts, getMsgText, getNews, getNewsAuth, getobj, getobject, getold, getParent, getPart, getSimpleFileName, getSimpleFileName, getStream, getTail, getTextPart, getVal, getVal, isAllowed, isarg, isMember, isOrganizer, isOrganizer, ispunct, isType, isValidEmailAddress, loggedIn, mailDate, mailDate, mimeMessage, mimeMessageStream, mkdate, mkdate, noQuote, parseArglist, parseArgs, setCids, setNewsAuth, setValidMsgPwd, showBody, showHeader, showHeader, showHeaders, showInputStream, showMailMessage, showMessage, showMultipart, toString, transbody, urlexpand, userGavePassword, userGavePassword, wrap
 
Methods inherited from class kom.gateway.DBHigh
addContent, addContent, addDraft, addInfo, addLast, addMember, addNews, addObj, addObj, addObject, addObject, addQuery, cleanDrafts, contentCount, createNews, depth, expungeRef, findContent, findDraft, findDraftData, findInfo, findMemb, findNews, findObject, findObject, findQuery, getFormContents, getQryDefault, getQueries, getseq, getStringValues, getValues, invalidateCount, isEmpty, isStandard, listDraft, makeArea, modObject, msgExists, nextDraft, queryExists, ref2path, refExists, removeDraft, removeQuery, replaceObject, Stream2String, String2Stream, StringBuffer2Stream, updateCount, updCount, updref, updseq
 
Methods inherited from class kom.gateway.DBLow
accessPart, addFile, areaExists, basedRef, createArea, debugLog, errorLog, expungeFile, File2Stream, File2String, findPart, getFile, getFileContents, getFileStream, getPath, getStandard, isMailSpool, lastModified, length, listFiles, makePart, msgPartStream, partfile, partpath, printStackTrace, readObject, removeFile, replaceMime, updseq1, validate, validate, writeObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

ovwt

private Overview[] ovwt
Table of Usenet News information for current newsgroup

parser

HTTPRequestParser parser
Provides access to name=value pairs from the request

LF

static final java.lang.String LF

CR

static final java.lang.String CR

CRLF

static final java.lang.String CRLF
Constructor Detail

Action

public Action(ServerConfig config,
              HTTPResponse response,
              Gateway gateway)
Class constructor
Parameters:
config - Configuration data
response - HTTP response data and methods
gateway - Thread supervisor and reference to common data for this KOM server instance
Method Detail

process

public java.io.InputStream process()
Creates an HTTP stream according to value of "command" in URL
Returns:
InputStream to be interpreted or shown as HTML page

CheckMsgPwd

java.io.InputStream CheckMsgPwd()
Checks if the correct password is given for access to a message

Register

java.io.InputStream Register()
Processes a registration form

getEmail

private void getEmail(java.lang.String name,
                      java.lang.String loginid,
                      java.lang.String email)
Determines user email address and saves it in userData. If loginid and email are empty, converts name to suitable form for use as mailbox part in "mailbox@domain". Adds domain from configuration data.
Parameters:
name - "Common" (free-form) name
loginid - Short name suitable as a mailbox part
email - If non-empty, use this (disregarding name and loginid)

emailCheck

java.lang.String emailCheck(java.lang.String em)
Makes sure of no illegal characters (i e embedded spaces) in an e-mail address.

creUser

void creUser(java.lang.String pass)
Creates a user object from userData
Parameters:
pass - password string

addUser

void addUser()
Adds current user object (defined by userData) to user category

Login

java.io.InputStream Login()
Processes a login form

CreateForm

public java.io.InputStream CreateForm()
Creates a query object
Returns:
InputStream representing object as HTML

createForum

public java.lang.String createForum(Build.KOMquery q)
Creates a new forum in the Kom database.
Returns:
Reference to new forum if creation was successful, null otherwise.

SnetLogin

java.io.InputStream SnetLogin()
Processes a Seniornet login form

Create

java.io.InputStream Create()
Creates some object (category, forum, message, etc)
Returns:
InputStream representing object as HTML

queryinvite

java.io.InputStream queryinvite(Build.KOMthr thr,
                                java.lang.String rec)

setPartHeaders

void setPartHeaders(Upload u,
                    java.lang.String uid,
                    java.lang.String desc,
                    java.lang.String imgloc)

create1

private boolean create1(KomData obj,
                        java.lang.String name,
                        java.lang.String pid,
                        java.lang.String type)

createObject

KomData createObject(java.lang.String type)
Creates an object which is an instance of KomData or a subclass of KomData, depending on the type parameter.
Parameters:
type - Object type code
Returns:
An Object of the class implied by the type code.

getType

java.lang.String getType()
Determines a type code string from form data and parent type.

addtype

private final java.lang.String addtype(java.lang.String type,
                                       java.lang.String key,
                                       java.lang.String code,
                                       java.lang.String ptyp)
Updates type codes according to parser data and parent object type
Parameters:
type - Current type code string
key - Parser key
code - New type code to be added, if not already there
ptyp - Parent object type code(s)
Returns:
possibly updated value of type

getBoard

private java.lang.String getBoard(java.lang.String type)
Gets "board id" (object classification)
Parameters:
type - type code(s)
Returns:
Identifier

getShort

private boolean getShort(java.lang.String type,
                         java.lang.String name,
                         KomData obj,
                         java.lang.String pid)
Gets a short name, suitable as mailbox part of an email address, for the new object. Checks if the name is taken already.
Parameters:
type - Object type
name - Long (presentation) name
obj - The (new) object
pid - Object id
Returns:
true if a valid, free to use "shortname" could be determined (and stored), or if the object type is irrelevant.

checkNews

private java.lang.String checkNews(java.lang.String name,
                                   KomData obj)
When creating a newsgroup forum, tries to load latest news.
Parameters:
name - Newsgroup name
obj - (New) object for the forum
Returns:
error message string on error, otherwise null.

authData

public void authData(KomData obj)
Gets author data
Parameters:
obj - Object to update
Returns:
operation representing the author

getAllRecs

private java.lang.String getAllRecs(KomData obj)
Gathers recipients for an object from the submission form
Parameters:
obj - Object to be displayed/distributed
Returns:
"Primary" recipient

getRecs

private java.lang.String getRecs(KomData obj,
                                 java.lang.String vis)
Updates message recipients from form data.
Parameters:
obj - Object to be sent to recipients
vis - Current value for "visible" recipient
Returns:
new value of vis, or the same.

addReceiver

void addReceiver(KomData obj,
                 java.lang.String rectype,
                 java.lang.String rec,
                 java.lang.String type,
                 java.lang.String name)
Adds a recipient record to an object.
Parameters:
obj - Object to be updated
rectype - Type of recipient (rec* or cc*)
rec - Recipient id
type - Recipient type code
name - Recipient (common) name

getAddress

private java.lang.String getAddress(KomData obj,
                                    java.lang.String vis)
Gets addresses from To: and Cc: form input text fields.
Parameters:
obj - Current object
vis - Current "primary" address
Returns:
New or old value of "primary" address

addAddress

private java.lang.String addAddress(java.lang.String addr,
                                    KomData obj,
                                    java.lang.String atyp,
                                    java.lang.String vis)
Adds a recipient record to an object.
Parameters:
addr - Recipient reference/email address
obj - Current object
atyp - Type of address ("rec*" or "cc*")
vis - Current "primary" address
Returns:
New or unchanged "primary" address

findRef

private java.lang.String findRef(java.lang.String name)

getXrecs

private java.lang.String getXrecs(KomData obj,
                                  java.lang.String vis)
Updates recipient list for message from ticked boxes
Parameters:
obj - Object to be sent to recipients
vis - Current value for "visible" recipient
Returns:
new value of vis, or the same.

addBatchOfEntries

private boolean addBatchOfEntries(KomData obj)
Adds a batch of entries to an activity
Parameters:
obj - Defines where to put (distribute) entries

addOneEntry

private void addOneEntry(KomData obj,
                         java.lang.String name,
                         java.lang.String body)

distribute

private void distribute(KomData obj,
                        java.lang.String oldobj)
Distributes an object to its recipients
Parameters:
obj - Object (usually a message)
oldobj - Ref to old version of the object, or null

resetUpdate

void resetUpdate(java.util.Vector ngrcv)
Resets update time for some newsgroup(s) to trigger prompt reload
Parameters:
ngrcv - Vector of newsgroup recipients in String form

deleteObj

private void deleteObj(KomData obj)
Marks a message as deleted.
Parameters:
obj - Message data

AddRec

java.io.InputStream AddRec()
Forwards a message or thread according to an address form

AddGen

java.io.InputStream AddGen()
Processes a genealogy form to add family data

makeAddress

private KomData makeAddress(java.lang.String addr)
Makes an "address object"
Parameters:
addr - An internal reference or an e-mail address
Returns:
An appropriate target address structure

AddMemb

java.io.InputStream AddMemb()
Action for ADDMEMB (adds a member or organizer to an activity)

addm

private void addm(KomData ht,
                  java.lang.String memb,
                  boolean org,
                  boolean add,
                  boolean subrec)
Adds/subtracts a member to/from an activity and vice versa
Parameters:
ht - Activity data
memb - Member ref
org - True for organizer
add - True for additions, false for subtractions
subrec - True when removing an Open For link

addBatchOfUsers

private boolean addBatchOfUsers(KomData obj)
Adds a batch of users to an activity
Parameters:
obj - Defines where to put users

addOneUser

private void addOneUser(KomData obj,
                        java.lang.String name,
                        java.lang.String login,
                        java.lang.String email,
                        java.lang.String pass)

getUser

private java.lang.String getUser(java.lang.String name,
                                 java.lang.String login,
                                 java.lang.String email,
                                 java.lang.String board,
                                 java.lang.String pass)
Gets/creates a user reference
Parameters:
name - Common name of user
login - Login id of user
email - E-mail address
board - Type of user (icon reference)
pass - User password
Returns:
(New) user reference

Accept

java.io.InputStream Accept()
Accepts or rejects some messages according to form data
Returns:
InputStream representing object

CastVote

java.io.InputStream CastVote()
Records a vote

AddChat

java.io.InputStream AddChat()
Creates a chat entry
Returns:
InputStream representing object

AddGrades

java.io.InputStream AddGrades()
Adds grades on some messages
Returns:
InputStream representing object

display

java.io.InputStream display(java.lang.String uri)
Causes the page corresponding to the uri to be displayed
Parameters:
uri - URL of page
Returns:
InputStream for the page

display

java.io.InputStream display(java.lang.String uri,
                            java.lang.String arg)
Causes the page corresponding to the uri to be displayed
Parameters:
uri - URL of page
arg - Arguments to be appended to the url
Returns:
InputStream for the page

findDraftObject

KomData findDraftObject(java.lang.String ref,
                        java.lang.String xnr)
Creates an object from a draft
Parameters:
ref - Object ref
xnr - Draft id
Returns:
KomData object or relevant subclass