Mercurial > hg > IndexMetaContextualizer
comparison src/main/java/de/mpiwg/indexmeta/web/servlet/AbstractServlet.java @ 8:9ce7979fd037
Implementation Data Provider
author | Jorge Urzua <jurzua@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 24 Apr 2013 10:34:23 +0200 |
parents | bc57f2660b0f |
children |
comparison
equal
deleted
inserted
replaced
7:bc57f2660b0f | 8:9ce7979fd037 |
---|---|
8 import javax.servlet.ServletContext; | 8 import javax.servlet.ServletContext; |
9 import javax.servlet.http.HttpServlet; | 9 import javax.servlet.http.HttpServlet; |
10 import javax.servlet.http.HttpServletRequest; | 10 import javax.servlet.http.HttpServletRequest; |
11 import javax.servlet.http.HttpServletResponse; | 11 import javax.servlet.http.HttpServletResponse; |
12 | 12 |
13 import de.mpiwg.indexmeta.services.DataProvider; | |
13 import de.mpiwg.indexmeta.web.beans.AbstractBean; | 14 import de.mpiwg.indexmeta.web.beans.AbstractBean; |
14 import de.mpiwg.indexmeta.web.beans.ApplicationBean; | 15 import de.mpiwg.indexmeta.web.beans.ApplicationBean; |
15 | 16 |
16 | 17 |
17 public class AbstractServlet extends HttpServlet { | 18 public class AbstractServlet extends HttpServlet { |
18 private static final long serialVersionUID = 1L; | 19 private static final long serialVersionUID = 1L; |
19 | 20 |
20 public static String METHOD = "mt"; | 21 public static String METHOD = "mt"; |
21 public static String getCtxFromDB = "getCtxFromDB"; | 22 public static String getCtxFromDB = "getCtxFromDB"; |
23 public static String getCtxFromIndexMeta = "getCtxFromIndexMeta"; | |
24 public static String getSaveCtx = "getSaveCtx"; | |
22 | 25 |
23 public ApplicationBean getAppBean(HttpServletRequest request, HttpServletResponse response) { | 26 public ApplicationBean getAppBean(HttpServletRequest request, HttpServletResponse response) { |
24 ApplicationBean appBean = (ApplicationBean)getApplicationBean(request, response, AbstractBean.BEAN_APP); | 27 ApplicationBean appBean = (ApplicationBean)getApplicationBean(request, response, AbstractBean.BEAN_APP); |
25 | 28 |
26 | |
27 if(appBean == null){ | 29 if(appBean == null){ |
28 appBean = new ApplicationBean(); | 30 appBean = new ApplicationBean(); |
29 getFacesContext(request, response).getCurrentInstance().getExternalContext().getApplicationMap().put(AbstractBean.BEAN_APP, appBean); | 31 getFacesContext(request, response).getCurrentInstance().getExternalContext().getApplicationMap().put(AbstractBean.BEAN_APP, appBean); |
30 } | 32 } |
31 return appBean; | 33 return appBean; |
34 } | |
35 | |
36 public DataProvider getDp(HttpServletRequest request, HttpServletResponse response) { | |
37 return getAppBean(request, response).getDp(); | |
32 } | 38 } |
33 | 39 |
34 public Object getApplicationBean(HttpServletRequest request, HttpServletResponse response, String bean) { | 40 public Object getApplicationBean(HttpServletRequest request, HttpServletResponse response, String bean) { |
35 return getFacesContext(request, response).getExternalContext().getApplicationMap().get(bean); | 41 return getFacesContext(request, response).getExternalContext().getApplicationMap().get(bean); |
36 } | 42 } |