| javax.servlet.http.HttpServlet org.gomba.TransactionServlet
TransactionServlet | public class TransactionServlet extends HttpServlet (Code) | | This servlet implements transactions for RESTful web services. This servlet
is used to start, commit or rollback a transaction. This servlet will be
typically mapped to /transactions/* .
HTTP methods are mapped to transaction operations in this way:
- POST
- Start a new transaction. Posting an empty resource will create a new
transaction. In the future we may add an XML document type to specify
transaction options.
- GET
- Get information about a transaction.
- PUT
- Commit a transaction. Putting an empty resource is allowed. In the
future we may support PUTting the (updated) XML data returned by GET.
- DELETE
- Rollback a transaction and destroy it.
The XML returned by this servlet in response to GET request looks like this:
<transaction>
<uri>http://domain.com/transactions/238476245jhg34589345k</uri>
<creationTime>2004-12-25T00:00:00</creationTime>
<lastAccessedTime>2004-12-25T00:10:00</lastAccessedTime>
<maxInactiveInterval>600</maxInactiveInterval>
</transaction>
TODO: provide a DTD.
Init-params:
- transaction-id
- An expression that evaluates to the transaction id. May contain ${}
parameters. This will typically be: ${path.0} (Required)
- transaction-uri
- The transaction URI. This is not a full-blown expression, ${} cannot be
used here. Only ${transaction.id} will be replaced with actual transaction
id. A typical setting is: http://domain.org/transactions/${transaction.id}.
In a sense, this the reverse of the transaction-id expression: transaction-id
is used to extract an id from a URI, while transaction-URI is used to
generate a URI from an id. (Required)
- transaction-timeout
- The transaction timeout interval for all transactions created by this
servlet. The specified timeout must be expressed in a whole number of
seconds. Since version 0.8 this value may be exceeded, it depends on when the
HarvesterThread processes the transaction. The default value is 30.
(Optional)
- jvm-route
- Identifier which must be used in load balancing scenarios to enable
session affinity. The identifier, which must be unique across all servers
which participate in the cluster, will be appended to the generated
transaction identifier, therefore allowing the front end proxy to always
forward requests that belong to a particular transaction to the same
instance. Value can be an expression evaluated at servlet initialization
time, so don't use request-related expressions. The "systemProperty"
parameter domain is particurarly useful for this setting.
author: Flavio Tordini version: $Id: TransactionServlet.java,v 1.8 2005/12/07 11:19:01 flaviotordini version: Exp $ See Also: http://www.seairth.com/web/resttp.html, See Also: http://www.xml.com/lpt/a/2004/08/11/rest.html, See Also: http://lists.xml.org/archives/xml-dev/200402/msg00267.html See Also: http://groups.yahoo.com/group/rest-discuss/message/4141 |
CONTEXT_ATTRIBUTE_NAME_SERVLET | final protected static String CONTEXT_ATTRIBUTE_NAME_SERVLET(Code) | | Name of the context attribute that holds the servlet instance.
|
CONTEXT_ATTRIBUTE_NAME_TRANSACTIONS | final protected static String CONTEXT_ATTRIBUTE_NAME_TRANSACTIONS(Code) | | Name of the context attribute that holds the transactions Map. Mapping is
transaction URI to Trasaction.
|
Methods inherited from javax.servlet.http.HttpServlet | protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) protected void doHead(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) protected void doTrace(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) protected long getLastModified(HttpServletRequest req)(Code)(Java Doc) protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException(Code)(Java Doc)
|
|
|