|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
---|---|
MappedSkwishResponseFactory | Packages a mapped skwish Provider with a skwish HTTP ResponseFactory. |
MappedUriProvider | A filter on a skwish service provider that maps input URIs to output URIs. |
QueryStringConsts | Defines some constants used by skwish in query strings. |
SkwishHttpMountPoint | Represents a skwish "mount" point on the HTTP server. |
SkwishHttpServer | An HTTP server with convenience methods for setting up skwish stores and serving entries from them. |
SkwishResponseFactory | The skwish HTTP application. |
An experimental read-only HTTP interface to skwish is provided here.
SkwishHttpServer server = SkwishHttpServer.newInstance(8880);
Or, for a debug instance that echoes output to the std out:
SkwishHttpServer server = SkwishHttpServer.newDebugInstance(8880);
Create a skwish mount point
SkwishHttpMountPoint mountPoint = server.getSkwishMountPoint("/skwish-root/", true);
/skwish-root/ will be the root URI for serving up skwish entries.
Now to serve entries from a segment store, you must create a URI
mapping to that store. Here are 2 ways you can setup such a mapping once you
have the mountPoint. The
first, assumes you already held a reference to the store before you created
the server:
// suppose you already have a reference to the store
SegmentStore store = ..
mountPoint.mapRelativeUriToSkwish("MyStore", store);
Alternatively, you can use the uri (file path) used to load the store from
the default provider (how you got the store in the snippet above, to begin
with) to map an HTTP URI to the store:
mountPoint.mapRelativeUriToSkwish("MyStore", <path-to-store>);
Start the server to begin serving HTTP requests
server.start();
Multiple mappings may be defined this way. It's okay modify mappings while
the server is running. (And it's okay to start the server before any mappings
are defined: all requests will be greeted with 404s until a mapping is defined.)
http://<server-name>/skwish-root/MyStore?id=0
retrieves the entity (entry, in skwish-speak) with id 0 from the store
in plain text (text/plain).
Recall that skwish knows nothing about the content it stores. Rather, it's
the application that does. So the server allows the client to set the
Content-Type header through the ct parameter of the query string.
To retrieve the previous entry
in HTML, for example, type:
http://<server-name>/skwish-root/MyStore?id=0&ct=text/html
(It helps if entry 0 is in fact HTML.) In the above query string, the
text/html value is strictly illegal: it should be URL-encoded, but our
parser picks it up still.
The server recognizes the following abbreviations for the ct value.
http://<server-name>/skwish-root/MyStore?id=0&tid=0
The server uses the tid parameter in order to increment the specified
entry id by the transaction gap amount.
See TxnSegment for details.
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |