001
014
015 package com.liferay.taglib.ui;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.util.MethodInvoker;
020 import com.liferay.portal.kernel.util.MethodWrapper;
021 import com.liferay.portal.kernel.util.PortalClassLoaderUtil;
022 import com.liferay.portal.kernel.util.StringPool;
023
024 import javax.servlet.jsp.JspException;
025 import javax.servlet.jsp.PageContext;
026 import javax.servlet.jsp.tagext.TagSupport;
027
028
032 public class InputPermissionsParamsTag extends TagSupport {
033
034 public static String doTag(
035 String modelName, PageContext pageContext)
036 throws Exception {
037
038 Object returnObj = null;
039
040 Thread currentThread = Thread.currentThread();
041
042 ClassLoader contextClassLoader = currentThread.getContextClassLoader();
043
044 try {
045 currentThread.setContextClassLoader(
046 PortalClassLoaderUtil.getClassLoader());
047
048 MethodWrapper methodWrapper = new MethodWrapper(
049 _TAG_CLASS, _TAG_DO_END_METHOD,
050 new Object[] {modelName, pageContext}
051 );
052
053 returnObj = MethodInvoker.invoke(methodWrapper);
054 }
055 catch (Exception e) {
056 _log.error(e, e);
057 }
058 finally {
059 currentThread.setContextClassLoader(contextClassLoader);
060 }
061
062 if (returnObj != null) {
063 return returnObj.toString();
064 }
065 else {
066 return StringPool.BLANK;
067 }
068 }
069
070 public int doEndTag() throws JspException {
071 try {
072 doTag(_modelName, pageContext);
073
074 return EVAL_PAGE;
075 }
076 catch (Exception e) {
077 throw new JspException(e);
078 }
079 }
080
081 public void setModelName(String modelName) {
082 _modelName = modelName;
083 }
084
085 private static final String _TAG_CLASS =
086 "com.liferay.portal.servlet.taglib.ui.InputPermissionsParamsTagUtil";
087
088 private static final String _TAG_DO_END_METHOD = "doEndTag";
089
090 private static Log _log = LogFactoryUtil.getLog(
091 InputPermissionsParamsTag.class);
092
093 private String _modelName;
094
095 }