1
14
15 package com.liferay.taglib.ui;
16
17 import com.liferay.portal.kernel.log.Log;
18 import com.liferay.portal.kernel.log.LogFactoryUtil;
19 import com.liferay.portal.kernel.util.MethodInvoker;
20 import com.liferay.portal.kernel.util.MethodWrapper;
21 import com.liferay.portal.kernel.util.PortalClassLoaderUtil;
22 import com.liferay.portal.kernel.util.StringPool;
23
24 import javax.servlet.jsp.JspException;
25 import javax.servlet.jsp.PageContext;
26 import javax.servlet.jsp.tagext.TagSupport;
27
28
34 public class InputPermissionsParamsTag extends TagSupport {
35
36 public static String doTag(
37 String modelName, PageContext pageContext)
38 throws Exception {
39
40 Object returnObj = null;
41
42 Thread currentThread = Thread.currentThread();
43
44 ClassLoader contextClassLoader = currentThread.getContextClassLoader();
45
46 try {
47 currentThread.setContextClassLoader(
48 PortalClassLoaderUtil.getClassLoader());
49
50 MethodWrapper methodWrapper = new MethodWrapper(
51 _TAG_CLASS, _TAG_DO_END_METHOD,
52 new Object[] {modelName, pageContext}
53 );
54
55 returnObj = MethodInvoker.invoke(methodWrapper);
56 }
57 catch (Exception e) {
58 _log.error(e, e);
59 }
60 finally {
61 currentThread.setContextClassLoader(contextClassLoader);
62 }
63
64 if (returnObj != null) {
65 return returnObj.toString();
66 }
67 else {
68 return StringPool.BLANK;
69 }
70 }
71
72 public int doEndTag() throws JspException {
73 try {
74 doTag(_modelName, pageContext);
75
76 return EVAL_PAGE;
77 }
78 catch (Exception e) {
79 throw new JspException(e);
80 }
81 }
82
83 public void setModelName(String modelName) {
84 _modelName = modelName;
85 }
86
87 private static final String _TAG_CLASS =
88 "com.liferay.portal.servlet.taglib.ui.InputPermissionsParamsTagUtil";
89
90 private static final String _TAG_DO_END_METHOD = "doEndTag";
91
92 private static Log _log = LogFactoryUtil.getLog(
93 InputPermissionsParamsTag.class);
94
95 private String _modelName;
96
97 }