use of org.apache.ofbiz.webapp.control.WebAppConfigurationException in project ofbiz-framework by apache.
the class SurveyEvents method createSurveyResponseAndRestoreParameters.
public static String createSurveyResponseAndRestoreParameters(HttpServletRequest request, HttpServletResponse response) {
// Call createSurveyResponse as an event, easier to setup and ensures parameter security
ConfigXMLReader.Event createSurveyResponseEvent = new ConfigXMLReader.Event("service", null, "createSurveyResponse", true);
RequestHandler rh = (RequestHandler) request.getAttribute("_REQUEST_HANDLER_");
ConfigXMLReader.ControllerConfig controllerConfig = rh.getControllerConfig();
String requestUri = (String) request.getAttribute("thisRequestUri");
RequestMap requestMap = null;
try {
requestMap = controllerConfig.getRequestMapMap().get(requestUri);
} catch (WebAppConfigurationException e) {
Debug.logError(e, "Exception thrown while parsing controller.xml file: ", module);
}
String eventResponse = null;
try {
eventResponse = rh.runEvent(request, response, createSurveyResponseEvent, requestMap, null);
} catch (EventHandlerException e) {
Debug.logError(e, module);
return "error";
}
if (!"success".equals(eventResponse)) {
return eventResponse;
}
// Check for an incoming _ORIG_PARAM_MAP_ID_, if present get the session stored parameter map and insert it's entries as request attributes
Map<String, Object> combinedMap = UtilHttp.getCombinedMap(request);
if (combinedMap.containsKey("_ORIG_PARAM_MAP_ID_")) {
String origParamMapId = (String) combinedMap.get("_ORIG_PARAM_MAP_ID_");
UtilHttp.restoreStashedParameterMap(request, origParamMapId);
}
return "success";
}
Aggregations