javax.portlet.ActionResponse Java Examples

The following examples show how to use javax.portlet.ActionResponse. 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: AuthSCPortlet.java    From portals-pluto with Apache License 2.0 6 votes vote down vote up
public void processAction(ActionRequest req, ActionResponse resp)
      throws PortletException, IOException {

   String scText = ap.getValue(PARAM_STATUSCODE);
   if (scText != null && scText.matches("\\d+")) {
      mrp.set(ap);
   }

   if (isDebug) {
      StringBuffer sb = new StringBuffer();
      sb.append("Long portlet action parameters:");
      for (String k : ap.getNames()) {
         sb.append("\nName: ").append(k);
         sb.append(", Values: ").append(Arrays.toString(ap.getValues(k)));
      }
      logger.debug(sb.toString());
   }

}
 
Example #2
Source File: PreferencesActionController.java    From portals-pluto with Apache License 2.0 6 votes vote down vote up
@ActionMethod(portletName = "portlet1", actionName = "submitPreferences")
@CsrfProtected
public void submitPreferences(ActionRequest actionRequest, ActionResponse actionResponse) {

	ResourceBundle resourceBundle = portletConfig.getResourceBundle(actionRequest.getLocale());

	models.put("preferences", new Preferences(datePattern));

	Set<ParamError> bindingErrors = bindingResult.getAllErrors();

	if (bindingErrors.isEmpty()) {

		try {
			portletPreferences.setValue("datePattern", datePattern);
			portletPreferences.store();
			actionResponse.setPortletMode(PortletMode.VIEW);
			actionResponse.setWindowState(WindowState.NORMAL);
			models.put("globalInfoMessage", resourceBundle.getString("your-request-processed-successfully"));
		}
		catch (Exception e) {
			models.put("globalErrorMessage", resourceBundle.getString("an-unexpected-error-occurred"));
			logger.error(e.getMessage(), e);
		}
	}
}
 
Example #3
Source File: FilterTests_PortletFilter_ApiActionFilter.java    From portals-pluto with Apache License 2.0 6 votes vote down vote up
@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);

  StringWriter writer = new StringWriter();

  PortletSession ps = portletReq.getPortletSession();
  String msg =
      (String) ps.getAttribute(RESULT_ATTR_PREFIX + "FilterTests_PortletFilter_ApiActionFilter",
          APPLICATION_SCOPE);
  portletReq.getPortletSession().setAttribute(
      Constants.RESULT_ATTR_PREFIX + "FilterTests_PortletFilter_ApiActionFilter",
      msg + writer.toString(), APPLICATION_SCOPE);

}
 
Example #4
Source File: IMSBLTIPortlet.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processActionReset(String action,ActionRequest request, ActionResponse response)
throws PortletException, IOException {

	// TODO: Check Role
	log.debug("Removing preferences....");
	clearSession(request);
	PortletSession pSession = request.getPortletSession(true);
	PortletPreferences prefs = request.getPreferences();
	try {
		prefs.reset("sakai.descriptor");
		for (String element : fieldList) {
			prefs.reset("imsti."+element);
			prefs.reset("sakai:imsti."+element);
		}
		log.debug("Preference removed");
	} catch (ReadOnlyException e) {
		setErrorMessage(request, rb.getString("error.modify.prefs")) ;
		return;
	}
	prefs.store();

	// Go back to the main edit page
	pSession.setAttribute("sakai.view", "edit");
}
 
Example #5
Source File: RenderStateTests_SPEC2_12_MutableRenderState2.java    From portals-pluto with Apache License 2.0 6 votes vote down vote up
@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 #6
Source File: DispatcherReqRespTests4_SPEC2_19_IncludeServletResourceRequest.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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 #7
Source File: AddlPortletTests_SPEC2_15_EventEventHandling.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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);

  QName eventQName = new QName(TCKNAMESPACE, "AddlPortletTests_SPEC2_15_EventEventHandling");
  portletResp.setEvent(eventQName, "Hi!");

  V2AddlPortletTests_SPEC2_15_EventEventHandling_eventData eventData =
      new V2AddlPortletTests_SPEC2_15_EventEventHandling_eventData();
  eventData.setTr14("true");
  QName eventQName_serializableData =
      new QName(TCKNAMESPACE, "AddlPortletTests_SPEC2_15_EventEventHandling_serializableData");
  portletResp.setEvent(eventQName_serializableData, eventData);

  portletResp.setEvent("AddlPortletTests_SPEC2_15_EventEventHandling_empty", null);

  QName eventQName_exceptionEvent =
      new QName(TCKNAMESPACE, "AddlPortletTests_SPEC2_15_EventEventHandling_exceptionEvent");
  portletResp.setEvent(eventQName_exceptionEvent, "Hi!");

  if (!AddlPortletTests_SPEC2_15_EventEventHandling_event.tr8) {
    QName eventQName_unavailableExceptionEvent = new QName(TCKNAMESPACE,
        "AddlPortletTests_SPEC2_15_EventEventHandling_unavailableExceptionEvent");
    portletResp.setEvent(eventQName_unavailableExceptionEvent, "Hi!");
  }

}
 
