javax.portlet.ActionRequest Java Examples
The following examples show how to use
javax.portlet.ActionRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdapterPortlet.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
public void processAction( ActionRequest request, ActionResponse response) throws PortletException, IOException { PortletTracer.info(Constants.NOME_MODULO, "AdapterPortlet", "action", "Invocato"); // set into threadLocal variables the jsr 168 portlet object PortletAccess.setPortletConfig(getPortletConfig()); PortletAccess.setPortletRequest(request); PortletAccess.setPortletResponse(response); PortletSession portletSession = request.getPortletSession(); portletSession.setAttribute("BrowserLocale", request.getLocale()); processService(request, response); }
Example #2
Source File: RenderStateTests_SPEC2_12_MutableRenderState2.java From portals-pluto with Apache License 2.0 | 6 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { ModuleTestCaseDetails tcd = new ModuleTestCaseDetails(); StringWriter writer = new StringWriter(); /* * TestCase: * V3RenderStateTests_SPEC2_12_MutableRenderState_getRenderParameters3 */ /* * Details: * "If no render parameters are available, the object will be empty." */ TestResult result = tcd.getTestResultFailed( V3RENDERSTATETESTS_SPEC2_12_MUTABLERENDERSTATE_GETRENDERPARAMETERS3); if(portletResp.getRenderParameters().isEmpty()){ result.setTcSuccess(true); } result.writeTo(writer); PortletSession ps = portletReq.getPortletSession(); ps.setAttribute(Constants.RESULT_ATTR_PREFIX + "RenderStateTests_SPEC2_12_MutableRenderState2", writer.toString()); }
Example #3
Source File: AdapterPortlet.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * Handle multipart form. * * @param request * the request * @param requestContext * the request context * * @throws Exception * the exception */ private void handleMultipartForm(ActionRequest request, RequestContextIFace requestContext) throws Exception { SourceBean serviceRequest = requestContext.getServiceRequest(); // Create a factory for disk-based file items FileItemFactory factory = new DiskFileItemFactory(); // Create a new file upload handler PortletFileUpload upload = new PortletFileUpload(factory); // Parse the request List fileItems = upload.parseRequest(request); Iterator iter = fileItems.iterator(); while (iter.hasNext()) { FileItem item = (FileItem) iter.next(); if (item.isFormField()) { String name = item.getFieldName(); String value = item.getString(); serviceRequest.setAttribute(name, value); } else { processFileField(item, requestContext); } } }
Example #4
Source File: WrapperTests_RenderResponseWrapper_ApiRender.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); }
Example #5
Source File: SigTestsWrapper_RenderRequestWrapper_SIGRender.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); }
Example #6
Source File: DispatcherTests_SPEC2_19_ForwardServletAction.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); new StringWriter(); // Now do the actual dispatch String target = SERVLET_PREFIX + "DispatcherTests_SPEC2_19_ForwardServletAction_servlet" + SERVLET_SUFFIX + "?" + QUERY_STRING; PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target); rd.forward(portletReq, portletResp); }
Example #7
Source File: DispatcherTests4_SPEC2_19_ForwardJSPEvent.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); new StringWriter(); QName eventQName = new QName(TCKNAMESPACE, "DispatcherTests4_SPEC2_19_ForwardJSPEvent"); portletResp.setEvent(eventQName, "Hi!"); }
Example #8
Source File: ActionParameterTest.java From portals-pluto with Apache License 2.0 | 5 votes |
protected TestResult checkGetActionParameter(ActionRequest request) { TestResult result = new TestResult(); result.setDescription("Ensure parameters encoded in action URL are " + "available in the action request."); String value = request.getParameter(KEY); if (value != null && value.equals(VALUE)) { result.setReturnCode(TestResult.PASSED); } else { TestUtils.failOnAssertion("parameter", value, VALUE, result); } return result; }
Example #9
Source File: EnvironmentTests_PortletContext_ApiRender.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); }
Example #10
Source File: SigTestsFilter_RenderFilter_SIGRender.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); }
Example #11
Source File: IncompletePortlet.java From portals-pluto with Apache License 2.0 | 5 votes |
@ActionMethod(portletName="IncompletePortlet", publishingEvents = { @PortletQName(namespaceURI="http://www.apache.org/", localPart="event1"), @PortletQName(namespaceURI="", localPart="event4"), }) public void doAction(ActionRequest req, ActionResponse resp) { meths.addMethod(this.getClass().getSimpleName() + "#doAction"); meths.setConfigExists(config != null); }
Example #12
Source File: AddlFilterTests_SPEC2_20_Resource.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); portletResp.setRenderParameter("tr12", "true"); }
Example #13
Source File: AnnotationMethodHandlerAdapter.java From spring4-understanding with Apache License 2.0 | 5 votes |
public boolean match(PortletRequest request) { if (!this.modes.isEmpty() && !this.modes.contains(request.getPortletMode())) { return false; } if (StringUtils.hasLength(this.phase) && !this.phase.equals(request.getAttribute(PortletRequest.LIFECYCLE_PHASE))) { return false; } if (StringUtils.hasLength(this.value)) { if (this.phase.equals(PortletRequest.ACTION_PHASE) && !this.value.equals(request.getParameter(ActionRequest.ACTION_NAME))) { return false; } else if (this.phase.equals(PortletRequest.RENDER_PHASE) && !(new WindowState(this.value)).equals(request.getWindowState())) { return false; } else if (this.phase.equals(PortletRequest.RESOURCE_PHASE) && !this.value.equals(((ResourceRequest) request).getResourceID())) { return false; } else if (this.phase.equals(PortletRequest.EVENT_PHASE)) { Event event = ((EventRequest) request).getEvent(); if (!this.value.equals(event.getName()) && !this.value.equals(event.getQName().toString())) { return false; } } } return (PortletAnnotationMappingUtils.checkRequestMethod(this.methods, request) && PortletAnnotationMappingUtils.checkParameters(this.params, request) && PortletAnnotationMappingUtils.checkHeaders(this.headers, request)); }
Example #14
Source File: AnnotationMethodHandlerAdapter.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void handleAction(ActionRequest request, ActionResponse response, Object handler) throws Exception { Object returnValue = doHandle(request, response, handler); if (returnValue != null) { throw new IllegalStateException("Invalid action method return value: " + returnValue); } }
Example #15
Source File: IMSBLTIPortlet.java From sakai with Educational Community License v2.0 | 5 votes |
public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { log.debug("==== processAction called ===="); String action = request.getParameter("sakai.action"); log.debug("sakai.action = {}", action); PortletSession pSession = request.getPortletSession(true); // Clear before Action clearErrorMessage(request); String view = (String) pSession.getAttribute("sakai.view"); log.debug("sakai.view={}", view); if ( action == null ) { // Do nothing } else if ( action.equals("main") ) { response.setPortletMode(PortletMode.VIEW); } else if ( action.equals("edit") ) { pSession.setAttribute("sakai.view", "edit"); } else if ( action.equals("edit.reset") ) { pSession.setAttribute("sakai.view","edit.reset"); } else if (action.equals("edit.setup")){ pSession.setAttribute("sakai.view","edit.setup"); } else if ( action.equals("edit.clear") ) { clearSession(request); response.setPortletMode(PortletMode.VIEW); pSession.setAttribute("sakai.view", "main"); } else if ( action.equals("edit.do.reset") ) { processActionReset(action,request, response); } else if ( action.equals("edit.save") ) { processActionSave(action,request, response); } log.debug("==== End of ProcessAction ===="); }
Example #16
Source File: Action2.java From portals-pluto with Apache License 2.0 | 5 votes |
@ActionMethod(portletName="portlet3", actionName="Barney", publishingEvents= { @PortletQName(namespaceURI="http://www.apache.org", localPart="pub3"), @PortletQName(namespaceURI="http://www.apache.org", localPart="pub4") }) public void action1c(ActionRequest req, ActionResponse resp) { meths.addMethod(this.getClass().getSimpleName() + "#action1c"); }
Example #17
Source File: PortletUtilities.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
/** * Gets the first uploaded file from a portlet request. This method creates a new file upload handler, * parses the request, processes the uploaded items and then returns the first file as an * <code>UploadedFile</code> object. * @param portletRequest The input portlet request * @return The first uploaded file object. */ public static UploadedFile getFirstUploadedFile(PortletRequest portletRequest){ UploadedFile uploadedFile = null; try{ DiskFileItemFactory factory = new DiskFileItemFactory(); // Create a new file upload handler PortletFileUpload upload = new PortletFileUpload(factory); // Parse the request List /* FileItem */ items = upload.parseRequest((ActionRequest)portletRequest); // Process the uploaded items Iterator iter = items.iterator(); boolean endLoop = false; while (iter.hasNext() && !endLoop) { FileItem item = (FileItem) iter.next(); if (item.isFormField()) { //serviceRequest.setAttribute(item.getFieldName(), item.getString()); } else { uploadedFile = new UploadedFile(); uploadedFile.setFileContent(item.get()); uploadedFile.setFieldNameInForm(item.getFieldName()); uploadedFile.setSizeInBytes(item.getSize()); uploadedFile.setFileName(item.getName()); endLoop = true; } } }catch(Exception e){ logger.error("Cannot parse multipart request", e); } return uploadedFile; }
Example #18
Source File: HandlerInterceptorAdapter.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * This implementation delegates to {@link #afterCompletion}. */ @Override public void afterActionCompletion( ActionRequest request, ActionResponse response, Object handler, Exception ex) throws Exception { afterCompletion(request, response, handler, ex); }
Example #19
Source File: URLTests_ResourceURL_ApiRenderResurl.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); }
Example #20
Source File: SigTestsFilter_EventFilter_SIGRender.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); }
Example #21
Source File: DispatcherTests2_SPEC2_19_ForwardJSPAction.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); new StringWriter(); // Now do the actual dispatch String target = JSP_PREFIX + "DispatcherTests2_SPEC2_19_ForwardJSPAction" + JSP_SUFFIX + "?" + QUERY_STRING; PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target); rd.forward(portletReq, portletResp); }
Example #22
Source File: SigTestsURL_ResourceURL_SIGRender.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); }
Example #23
Source File: ResponseTests_PortletResponse_ApiRender.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); }
Example #24
Source File: DispatcherReqRespTests5S_SPEC2_19_IncludeServletRenderRequest.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); }
Example #25
Source File: DispatcherReqRespTests3_SPEC2_19_IncludeJSPRenderResponse.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); }
Example #26
Source File: AddlPortletTests_SPEC2_8_PortletModes.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); }
Example #27
Source File: AddlPortletTests_SPEC2_13_ResourceServingCache.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); }
Example #28
Source File: AddlRequestTests_SPEC2_11_ResourceAttr.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); }
Example #29
Source File: DispatcherTests4_SPEC2_19_IncludeServletEvent.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); new StringWriter(); QName eventQName = new QName(TCKNAMESPACE, "DispatcherTests4_SPEC2_19_IncludeServletEvent"); portletResp.setEvent(eventQName, "Hi!"); }
Example #30
Source File: PortletTests_WindowState_ApiRender.java From portals-pluto with Apache License 2.0 | 5 votes |
@Override public void processAction(ActionRequest portletReq, ActionResponse portletResp) throws PortletException, IOException { portletResp.setRenderParameters(portletReq.getParameterMap()); long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); }