Locale userLocale = requestContext.getExternalContext().getLocale(); this.userService.createNewUser(userRegistrationFormBean, userLocale, Constants.SYSTEM_USER_ID); String emailAddress = userRegistrationFormBean.getChooseEmailAddressFormBean().getEmailAddress();
public void render() throws IOException { context.getExternalContext().getResponseWriter().write(viewId); }
public Principal getUserPrincipal() { return requestContext.getExternalContext().getCurrentUser(); }
private Locale getLocale() { RequestContext requestContext = RequestContextHolder.getRequestContext(); return (requestContext != null) ? requestContext.getExternalContext().getLocale() : LocaleContextHolder .getLocale(); }
public View resolveView(String viewId, RequestContext context) { for (ViewResolver viewResolver : viewResolvers) { try { View view = viewResolver.resolveViewName(viewId, context.getExternalContext().getLocale()); if (view != null) { return view; } } catch (Exception e) { IllegalStateException ise = new IllegalStateException("Exception resolving view with name '" + viewId + "'"); ise.initCause(e); throw ise; } } return null; }
protected Object doResolve(ELContext elContext, RequestContext requestContext, Object property) { return elContext.getELResolver().getValue(elContext, requestContext.getExternalContext(), property); } };
public Object getVariable() { return RequestContextHolder.getRequestContext().getExternalContext().getCurrentUser(); } });
protected Locale getLocale() { return getRequestContext().getExternalContext().getLocale(); }
protected Event doExecute(RequestContext context) throws Exception { String resourceUri = (String) this.resourceUri.getValue(context); context.getExternalContext().requestExternalRedirect(resourceUri); return success(); }
public void render() throws IOException { Map<String, Object> model = new HashMap<>(); model.putAll(flowScopes()); exposeBindingModel(model); model.put("flowRequestContext", requestContext); FlowExecutionKey key = requestContext.getFlowExecutionContext().getKey(); if (key != null) { model.put("flowExecutionKey", requestContext.getFlowExecutionContext().getKey().toString()); model.put("flowExecutionUrl", requestContext.getFlowExecutionUrl()); } model.put("currentUser", requestContext.getExternalContext().getCurrentUser()); try { if (logger.isDebugEnabled()) { logger.debug("Rendering MVC [" + view + "] with model map [" + model + "]"); } doRender(model); } catch (IOException e) { throw e; } catch (Exception e) { IllegalStateException ise = new IllegalStateException("Exception occurred rendering view " + view); ise.initCause(e); throw ise; } }
protected void doRender(Map<String, ?> model) throws Exception { RequestContext context = getRequestContext(); ExternalContext externalContext = context.getExternalContext(); HttpServletRequest request = (HttpServletRequest) externalContext.getNativeRequest(); HttpServletResponse response = (HttpServletResponse) externalContext.getNativeResponse(); request.setAttribute(org.springframework.web.servlet.support.RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE, context.getActiveFlow().getApplicationContext()); // spring:eval tag if (getConversionService() != null) { request.setAttribute(ConversionService.class.getName(), getConversionService().getDelegateConversionService()); } getView().render(model, request, response); }
context.getExternalContext().requestFlowDefinitionRedirect(flowDefinitionId, executionInput); return success();
/** * Bind allowed parameters in the external context request parameter map to the form object using given binder. * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" * @param binder the data binder to use * @throws Exception when an unrecoverable exception occurs */ protected void doBind(RequestContext context, DataBinder binder) throws Exception { if (logger.isDebugEnabled()) { logger.debug("Binding allowed request parameters in " + StylerUtils.style(context.getExternalContext().getRequestParameterMap()) + " to form object with name '" + binder.getObjectName() + "', pre-bind formObject toString = " + binder.getTarget()); if (binder.getAllowedFields() != null && binder.getAllowedFields().length > 0) { logger.debug("(Allowed fields are " + StylerUtils.style(binder.getAllowedFields()) + ")"); } else { logger.debug("(Any field is allowed)"); } } binder.bind(new MutablePropertyValues(context.getRequestParameters().asMap())); if (logger.isDebugEnabled()) { logger.debug("Binding completed for form object with name '" + binder.getObjectName() + "', post-bind formObject toString = " + binder.getTarget()); logger.debug("There are [" + binder.getBindingResult().getErrorCount() + "] errors, details: " + binder.getBindingResult().getAllErrors()); } }
/** * Gets the http servlet request from the context. * * @param context the context * @return the http servlet request */ public static HttpServletRequest getHttpServletRequestFromExternalWebflowContext(final RequestContext context) { Assert.isInstanceOf(ServletExternalContext.class, context.getExternalContext(), "Cannot obtain HttpServletRequest from event of type: " + context.getExternalContext().getClass().getName()); return (HttpServletRequest) context.getExternalContext().getNativeRequest(); }
public boolean isReadOnly(ELContext context, Object base, Object property) { if (base == null) { RequestContext requestContext = RequestContextHolder.getRequestContext(); if (requestContext.getExternalContext().getRequestMap().contains(property.toString()) || requestContext.getExternalContext().getSessionMap().contains(property.toString()) || requestContext.getExternalContext().getApplicationMap().contains(property.toString())) { context.setPropertyResolved(true); } } return false; }
protected Event doExecute(RequestContext context) throws Exception { String resourceUri = (String) this.resourceUri.getValue(context); context.getExternalContext().requestExternalRedirect(resourceUri); return success(); }
/** * Put public workstation into the flow if request parameter present. * * @param context the context */ public static void putPublicWorkstationToFlowIfRequestParameterPresent(final RequestContext context) { if (StringUtils.isNotBlank(context.getExternalContext().getRequestParameterMap().get(PUBLIC_WORKSTATION_ATTRIBUTE))) { context.getFlowScope().put(PUBLIC_WORKSTATION_ATTRIBUTE, Boolean.TRUE); } }
public static boolean isAsynchronousFlowRequest() { if (isFlowRequest() && RequestContextHolder.getRequestContext().getExternalContext().isAjaxRequest()) { return true; } else { return false; } }
@Override protected AbstractMvcView createMvcView(View view, RequestContext context) { final ExternalContext externalContext = context.getExternalContext(); final Object nativeRequest = externalContext.getNativeRequest(); if (nativeRequest instanceof PortletRequest) { return new PortletMvcView(view, context); } return new ServletMvcView(view, context); } }
protected Event doExecute(RequestContext context) throws Exception { super.doExecute(context); context.getExternalContext().requestFlowExecutionRedirect(); return success(); } };