Example #8
Source File: DispatcherReqRespTests5S_SPEC2_19_IncludeJSPRenderRequest.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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 #9
Source File: DispatcherTests_SPEC2_19_DispatchServletEvent.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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);

   QName eventQName = new QName(TCKNAMESPACE,
          "DispatcherTests_SPEC2_19_DispatchServletEvent");
   portletResp.setEvent(eventQName, new TckParameters(portletReq.getParameterMap()));
}
 
Example #10
Source File: DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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);

   QName eventQName = new QName(TCKNAMESPACE,
          "DispatcherReqRespTests2_SPEC2_19_ForwardServletEventRequest");
   portletResp.setEvent(eventQName, "Hi!");
}
 
Example #11
Source File: SigTestsURL_BaseURL_SIGResourceRenurl.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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 #12
Source File: EnvironmentTests_PortletSession_ApiRender.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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 #13
Source File: SigTestsWrapper_ActionRequestWrapper_SIGRender.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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 #14
Source File: SigTestsEnv_ProcessEvent_SIGRender.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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 #15
Source File: SigTestsEvent_Event_SIGEvent.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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);

  QName eventQName = new QName(TCKNAMESPACE, "SigTestsEvent_Event_SIGEvent");
  portletResp.setEvent(eventQName, "Hi!");
}
 
Example #16
Source File: SigTestsEnv_PortletMode_SIGRender.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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 #17
Source File: EnvironmentTests_PortletContext_ApiRender2.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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 #18
Source File: WrapperTests_RenderResponseWrapper_ApiRender.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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 #19
Source File: DispatcherReqRespTests3_SPEC2_19_IncludeJSPRenderResponse.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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: AddlRequestTests_SPEC2_11_RenderAttr.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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: FilterTests_RenderFilter_ApiRenderFilter.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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 #22
Source File: PortletIFrame.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {

	// log.info("==== processAction called ====");

	PortletSession pSession = request.getPortletSession(true);

	// Our first challenge is to figure out which action we want to take
	// The view selects the "next action" either as a URL parameter
	// or as a hidden field in the POST data - we check both

	String doCancel = request.getParameter("sakai.cancel");
	String doUpdate = request.getParameter("sakai.update");

	// Our next challenge is to pick which action the previous view
	// has told us to do.  Note that the view may place several actions
	// on the screen and the user may have an option to pick between
	// them.  Make sure we handle the "no action" fall-through.

	pSession.removeAttribute("error.message");

	if ( doCancel != null ) {
		response.setPortletMode(PortletMode.VIEW);
	} else if ( doUpdate != null ) {
		processActionEdit(request, response);
	} else {
		// log.info("Unknown action");
		response.setPortletMode(PortletMode.VIEW);
	}

	// log.info("==== End of ProcessAction  ====");
}
 
Example #23
Source File: PortletIFrame.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {

	// log.info("==== processAction called ====");

	PortletSession pSession = request.getPortletSession(true);

	// Our first challenge is to figure out which action we want to take
	// The view selects the "next action" either as a URL parameter
	// or as a hidden field in the POST data - we check both

	String doCancel = request.getParameter("sakai.cancel");
	String doUpdate = request.getParameter("sakai.update");

	// Our next challenge is to pick which action the previous view
	// has told us to do.  Note that the view may place several actions
	// on the screen and the user may have an option to pick between
	// them.  Make sure we handle the "no action" fall-through.

	pSession.removeAttribute("error.message");

	if ( doCancel != null ) {
		response.setPortletMode(PortletMode.VIEW);
	} else if ( doUpdate != null ) {
		processActionEdit(request, response);
	} else {
		// log.info("Unknown action");
		response.setPortletMode(PortletMode.VIEW);
	}

	// log.info("==== End of ProcessAction  ====");
}
 
Example #24
Source File: ResponseTests_EventResponse_ApiEvent.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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);

   QName eventQName = new QName(TCKNAMESPACE,
         "ResponseTests_EventResponse_ApiEvent");
   portletResp.setEvent(eventQName, "Hi!");
}
 
Example #25
Source File: SigTestsRender_RenderRequest_SIGRender.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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: EnvironmentTests_PortletContext_ApiRender.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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: URLTests_ResourceURL_ApiRenderResurl.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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: SigTestsEnv_Portlet_SIGRender.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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: AddlRequestTests_SPEC2_11_RenderReq.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
@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 #30
Source File: AddlEnvironmentTests_SPEC2_17_RenderPreferences.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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);

}