本文整理汇总了Java中javax.portlet.RenderRequest类的典型用法代码示例。如果您正苦于以下问题:Java RenderRequest类的具体用法?Java RenderRequest怎么用?Java RenderRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RenderRequest类属于javax.portlet包,在下文中一共展示了RenderRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import javax.portlet.RenderRequest; //导入依赖的package包/类
@Override
public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException {
_log.info("render()");
try {
TaskRecord taskRecord = ActionUtil.getTaskRecord(renderRequest);
renderRequest.setAttribute(TimetrackerWebKeys.TASK_RECORD, taskRecord);
} catch (Exception e) {
if (e instanceof NoSuchTaskRecordException || e instanceof PrincipalException) {
SessionErrors.add(renderRequest, e.getClass());
return "/error.jsp";
} else {
throw new PortletException(e);
}
}
return getPath();
}
示例2: doEdit
import javax.portlet.RenderRequest; //导入依赖的package包/类
/**
* Routes between global configuration editing and tab editing
*
* @param request The request
* @param response The response
* @throws PortletException If something goes wrong
* @throws IOException If something goes wrong
*/
@Override
protected void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException {
// Very, very simple routing. That's all we need, folks.
String editModeParam = ParamUtil.get(request, PortletRequestParameter.EDIT_MODE.getName(), StringPool.BLANK);
EditMode editMode = EditMode.getEditMode(editModeParam);
switch(editMode) {
case TAB:
this.doEditTab(request, response);
break;
case FACET:
this.doEditFacet(request, response);
break;
default:
this.doEditGlobal(request, response);
break;
}
}
示例3: 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);
}
}
示例4: render
import javax.portlet.RenderRequest; //导入依赖的package包/类
@Override
public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException {
_log.info("render()");
try {
Contact contact = ActionUtil.getContact(renderRequest);
renderRequest.setAttribute(ContactManagerWebKeys.CONTACT, contact);
} catch (Exception e) {
if (e instanceof NoSuchContactException || e instanceof PrincipalException) {
SessionErrors.add(renderRequest, e.getClass());
return "/error.jsp";
} else {
throw new PortletException(e);
}
}
return getPath();
}
示例5: renderFromMobilink
import javax.portlet.RenderRequest; //导入依赖的package包/类
private void renderFromMobilink(
RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
renderFrontendWebEmployeePortlet(renderRequest, renderResponse);
renderFrontendWebJobposPortlet(renderRequest, renderResponse);
renderFrontendWebAdminPortlet(renderRequest, renderResponse);
renderFrontendWebWorkingUnitPortlet(renderRequest, renderResponse);
renderFrontendWebNotificationPortlet(renderRequest, renderResponse);
renderRequest.setAttribute(
"url", generateURLCommon(renderRequest, renderResponse));
renderRequest.setAttribute("constants", generalConstantsCommon(renderRequest));
renderRequest.setAttribute("param", generalParamsCommon(renderRequest));
}
示例6: render
import javax.portlet.RenderRequest; //导入依赖的package包/类
@Override
public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException {
// Get Mode
String mode = ParamUtil.getString(
renderRequest,
LDFPortletKeys.MODE,
LDFPortletKeys.MODE_ORGANIZAION);
// Carry around mode
renderRequest.setAttribute(LDFPortletKeys.MODE, mode);
if(_log.isDebugEnabled()) {
_log.debug("mode <" + mode + ">");
_log.debug("jsp <" + _commonUtil
.getPageFromMode()
.getOrDefault(mode, LDFPortletKeys.JSP_ORGANIZAION) + ">");
}
return _commonUtil
.getPageFromMode()
.getOrDefault(mode, LDFPortletKeys.JSP_ORGANIZAION);
}
示例7: render
import javax.portlet.RenderRequest; //导入依赖的package包/类
@Override
public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException {
_log.info("render()");
try {
Measurement measurement = ActionUtil.getMeasurement(renderRequest);
renderRequest.setAttribute(DataManagerWebKeys.MEASUREMENT, measurement);
} catch (Exception e) {
if (e instanceof NoSuchMeasurementException || e instanceof PrincipalException) {
SessionErrors.add(renderRequest, e.getClass());
return "/error.jsp";
} else {
throw new PortletException(e);
}
}
return getPath();
}
示例8: 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);
}
示例9: determineDefaultPhase
import javax.portlet.RenderRequest; //导入依赖的package包/类
private String determineDefaultPhase(Method handlerMethod) {
if (void.class != handlerMethod.getReturnType()) {
return PortletRequest.RENDER_PHASE;
}
for (Class<?> argType : handlerMethod.getParameterTypes()) {
if (ActionRequest.class.isAssignableFrom(argType) || ActionResponse.class.isAssignableFrom(argType) ||
InputStream.class.isAssignableFrom(argType) || Reader.class.isAssignableFrom(argType)) {
return PortletRequest.ACTION_PHASE;
}
else if (RenderRequest.class.isAssignableFrom(argType) || RenderResponse.class.isAssignableFrom(argType) ||
OutputStream.class.isAssignableFrom(argType) || Writer.class.isAssignableFrom(argType)) {
return PortletRequest.RENDER_PHASE;
}
else if (ResourceRequest.class.isAssignableFrom(argType) || ResourceResponse.class.isAssignableFrom(argType)) {
return PortletRequest.RESOURCE_PHASE;
}
else if (EventRequest.class.isAssignableFrom(argType) || EventResponse.class.isAssignableFrom(argType)) {
return PortletRequest.EVENT_PHASE;
}
}
return "";
}
示例10: handleRenderRequest
import javax.portlet.RenderRequest; //导入依赖的package包/类
@Override
public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse response) throws Exception {
// If the portlet is minimized and we don't want to render then return null.
if (WindowState.MINIMIZED.equals(request.getWindowState()) && !this.renderWhenMinimized) {
return null;
}
// Delegate to PortletContentGenerator for checking and preparing.
checkAndPrepare(request, response);
// Execute in synchronized block if required.
if (this.synchronizeOnSession) {
PortletSession session = request.getPortletSession(false);
if (session != null) {
Object mutex = PortletUtils.getSessionMutex(session);
synchronized (mutex) {
return handleRenderRequestInternal(request, response);
}
}
}
return handleRenderRequestInternal(request, response);
}
示例11: processHandlerException
import javax.portlet.RenderRequest; //导入依赖的package包/类
/**
* Determine an error ModelAndView via the registered HandlerExceptionResolvers.
* @param request current portlet request
* @param response current portlet response
* @param handler the executed handler, or null if none chosen at the time of
* the exception (for example, if multipart resolution failed)
* @param ex the exception that got thrown during handler execution
* @return a corresponding ModelAndView to forward to
* @throws Exception if no error ModelAndView found
*/
protected ModelAndView processHandlerException(
RenderRequest request, RenderResponse response, Object handler, Exception ex)
throws Exception {
ModelAndView exMv = null;
for (Iterator<HandlerExceptionResolver> it = this.handlerExceptionResolvers.iterator(); exMv == null && it.hasNext();) {
HandlerExceptionResolver resolver = it.next();
exMv = resolver.resolveException(request, response, handler, ex);
}
if (exMv != null) {
if (logger.isDebugEnabled()) {
logger.debug("HandlerExceptionResolver returned ModelAndView [" + exMv + "] for exception");
}
logger.warn("Handler execution resulted in exception - forwarding to resolved error view", ex);
return exMv;
}
else {
throw ex;
}
}
示例12: triggerAfterRenderCompletion
import javax.portlet.RenderRequest; //导入依赖的package包/类
/**
* Trigger afterCompletion callbacks on the mapped HandlerInterceptors.
* Will just invoke afterCompletion for all interceptors whose preHandle
* invocation has successfully completed and returned true.
* @param mappedHandler the mapped HandlerExecutionChain
* @param interceptorIndex index of last interceptor that successfully completed
* @param ex Exception thrown on handler execution, or null if none
* @see HandlerInterceptor#afterRenderCompletion
*/
private void triggerAfterRenderCompletion(HandlerExecutionChain mappedHandler, int interceptorIndex,
RenderRequest request, RenderResponse response, Exception ex)
throws Exception {
// Apply afterCompletion methods of registered interceptors.
if (mappedHandler != null) {
HandlerInterceptor[] interceptors = mappedHandler.getInterceptors();
if (interceptors != null) {
for (int i = interceptorIndex; i >= 0; i--) {
HandlerInterceptor interceptor = interceptors[i];
try {
interceptor.afterRenderCompletion(request, response, mappedHandler.getHandler(), ex);
}
catch (Throwable ex2) {
logger.error("HandlerInterceptor.afterCompletion threw exception", ex2);
}
}
}
}
}
示例13: testNativeRequest
import javax.portlet.RenderRequest; //导入依赖的package包/类
@Test
public void testNativeRequest() {
MockRenderRequest portletRequest = new MockRenderRequest();
MockRenderResponse portletResponse = new MockRenderResponse();
PortletWebRequest request = new PortletWebRequest(portletRequest, portletResponse);
assertSame(portletRequest, request.getNativeRequest());
assertSame(portletRequest, request.getNativeRequest(PortletRequest.class));
assertSame(portletRequest, request.getNativeRequest(RenderRequest.class));
assertSame(portletRequest, request.getNativeRequest(MockRenderRequest.class));
assertNull(request.getNativeRequest(MultipartRequest.class));
assertSame(portletResponse, request.getNativeResponse());
assertSame(portletResponse, request.getNativeResponse(PortletResponse.class));
assertSame(portletResponse, request.getNativeResponse(RenderResponse.class));
assertSame(portletResponse, request.getNativeResponse(MockRenderResponse.class));
assertNull(request.getNativeResponse(MultipartRequest.class));
}
示例14: testDecoratedNativeRequest
import javax.portlet.RenderRequest; //导入依赖的package包/类
@Test
public void testDecoratedNativeRequest() {
MockRenderRequest portletRequest = new MockRenderRequest();
MockRenderResponse portletResponse = new MockRenderResponse();
PortletRequest decoratedRequest = new PortletRequestWrapper(portletRequest);
PortletResponse decoratedResponse = new PortletResponseWrapper(portletResponse);
PortletWebRequest request = new PortletWebRequest(decoratedRequest, decoratedResponse);
assertSame(decoratedRequest, request.getNativeRequest());
assertSame(decoratedRequest, request.getNativeRequest(PortletRequest.class));
assertSame(portletRequest, request.getNativeRequest(RenderRequest.class));
assertSame(portletRequest, request.getNativeRequest(MockRenderRequest.class));
assertNull(request.getNativeRequest(MultipartRequest.class));
assertSame(decoratedResponse, request.getNativeResponse());
assertSame(decoratedResponse, request.getNativeResponse(PortletResponse.class));
assertSame(portletResponse, request.getNativeResponse(RenderResponse.class));
assertSame(portletResponse, request.getNativeResponse(MockRenderResponse.class));
assertNull(request.getNativeResponse(MultipartRequest.class));
}
示例15: doView
import javax.portlet.RenderRequest; //导入依赖的package包/类
/**
* Routes between search results and single asset view
*
* @param request The request
* @param response The response
* @throws PortletException If something goes wrong
* @throws IOException If something goes wrong
*/
@Override
protected void doView(RenderRequest request, RenderResponse response) throws IOException, PortletException {
String viewModeParam = ParamUtil.getString(request, PortletRequestParameter.VIEW_MODE.getName(), StringPool.BLANK);
ViewMode viewMode = ViewMode.getViewMode(viewModeParam);
switch(viewMode) {
case VIEW_JOURNAL:
this.doViewJournal(request, response);
break;
default:
this.doViewResults(request, response);
break;
}
}