public class ToadletContextImpl extends java.lang.Object implements ToadletContext
| Constructor and Description |
|---|
ToadletContextImpl(java.net.Socket sock,
MultiValueTable<java.lang.String,java.lang.String> headers,
BucketFactory bf,
PageMaker pageMaker,
ToadletContainer container,
UserAlertManager userAlertManager,
BookmarkManager bookmarkManager,
java.net.URI uri,
long uniqueID) |
| Modifier and Type | Method and Description |
|---|---|
Toadlet |
activeToadlet() |
HTMLNode |
addFormChild(HTMLNode parentNode,
java.lang.String target,
java.lang.String name)
Add a form node to an HTMLNode under construction.
|
boolean |
checkFormPassword(HTTPRequest request)
Check a request for the form password, and send an error to the client if the password is
not valid.
|
boolean |
checkFormPassword(HTTPRequest request,
java.lang.String redirectTo)
Check a request for the form password, and send an error to the client if the password is
not valid.
|
boolean |
checkFullAccess(Toadlet toadlet)
Check a context for whether
ToadletContext.isAllowedFullAccess() is true. |
boolean |
disableProgressPage() |
boolean |
doRobots()
Return a robots.txt excluding all spiders and other non-browser HTTP clients?
|
void |
forceDisconnect()
Force a disconnection after handling this request.
|
UserAlertManager |
getAlertManager()
Get the user alert manager.
|
BookmarkManager |
getBookmarkManager()
Get the bookmark manager.
|
BucketFactory |
getBucketFactory() |
ToadletContainer |
getContainer() |
ReceivedCookie |
getCookie(java.net.URI domain,
java.net.URI path,
java.lang.String name)
Get an existing
Cookie (sent by the client) from the headers. |
java.lang.String |
getFormPassword()
Get the form password required for "dangerous" operations.
|
MultiValueTable<java.lang.String,java.lang.String> |
getHeaders() |
PageMaker |
getPageMaker()
Get the page maker object.
|
FProxyFetchInProgress.REFILTER_POLICY |
getReFilterPolicy()
What to do when we find cached data on the global queue but it's already been
filtered, and we want a filtered copy.
|
java.lang.String |
getUniqueId()
Returns the unique id of this request
|
java.net.URI |
getUri() |
static void |
handle(java.net.Socket sock,
ToadletContainer container,
PageMaker pageMaker,
UserAlertManager userAlertManager,
BookmarkManager bookmarkManager)
Handle an incoming connection.
|
boolean |
hasFormPassword(HTTPRequest request)
Check a request for the form password.
|
boolean |
isAdvancedModeEnabled()
Is the web interface in advanced mode?
|
boolean |
isAllowedFullAccess()
Is this Toadlet allowed full access to the node, including the ability to reconfigure it,
restart it etc?
|
static java.util.Date |
parseHTTPDate(java.lang.String httpDate) |
void |
sendReplyHeaders(int code,
java.lang.String desc,
MultiValueTable<java.lang.String,java.lang.String> mvt,
java.lang.String mimeType,
long length)
Write reply headers for generated content (web interface pages) and redirects etc.
|
void |
sendReplyHeaders(int code,
java.lang.String desc,
MultiValueTable<java.lang.String,java.lang.String> mvt,
java.lang.String mimeType,
long length,
boolean forceDisableJavascript)
Write reply headers for generated content (web interface pages) and redirects etc.
|
void |
sendReplyHeaders(int code,
java.lang.String desc,
MultiValueTable<java.lang.String,java.lang.String> mvt,
java.lang.String mimeType,
long length,
java.util.Date mTime)
Deprecated.
|
void |
sendReplyHeadersFProxy(int replyCode,
java.lang.String replyDescription,
MultiValueTable<java.lang.String,java.lang.String> mvt,
java.lang.String mimeType,
long contentLength)
Write reply headers for content downloaded from Freenet.
|
void |
sendReplyHeadersStatic(int replyCode,
java.lang.String replyDescription,
MultiValueTable<java.lang.String,java.lang.String> mvt,
java.lang.String mimeType,
long contentLength,
java.util.Date mTime)
Write reply headers with a customised modification time for static content.
|
void |
setCookie(Cookie newCookie)
Set a
Cookie, it will be sent with the reply headers to the client. |
void |
writeData(Bucket data)
Write data from a bucket.
|
void |
writeData(byte[] data)
Convenience method that simply calls
ToadletContext.writeData(byte[], int, int). |
void |
writeData(byte[] data,
int offset,
int length)
Write data.
|
public ToadletContextImpl(java.net.Socket sock,
MultiValueTable<java.lang.String,java.lang.String> headers,
BucketFactory bf,
PageMaker pageMaker,
ToadletContainer container,
UserAlertManager userAlertManager,
BookmarkManager bookmarkManager,
java.net.URI uri,
long uniqueID)
throws java.io.IOException
java.io.IOExceptionpublic void sendReplyHeaders(int code,
java.lang.String desc,
MultiValueTable<java.lang.String,java.lang.String> mvt,
java.lang.String mimeType,
long length)
throws ToadletContextClosedException,
java.io.IOException
ToadletContextsendReplyHeaders in interface ToadletContextcode - HTTP code.desc - HTTP code description.mvt - Any extra headers. Can be null.mimeType - The MIME type of the reply.length - The length of the reply.ToadletContextClosedExceptionjava.io.IOExceptionpublic void sendReplyHeaders(int code,
java.lang.String desc,
MultiValueTable<java.lang.String,java.lang.String> mvt,
java.lang.String mimeType,
long length,
boolean forceDisableJavascript)
throws ToadletContextClosedException,
java.io.IOException
ToadletContextsendReplyHeaders in interface ToadletContextcode - HTTP code.desc - HTTP code description.mvt - Any extra headers. Can be null.mimeType - The MIME type of the reply.length - The length of the reply.forceDisableJavascript - Disable javascript even if it is enabled for the web interface
as a whole.ToadletContextClosedExceptionjava.io.IOException@Deprecated
public void sendReplyHeaders(int code,
java.lang.String desc,
MultiValueTable<java.lang.String,java.lang.String> mvt,
java.lang.String mimeType,
long length,
java.util.Date mTime)
throws ToadletContextClosedException,
java.io.IOException
sendReplyHeaders in interface ToadletContextToadletContextClosedExceptionjava.io.IOExceptionpublic void sendReplyHeadersStatic(int replyCode,
java.lang.String replyDescription,
MultiValueTable<java.lang.String,java.lang.String> mvt,
java.lang.String mimeType,
long contentLength,
java.util.Date mTime)
throws ToadletContextClosedException,
java.io.IOException
ToadletContextsendReplyHeadersStatic in interface ToadletContextreplyCode - HTTP code.replyDescription - HTTP code description.mvt - Any extra headers. Can be null.mimeType - The MIME type of the reply.contentLength - The length of the reply.mTime - The modification time of the data being sent.ToadletContextClosedExceptionjava.io.IOExceptionpublic void sendReplyHeadersFProxy(int replyCode,
java.lang.String replyDescription,
MultiValueTable<java.lang.String,java.lang.String> mvt,
java.lang.String mimeType,
long contentLength)
throws ToadletContextClosedException,
java.io.IOException
ToadletContextsendReplyHeadersFProxy in interface ToadletContextreplyCode - HTTP code.replyDescription - HTTP code description.mvt - Any extra headers. Can be null.mimeType - The MIME type of the reply.contentLength - The length of the reply.ToadletContextClosedExceptionjava.io.IOExceptionpublic PageMaker getPageMaker()
ToadletContextgetPageMaker in interface ToadletContextpublic java.lang.String getFormPassword()
ToadletContextgetFormPassword in interface ToadletContextpublic boolean checkFormPassword(HTTPRequest request) throws ToadletContextClosedException, java.io.IOException
ToadletContextcheckFormPassword in interface ToadletContextrequest - The request to check.ToadletContextClosedExceptionjava.io.IOExceptionpublic boolean checkFormPassword(HTTPRequest request, java.lang.String redirectTo) throws ToadletContextClosedException, java.io.IOException
ToadletContextcheckFormPassword in interface ToadletContextrequest - The request to check.redirectTo - The location to redirect to if the password is not set.ToadletContextClosedExceptionjava.io.IOExceptionpublic boolean checkFullAccess(Toadlet toadlet) throws ToadletContextClosedException, java.io.IOException
ToadletContextToadletContext.isAllowedFullAccess() is true.
If it is false, an error page is sent to the client, and false is returned.
You can then abort processing of the request.checkFullAccess in interface ToadletContextToadletContext.isAllowedFullAccess().ToadletContextClosedException - See Toadlet.sendUnauthorizedPage(ToadletContext)java.io.IOException - See Toadlet.sendUnauthorizedPage(ToadletContext)ToadletContext.checkFullAccess(Toadlet)public boolean hasFormPassword(HTTPRequest request) throws java.io.IOException
ToadletContexthasFormPassword in interface ToadletContextjava.io.IOExceptionpublic UserAlertManager getAlertManager()
ToadletContextgetAlertManager in interface ToadletContextpublic BookmarkManager getBookmarkManager()
ToadletContextgetBookmarkManager in interface ToadletContextpublic MultiValueTable<java.lang.String,java.lang.String> getHeaders()
getHeaders in interface ToadletContextpublic ReceivedCookie getCookie(java.net.URI domain, java.net.URI path, java.lang.String name) throws java.text.ParseException
ToadletContextCookie (sent by the client) from the headers.getCookie in interface ToadletContextjava.text.ParseExceptionpublic void setCookie(Cookie newCookie)
ToadletContextCookie, it will be sent with the reply headers to the client.setCookie in interface ToadletContextpublic static java.util.Date parseHTTPDate(java.lang.String httpDate)
throws java.text.ParseException
java.text.ParseExceptionpublic static void handle(java.net.Socket sock,
ToadletContainer container,
PageMaker pageMaker,
UserAlertManager userAlertManager,
BookmarkManager bookmarkManager)
public Toadlet activeToadlet()
activeToadlet in interface ToadletContextpublic void writeData(byte[] data,
int offset,
int length)
throws ToadletContextClosedException,
java.io.IOException
ToadletContextwriteData in interface ToadletContextToadletContextClosedExceptionjava.io.IOExceptionpublic void writeData(byte[] data)
throws ToadletContextClosedException,
java.io.IOException
ToadletContextToadletContext.writeData(byte[], int, int).writeData in interface ToadletContextdata - The data to writeToadletContextClosedException - if the context has already been closedjava.io.IOException - if an I/O error occurspublic void writeData(Bucket data) throws ToadletContextClosedException, java.io.IOException
ToadletContextwriteData in interface ToadletContextdata - The Bucket which contains the reply data. This
function assumes ownership of the Bucket, calling free()
on it when done. If this behavior is undesired, callers
can wrap their Bucket in a NoFreeBucket.ToadletContextClosedExceptionjava.io.IOExceptionNoFreeBucketpublic BucketFactory getBucketFactory()
getBucketFactory in interface ToadletContextpublic HTMLNode addFormChild(HTMLNode parentNode, java.lang.String target, java.lang.String name)
ToadletContextaddFormChild in interface ToadletContextparentNode - The parent HTMLNode.target - Where the form should be POSTed to.name - HTML name for the form for stylesheet/script access. Will be added as both id and name.public boolean isAllowedFullAccess()
ToadletContextisAllowedFullAccess in interface ToadletContextpublic boolean isAdvancedModeEnabled()
ToadletContextisAdvancedModeEnabled in interface ToadletContextpublic boolean doRobots()
ToadletContextdoRobots in interface ToadletContextpublic void forceDisconnect()
ToadletContextforceDisconnect in interface ToadletContextpublic ToadletContainer getContainer()
getContainer in interface ToadletContextpublic boolean disableProgressPage()
disableProgressPage in interface ToadletContextpublic java.lang.String getUniqueId()
ToadletContextgetUniqueId in interface ToadletContextpublic java.net.URI getUri()
getUri in interface ToadletContextpublic FProxyFetchInProgress.REFILTER_POLICY getReFilterPolicy()
ToadletContextgetReFilterPolicy in interface ToadletContext