diff options
Diffstat (limited to 'org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language.web/src/main/java/org/eclipse/viatra/solver/language/web/ProblemServlet.java')
-rw-r--r-- | org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language.web/src/main/java/org/eclipse/viatra/solver/language/web/ProblemServlet.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language.web/src/main/java/org/eclipse/viatra/solver/language/web/ProblemServlet.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language.web/src/main/java/org/eclipse/viatra/solver/language/web/ProblemServlet.java new file mode 100644 index 00000000..5de708f0 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language.web/src/main/java/org/eclipse/viatra/solver/language/web/ProblemServlet.java | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * generated by Xtext 2.25.0 | ||
3 | */ | ||
4 | package org.eclipse.viatra.solver.language.web; | ||
5 | |||
6 | import com.google.inject.Injector; | ||
7 | import javax.servlet.ServletException; | ||
8 | import javax.servlet.annotation.WebServlet; | ||
9 | import org.eclipse.xtext.util.DisposableRegistry; | ||
10 | import org.eclipse.xtext.web.servlet.XtextServlet; | ||
11 | |||
12 | /** | ||
13 | * Deploy this class into a servlet container to enable DSL-specific services. | ||
14 | */ | ||
15 | @WebServlet(name = "XtextServices", urlPatterns = "/xtext-service/*") | ||
16 | public class ProblemServlet extends XtextServlet { | ||
17 | |||
18 | private static final long serialVersionUID = 1L; | ||
19 | |||
20 | DisposableRegistry disposableRegistry; | ||
21 | |||
22 | public void init() throws ServletException { | ||
23 | super.init(); | ||
24 | Injector injector = new ProblemWebSetup().createInjectorAndDoEMFRegistration(); | ||
25 | this.disposableRegistry = injector.getInstance(DisposableRegistry.class); | ||
26 | } | ||
27 | |||
28 | public void destroy() { | ||
29 | if (disposableRegistry != null) { | ||
30 | disposableRegistry.dispose(); | ||
31 | disposableRegistry = null; | ||
32 | } | ||
33 | super.destroy(); | ||
34 | } | ||
35 | |||
36 | } | ||