1
14
15 package com.liferay.taglib.aui;
16
17 import com.liferay.portal.kernel.util.ServerDetector;
18
19 import javax.servlet.jsp.JspException;
20 import javax.servlet.jsp.tagext.BodyTagSupport;
21
22
28 public class ModelContextTag extends BodyTagSupport {
29
30 public int doEndTag() throws JspException {
31 try{
32 return super.doEndTag();
33 }
34 catch (Exception e) {
35 throw new JspException(e);
36 }
37 finally {
38 if (!ServerDetector.isResin()) {
39 _bean = null;
40 _model = null;
41 }
42 }
43 }
44
45 public int doStartTag() {
46 if (_model != null) {
47 pageContext.setAttribute("aui:model-context:bean", _bean);
48 pageContext.setAttribute("aui:model-context:model", _model);
49 }
50 else {
51 pageContext.removeAttribute("aui:model-context:bean");
52 pageContext.removeAttribute("aui:model-context::model");
53 }
54
55 return SKIP_BODY;
56 }
57
58 public void setBean(Object bean) {
59 _bean = bean;
60 }
61
62 public void setModel(Class<?> model) {
63 _model = model;
64 }
65
66 private Object _bean;
67 private Class<?> _model;
68
69 }