Package org.springframework.webflow.context

Examples of org.springframework.webflow.context.ExternalContext


  protected FlowDefinitionResource getResource(FlowDefinitionResourceFactory resourceFactory) {
    return resourceFactory.createClassPathResource("search-flow.xml", getClass());
  }

  public void testStartFlow() {
    ExternalContext context = new MockExternalContext();
    startFlow(null, context);
    assertCurrentStateEquals("enterCriteria");
  }
View Full Code Here


    /**
     * Ensures all passed attributes are part of the valid query attribute set.
     */
    public void validatePersonLookup(PersonQuery personQuery, MessageContext context) {
        final RequestContext requestContext = RequestContextHolder.getRequestContext();
        final ExternalContext externalContext = requestContext.getExternalContext();
        final Set<String> queryAttributes = personLookupHelper.getQueryAttributes(externalContext);
       
        final Map<String, Attribute> attributes = personQuery.getAttributes();
        for (final String attribute : attributes.keySet()) {
            if (!queryAttributes.contains(attribute)) {
View Full Code Here

    /**
     * Ensures all passed attributes are part of the valid query attribute set.
     */
    public void validateAttributesForm(AttributeSwapRequest attributeSwapRequest, MessageContext context) {
        final RequestContext requestContext = RequestContextHolder.getRequestContext();
        final ExternalContext externalContext = requestContext.getExternalContext();
        final Set<String> swappableAttributes = this.attributeSwapperHelper.getSwappableAttributes(externalContext);
       
        final Map<String, Attribute> currentAttributes = attributeSwapRequest.getCurrentAttributes();
        this.checkAttributesMap(context, "currentAttributes", swappableAttributes, currentAttributes);

View Full Code Here

    super(view, context);
  }

  protected void doRender(Map 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());
    getView().render(model, request, response);
  }
View Full Code Here

    super(view, context);
  }

  protected void doRender(Map model) throws Exception {
    RequestContext context = getRequestContext();
    ExternalContext externalContext = context.getExternalContext();
    View view = getView();
    PortletContext portletContext = (PortletContext) externalContext.getNativeContext();
    RenderRequest request = (RenderRequest) externalContext.getNativeRequest();
    RenderResponse response = (RenderResponse) externalContext.getNativeResponse();
    if (response.getContentType() == null) {
      // No Portlet content type specified yet -> use the view-determined type.
      // (The Portlet spec requires the content type to be set on the RenderResponse)
      String contentType = view.getContentType();
      if (contentType != null) {
View Full Code Here

   * Resolves messages.
   */
  private static class MessageSourcePropertyAccessor implements PropertyAccessor {
    public Object getProperty(Map context, Object target, Object name) throws OgnlException {
      MessageSource messageSource = (MessageSource) target;
      ExternalContext externalContext;
      Object root = Ognl.getRoot(context);
      if (root instanceof RequestContext) {
        externalContext = ((RequestContext) root).getExternalContext();
      } else {
        externalContext = ExternalContextHolder.getExternalContext();
      }
      if (externalContext != null) {
        return messageSource.getMessage(name.toString(), null, null, externalContext.getLocale());
      } else {
        return messageSource.getMessage(name.toString(), null, null, null);
      }
    }
View Full Code Here

      }
    }
  }

  private MutableAttributeMap<Object> getScopeForBean(String name) {
    ExternalContext externalContext = RequestContextHolder.getRequestContext().getExternalContext();
    if (externalContext.getRequestMap().contains(name)) {
      return externalContext.getRequestMap();
    } else if (externalContext.getSessionMap().contains(name)) {
      return externalContext.getSessionMap();
    } else if (externalContext.getApplicationMap().contains(name)) {
      return externalContext.getApplicationMap();
    }
    return null;
  }
View Full Code Here

  protected FlowDefinitionResource getResource(FlowDefinitionResourceFactory resourceFactory) {
    return resourceFactory.createClassPathResource("search-flow.xml", getClass());
  }

  public void testStartFlow() {
    ExternalContext context = new MockExternalContext();
    startFlow(null, context);
    assertCurrentStateEquals("enterCriteria");
  }
View Full Code Here

    createVariables(context);
  }

  protected void doEnter(RequestControlContext context) throws FlowExecutionException {
    context.assignFlowExecutionKey();
    ExternalContext externalContext = context.getExternalContext();
    if (externalContext.isResponseComplete()) {
      if (!externalContext.isResponseCompleteFlowExecutionRedirect()) {
        clearFlash(context);
      }
    } else {
      if (shouldRedirect(context)) {
        context.getExternalContext().requestFlowExecutionRedirect();
View Full Code Here

    View view = viewFactory.getView(context);
    context.setCurrentView(view);
    if (view.userEventQueued()) {
      boolean stateExited = handleEvent(view, context);
      if (!stateExited) {
        ExternalContext externalContext = context.getExternalContext();
        if (externalContext.isResponseComplete()) {
          if (externalContext.isResponseCompleteFlowExecutionRedirect()) {
            context.getFlashScope().put(View.USER_EVENT_STATE_ATTRIBUTE, view.getUserEventState());
          } else {
            clearFlash(context);
          }
        } else {
          if (externalContext.isAjaxRequest()) {
            render(context, view);
          } else {
            if (shouldRedirectInSameState(context)) {
              context.getFlashScope().put(View.USER_EVENT_STATE_ATTRIBUTE, view.getUserEventState());
              externalContext.requestFlowExecutionRedirect();
            } else {
              if (externalContext.isResponseAllowed()) {
                render(context, view);
              }
            }
          }
        }
View Full Code Here

TOP

Related Classes of org.springframework.webflow.context.ExternalContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.