Examples of ExternalContext


Examples of javax.faces.context.ExternalContext

     */
    private List<ELResolver> _getFacesConfigElResolvers()
    {
        if (_facesConfigResolvers == null)
        {
            ExternalContext externalContext
                    = FacesContext.getCurrentInstance().getExternalContext();
            RuntimeConfig runtimeConfig
                    = RuntimeConfig.getCurrentInstance(externalContext);
            _facesConfigResolvers
                    = runtimeConfig.getFacesConfigElResolvers();
View Full Code Here

Examples of javax.faces.context.ExternalContext

     * @since 1.2.10, 2.0.2
     */
    @SuppressWarnings("unchecked")
    protected void sortELResolvers(List<ELResolver> resolvers)
    {
        ExternalContext externalContext
                = FacesContext.getCurrentInstance().getExternalContext();

        String comparatorClass = externalContext
                .getInitParameter(EL_RESOLVER_COMPARATOR);

        if (comparatorClass != null && !"".equals(comparatorClass))
        {
            // the user provided the parameter.

            // if we already have a cached instance, use it
            Comparator<ELResolver> comparator
                    = (Comparator<ELResolver>) externalContext.
                        getApplicationMap().get(EL_RESOLVER_COMPARATOR);
            try
            {
                if (comparator == null)
                {
                    // get the comparator class
                    Class<Comparator<ELResolver>> clazz
                             = ClassUtils.classForName(comparatorClass);

                    // create the instance
                    comparator = clazz.newInstance();

                    // cache the instance, because it will be used at least two times
                    externalContext.getApplicationMap()
                            .put(EL_RESOLVER_COMPARATOR, comparator);
                }

                // sort the resolvers
                Collections.sort(resolvers, comparator);
View Full Code Here

Examples of javax.faces.context.ExternalContext

    *           the view id
    * @return the URI without additional FacesServlet mappings
    */
   public static String normalizeRequestURI(final FacesContext context, final String viewId)
   {
      ExternalContext externalContext = context.getExternalContext();
      return normalizeRequestURI(externalContext.getRequestServletPath(), externalContext.getRequestPathInfo(), viewId);
   }
View Full Code Here

Examples of javax.faces.context.ExternalContext

      /*
       * GIVEN an ExternalContext whose encodeActionURL() method returns the URL unmodified
       */

      ExternalContext externalContext = mock(ExternalContext.class);
      when(externalContext.getRequestContextPath()).thenReturn("/myapp");
      when(externalContext.encodeActionURL(Matchers.anyString())).thenAnswer(new Answer<String>() {
         @Override
         public String answer(InvocationOnMock invocation) throws Throwable
         {
            return (String) invocation.getArguments()[0];
         }
View Full Code Here

Examples of javax.faces.context.ExternalContext

      }
   }

   private boolean redirect(final FacesContext context, final String outcome)
   {
      ExternalContext externalContext = context.getExternalContext();

      if (REWRITE_PREFIX.equals(outcome))
      {
         String target = FacesRewriteLifecycleListener.getOriginalRequestURL((HttpServletRequest) externalContext
                  .getRequest());
         String redirectUrl = externalContext.encodeRedirectURL(target, null);
         try {
            externalContext.redirect(redirectUrl);
            return true;
         }
         catch (IOException e) {
            throw new RewriteException("Could not redirect to [" + redirectUrl + "]", e);
         }
      }

      // outcomes created by Navigate for redirects
      else if (outcome != null && outcome.startsWith(REDIRECT_PREFIX)) {

         // strip the prefix to get the context-relative URL
         String relativeUrl = outcome.substring(REDIRECT_PREFIX.length());

         // add the context path
         String absoluteUrl = prependContextPath(externalContext, relativeUrl);

         // rewrite the URL
         String rewrittenUrl = externalContext.encodeActionURL(absoluteUrl);

         // send the redirect
         try {
            externalContext.redirect(rewrittenUrl);
            return true;
         }
         catch (IOException e) {
            throw new RewriteException("Could not redirect to [" + rewrittenUrl + "]", e);
         }
View Full Code Here

Examples of javax.faces.context.ExternalContext

   {
      try
      {
         PrettyContext prettyContext = PrettyContext.getCurrentInstance(context);
         PrettyConfig config = prettyContext.getConfig();
         ExternalContext externalContext = context.getExternalContext();
         String contextPath = prettyContext.getContextPath();
         if (PrettyContext.PRETTY_PREFIX.equals(action) && prettyContext.isPrettyRequest())
         {
            URL url = prettyContext.getRequestURL();
            QueryString query = prettyContext.getRequestQueryString();
View Full Code Here

Examples of javax.faces.context.ExternalContext

    @SuppressWarnings("unchecked")
    protected void doDecode(FacesContext context, UIComponent component) {
        super.doDecode(context, component);

        AbstractPopupPanel panel = (AbstractPopupPanel) component;
        ExternalContext exCtx = context.getExternalContext();
        Map<String, String> rqMap = exCtx.getRequestParameterMap();
        Object panelOpenState = rqMap.get(panel.getClientId(context) + "OpenedState");

        if (panel.isKeepVisualState()) {
            if (null != panelOpenState) {
                // Bug https://jira.jboss.org/jira/browse/RF-2466
View Full Code Here

Examples of javax.faces.context.ExternalContext

    public void view() {
        try {
            FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("appID", selectedApp.getIdapplication());
            //return "./applicationApproval.xhtml";

            ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
            context.redirect(context.getRequestContextPath() + "/faces/applicationView.xhtml");
            //FacesContext.getCurrentInstance().addMessage("userTop", new FacesMessage(FacesMessage.SEVERITY_INFO,"Success",(selectedApp.getIdapplication() + "Selected")));
        } catch (IOException ex) {
            Logger.getLogger(UserBean.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
View Full Code Here

Examples of javax.faces.context.ExternalContext

    public void display() {
        try {
            FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("appID", selectedApp.getIdapplication());
            //return "./applicationApproval.xhtml";

            ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
            context.redirect(context.getRequestContextPath() + "/faces/applicationApproval.xhtml");
            //FacesContext.getCurrentInstance().addMessage("userTop", new FacesMessage(FacesMessage.SEVERITY_INFO,"Success",(selectedApp.getIdapplication() + "Selected")));
        } catch (IOException ex) {
            Logger.getLogger(UserBean.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
View Full Code Here

Examples of javax.faces.context.ExternalContext

        try {
            ((HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false)).setAttribute("appID", selectedApp.getIdapplication());
            //FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("appID", selectedApp.getIdapplication());
            //return "./applicationApproval.xhtml";

            ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
            context.redirect(context.getRequestContextPath() + "/faces/applicationHome.xhtml");
            //FacesContext.getCurrentInstance().addMessage("userTop", new FacesMessage(FacesMessage.SEVERITY_INFO,"Success",(selectedApp.getIdapplication() + "Selected")));
        } catch (IOException ex) {
            Logger.getLogger(UserBean.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.