public class XtextServlet
extends javax.servlet.http.HttpServlet
GenericServlet.init() method:
@WebServlet(name = "Xtext Services", urlPatterns = "/xtext-service/*")
class MyXtextServlet extends XtextServlet {
override init() {
super.init();
MyDslWebSetup.doSetup();
}
}
Use the WebServlet annotation to register your servlet. The default URL pattern for
Xtext services is "/xtext-service/*".| Constructor and Description |
|---|
XtextServlet() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
protected void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
protected void |
doPut(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
protected void |
doService(org.eclipse.xtext.web.server.XtextServiceDispatcher.ServiceDescriptor service,
javax.servlet.http.HttpServletResponse response)
Invoke the service function of the given service descriptor and write its result to the
servlet response in Json format.
|
protected java.lang.String |
getEncoding(org.eclipse.xtext.web.server.XtextServiceDispatcher.ServiceDescriptor service,
org.eclipse.xtext.web.server.IServiceResult result)
Determine the encoding to apply to servlet responses.
|
protected com.google.inject.Injector |
getInjector(HttpServiceContext serviceContext)
Resolve the Guice injector for the language associated with the given context.
|
protected org.eclipse.xtext.web.server.XtextServiceDispatcher.ServiceDescriptor |
getService(javax.servlet.http.HttpServletRequest request)
Retrieve the service metadata for the given request.
|
protected boolean |
hasTextInput(org.eclipse.xtext.web.server.XtextServiceDispatcher.ServiceDescriptor service) |
protected void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
doDelete, doHead, doOptions, doTrace, getLastModified, serviceprotected void service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
java.io.IOException
service in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionjava.io.IOExceptionprotected void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
java.io.IOException
doGet in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionjava.io.IOExceptionprotected void doPut(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
java.io.IOException
doPut in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionjava.io.IOExceptionprotected void doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
java.io.IOException
doPost in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionjava.io.IOExceptionprotected boolean hasTextInput(org.eclipse.xtext.web.server.XtextServiceDispatcher.ServiceDescriptor service)
protected org.eclipse.xtext.web.server.XtextServiceDispatcher.ServiceDescriptor getService(javax.servlet.http.HttpServletRequest request)
throws org.eclipse.xtext.web.server.InvalidRequestException
XtextServiceDispatcher, and
checking the permission to invoke the service.org.eclipse.xtext.web.server.InvalidRequestExceptionprotected void doService(org.eclipse.xtext.web.server.XtextServiceDispatcher.ServiceDescriptor service,
javax.servlet.http.HttpServletResponse response)
IUnwrappableServiceResult:
here the document itself is written into the response instead of wrapping it into a Json object.protected java.lang.String getEncoding(org.eclipse.xtext.web.server.XtextServiceDispatcher.ServiceDescriptor service,
org.eclipse.xtext.web.server.IServiceResult result)
protected com.google.inject.Injector getInjector(HttpServiceContext serviceContext) throws org.eclipse.xtext.web.server.InvalidRequestException.UnknownLanguageException
org.eclipse.xtext.web.server.InvalidRequestException.UnknownLanguageException