本文整理汇总了Java中javax.portlet.RenderRequest.getAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java RenderRequest.getAttribute方法的具体用法?Java RenderRequest.getAttribute怎么用?Java RenderRequest.getAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.portlet.RenderRequest
的用法示例。
在下文中一共展示了RenderRequest.getAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderADT
import javax.portlet.RenderRequest; //导入方法依赖的package包/类
/**
* Renders an ADT.
*
* @param request the request
* @param response the response
* @param templateCtx the template context
* @param templateUUID the UUID of the ADT (DDMTemplate object/table) to render
* @throws TemplateNotFoundException if no template having such UUID could be found
* @throws CouldNotRenderTemplateException if the template could not be rendered
*/
public void renderADT(RenderRequest request, RenderResponse response, Map<String, Object> templateCtx, String templateUUID) throws CouldNotRenderTemplateException, TemplateNotFoundException {
HttpServletRequest httpServletRequest = this.portal.getHttpServletRequest(request);
HttpServletResponse httpServletResponse = this.portal.getHttpServletResponse(response);
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
long companyId = themeDisplay.getCompanyId();
try {
List<DDMTemplate> ddmTemplates = this.getDDMTemplateLocalService().getDDMTemplatesByUuidAndCompanyId(templateUUID, companyId);
if (ddmTemplates.isEmpty()) {
throw new TemplateNotFoundException("No ADT found with companyId ["+companyId+"] and UUID ["+templateUUID+"]");
}
String renderedTemplate = this.getPortletDisplayTemplate().renderDDMTemplate(httpServletRequest, httpServletResponse, ddmTemplates.get(0), Collections.emptyList(), templateCtx);
response.getWriter().write(renderedTemplate);
} catch (Exception e) {
throw new CouldNotRenderTemplateException("Could not render from ADT [" + templateUUID + "]", e);
}
}
示例2: generateCSVOutput
import javax.portlet.RenderRequest; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static List<String> generateCSVOutput(
PortletConfig portletConfig, RenderRequest renderRequest) {
String title = (String) renderRequest.getAttribute("title");
EnumSet<ExecutionMode> executionMode =
(EnumSet<ExecutionMode>)renderRequest.getAttribute("executionMode");
Map<Company, Long> companyProcessTime =
(Map<Company, Long>)renderRequest.getAttribute(
"companyProcessTime");
Map<Company, Map<Long, List<Comparison>>> companyResultDataMap =
(Map<Company, Map<Long, List<Comparison>>>)
renderRequest.getAttribute("companyResultDataMap");
Map<Company, String> companyError =
(Map<Company, String>) renderRequest.getAttribute("companyError");
if ((executionMode == null)||(companyProcessTime == null)||
(companyResultDataMap == null)) {
return null;
}
return generateCSVOutput(
portletConfig, title, renderRequest.getLocale(), true,
companyProcessTime, companyResultDataMap, companyError);
}
示例3: render
import javax.portlet.RenderRequest; //导入方法依赖的package包/类
@Override
public void render(
RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
ThemeDisplay themeDisplay =
(ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
String portletId = portletDisplay.getId();
JSONObject urlObject = JSONFactoryUtil.createJSONObject();
JSONObject apiObject = JSONFactoryUtil.createJSONObject();
// url
PortletURL dossierInfoURL = PortletURLFactoryUtil.create(
renderRequest, portletId, themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
dossierInfoURL.setPortletMode(PortletMode.VIEW);
dossierInfoURL.setWindowState(LiferayWindowState.EXCLUSIVE);
dossierInfoURL.setParameter(
"mvcPath", "/templates/lookup_dossier/dossierinfo.ftl");
urlObject.put("dossierinfo", dossierInfoURL.toString());
// api
apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2");
apiObject.put(
"portletNamespace",
themeDisplay.getPortletDisplay().getNamespace());
// set varible
renderRequest.setAttribute("ajax", urlObject);
renderRequest.setAttribute("api", apiObject);
super.render(renderRequest, renderResponse);
}
示例4: render
import javax.portlet.RenderRequest; //导入方法依赖的package包/类
@Override
public void render(
RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
ThemeDisplay themeDisplay =
(ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
String portletId = portletDisplay.getId();
JSONObject urlObject = JSONFactoryUtil.createJSONObject();
JSONObject apiObject = JSONFactoryUtil.createJSONObject();
// url
PortletURL registerResultURL = PortletURLFactoryUtil.create(
renderRequest, portletId, themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
registerResultURL.setPortletMode(PortletMode.VIEW);
registerResultURL.setWindowState(LiferayWindowState.EXCLUSIVE);
registerResultURL.setParameter(
"mvcPath", "/templates/applicant/register_result.ftl");
urlObject.put("register_result", registerResultURL.toString());
// api
apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2");
apiObject.put(
"portletNamespace",
themeDisplay.getPortletDisplay().getNamespace());
// set varible
renderRequest.setAttribute("ajax", urlObject);
renderRequest.setAttribute("api", apiObject);
super.render(renderRequest, renderResponse);
}
示例5: render
import javax.portlet.RenderRequest; //导入方法依赖的package包/类
@Override
public void render(
RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
ThemeDisplay themeDisplay =
(ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
String portletId = portletDisplay.getId();
JSONObject urlObject = JSONFactoryUtil.createJSONObject();
JSONObject apiObject = JSONFactoryUtil.createJSONObject();
// url
PortletURL confirmPasswordURL = PortletURLFactoryUtil.create(
renderRequest, portletId, themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
confirmPasswordURL.setPortletMode(PortletMode.VIEW);
confirmPasswordURL.setWindowState(LiferayWindowState.EXCLUSIVE);
confirmPasswordURL.setParameter(
"mvcPath", "/templates/applicant/confirm_password.ftl");
urlObject.put("confirm_password", confirmPasswordURL.toString());
// api
apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2");
apiObject.put(
"portletNamespace",
themeDisplay.getPortletDisplay().getNamespace());
// set varible
renderRequest.setAttribute("ajax", urlObject);
renderRequest.setAttribute("api", apiObject);
super.render(renderRequest, renderResponse);
}
示例6: render
import javax.portlet.RenderRequest; //导入方法依赖的package包/类
@Override
public void render(
RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
ThemeDisplay themeDisplay =
(ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
String portletId = portletDisplay.getId();
JSONObject urlObject = JSONFactoryUtil.createJSONObject();
JSONObject apiObject = JSONFactoryUtil.createJSONObject();
// url
PortletURL serviceInfoLookupURL = PortletURLFactoryUtil.create(
renderRequest, portletId, themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
serviceInfoLookupURL.setPortletMode(PortletMode.VIEW);
serviceInfoLookupURL.setWindowState(LiferayWindowState.EXCLUSIVE);
serviceInfoLookupURL.setParameter(
"mvcPath", "/templates/homepage/serviceinfo_lookup.ftl");
urlObject.put("serviceinfo_lookup", serviceInfoLookupURL.toString());
// api
apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2");
apiObject.put(
"portletNamespace",
themeDisplay.getPortletDisplay().getNamespace());
// set varible
renderRequest.setAttribute("ajax", urlObject);
renderRequest.setAttribute("api", apiObject);
super.render(renderRequest, renderResponse);
}
示例7: render
import javax.portlet.RenderRequest; //导入方法依赖的package包/类
@Override
public void render(
RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
ThemeDisplay themeDisplay =
(ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
String portletId = portletDisplay.getId();
JSONObject urlObject = JSONFactoryUtil.createJSONObject();
JSONObject apiObject = JSONFactoryUtil.createJSONObject();
// url
PortletURL dossierLookupURL = PortletURLFactoryUtil.create(
renderRequest, portletId, themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
dossierLookupURL.setPortletMode(PortletMode.VIEW);
dossierLookupURL.setWindowState(LiferayWindowState.EXCLUSIVE);
dossierLookupURL.setParameter(
"mvcPath", "/templates/homepage/dossier_lookup.ftl");
urlObject.put("dossier_lookup", dossierLookupURL.toString());
// api
apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2");
apiObject.put(
"portletNamespace",
themeDisplay.getPortletDisplay().getNamespace());
// set varible
renderRequest.setAttribute("ajax", urlObject);
renderRequest.setAttribute("api", apiObject);
super.render(renderRequest, renderResponse);
}
示例8: render
import javax.portlet.RenderRequest; //导入方法依赖的package包/类
public void render(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
String portletId = portletDisplay.getId();
JSONObject urlObject = JSONFactoryUtil.createJSONObject();
JSONObject apiObject = JSONFactoryUtil.createJSONObject();
// url
PortletURL dossierLookupURL = PortletURLFactoryUtil.create(renderRequest, portletId, themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
dossierLookupURL.setPortletMode(PortletMode.VIEW);
dossierLookupURL.setWindowState(LiferayWindowState.EXCLUSIVE);
dossierLookupURL.setParameter("mvcPath", "/templates/homepage/search_serviceinfo.ftl");
urlObject.put("dossier_lookup", dossierLookupURL.toString());
// api
apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2");
apiObject.put("portletNamespace", themeDisplay.getPortletDisplay().getNamespace());
// set varible
renderRequest.setAttribute("ajax", urlObject);
renderRequest.setAttribute("api", apiObject);
super.render(renderRequest, renderResponse);
}
示例9: render
import javax.portlet.RenderRequest; //导入方法依赖的package包/类
@Override
public void render(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
String portletId = portletDisplay.getId();
JSONObject urlObject = JSONFactoryUtil.createJSONObject();
JSONObject apiObject = JSONFactoryUtil.createJSONObject();
// url
PortletURL dossierLookupURL = PortletURLFactoryUtil.create(renderRequest, portletId, themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
dossierLookupURL.setPortletMode(PortletMode.VIEW);
dossierLookupURL.setWindowState(LiferayWindowState.EXCLUSIVE);
dossierLookupURL.setParameter("mvcPath", "/templates/homepage/dossier_lookup.ftl");
urlObject.put("dossier_lookup", dossierLookupURL.toString());
// api
apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2");
apiObject.put("portletNamespace", themeDisplay.getPortletDisplay().getNamespace());
// set varible
renderRequest.setAttribute("ajax", urlObject);
renderRequest.setAttribute("api", apiObject);
super.render(renderRequest, renderResponse);
}
示例10: preHandleRender
import javax.portlet.RenderRequest; //导入方法依赖的package包/类
@Override
public boolean preHandleRender(RenderRequest request, RenderResponse response, Object handler)
throws PortletException {
if (request.getAttribute("test2-remove-never") != null) {
throw new PortletException("Wrong interceptor order");
}
request.setAttribute("test1-remove-never", "test1-remove-never");
request.setAttribute("test1-remove-post", "test1-remove-post");
request.setAttribute("test1-remove-after", "test1-remove-after");
return true;
}
示例11: postHandleRender
import javax.portlet.RenderRequest; //导入方法依赖的package包/类
@Override
public void postHandleRender(
RenderRequest request, RenderResponse response, Object handler, ModelAndView modelAndView)
throws PortletException {
if (request.getAttribute("test2-remove-post") != null) {
throw new PortletException("Wrong interceptor order");
}
if (!"test1-remove-post".equals(request.getAttribute("test1-remove-post"))) {
throw new PortletException("Incorrect request attribute");
}
request.removeAttribute("test1-remove-post");
}
示例12: afterRenderCompletion
import javax.portlet.RenderRequest; //导入方法依赖的package包/类
@Override
public void afterRenderCompletion(
RenderRequest request, RenderResponse response, Object handler, Exception ex)
throws PortletException {
if (request.getAttribute("test2-remove-after") != null) {
throw new PortletException("Wrong interceptor order");
}
request.removeAttribute("test1-remove-after");
}
示例13: render
import javax.portlet.RenderRequest; //导入方法依赖的package包/类
@Override
public String render(
StrutsPortletAction originalStrutsPortletAction,
PortletConfig portletConfig, RenderRequest renderRequest,
RenderResponse renderResponse)
throws Exception {
if (_log.isDebugEnabled()) {
_log.debug("BladePortletAction - render");
}
ThemeDisplay themeDisplay = (ThemeDisplay)renderRequest.getAttribute(
WebKeys.THEME_DISPLAY);
User loggedinUser = themeDisplay.getUser();
if (loggedinUser != null) {
loggedinUser.setLastName("BLADE");
loggedinUser.setGreeting(
"Hello," + loggedinUser.getFirstName() + " from BLADE!");
_userLocalService.updateUser(loggedinUser);
}
return originalStrutsPortletAction.render(
originalStrutsPortletAction, portletConfig, renderRequest,
renderResponse);
}
示例14: doView
import javax.portlet.RenderRequest; //导入方法依赖的package包/类
/**
* Main view
*
* @param request The request
* @param response The response
*/
@Override
public void doView(RenderRequest request, RenderResponse response) throws IOException, PortletException {
Layout currentLayout = (Layout) request.getAttribute(WebKeys.LAYOUT);
request.setAttribute(RQ_ATTR_FOUND_PORTLETS, this.serviceRef.getPortlets(currentLayout));
super.doView(request, response);
}
示例15: generateCSVOutput
import javax.portlet.RenderRequest; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static List<String> generateCSVOutput(
PortletConfig portletConfig, RenderRequest renderRequest) {
String title = (String) renderRequest.getAttribute("title");
EnumSet<ExecutionMode> executionMode =
(EnumSet<ExecutionMode>)renderRequest.getAttribute("executionMode");
Map<Company, Long> companyProcessTime =
(Map<Company, Long>)renderRequest.getAttribute(
"companyProcessTime");
Map<Company, Map<Long, List<Comparison>>> companyResultDataMap =
(Map<Company, Map<Long, List<Comparison>>>)
renderRequest.getAttribute("companyResultDataMap");
Map<Company, String> companyError =
(Map<Company, String>) renderRequest.getAttribute("companyError");
if ((executionMode == null)||(companyProcessTime == null)||
(companyResultDataMap == null)) {
return null;
}
return generateCSVOutput(
portletConfig, title, renderRequest.getLocale(),
executionMode.contains(ExecutionMode.GROUP_BY_SITE),
companyProcessTime, companyResultDataMap, companyError);
}