xapi.server.ObjectServlet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xapi-dev Show documentation
Show all versions of xapi-dev Show documentation
Everything needed to run a comprehensive dev environment.
Just type X_ and pick a service from autocomplete;
new dev modules will be added as they are built.
The only dev service not included in the uber jar is xapi-dev-maven,
as it includes all runtime dependencies of maven, adding ~4 seconds to build time,
and 6 megabytes to the final output jar size (without xapi-dev-maven, it's ~1MB).
The newest version!
package xapi.server;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* A servlet class designed to expose a generic data type as a web service.
*
* Given a datatype named "Bean",
* the default url mappings will be as follows:
*
* /xapi/Bean/new/id -> new bean (never null, returns existing or new)
* /xapi/Bean/get/id -> get bean (null if id doesn't exist)
* /xapi/Bean/has/id -> check bean != null
* /xapi/Bean/del/id -> delete bean
* /xapi/Bean/set/id/data -> set bean (where data is your serialized, url encoded object)
* /xapi/Bean/patch/id/data -> update bean
*
* @author "James X. Nelson ([email protected])"
*
*/
public class ObjectServlet extends AuthedServlet{
private static final long serialVersionUID = 7384312327333846222L;
@Override
protected void doHead(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
IOException {
super.doHead(req, resp);
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doGet(req, resp);
}
@Override
protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
IOException {
super.doDelete(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
IOException {
super.doPost(req, resp);
}
@Override
protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doPut(req, resp);
}
@Override
protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
IOException {
super.doOptions(req, resp);
}
}