Examples of WebappIntegrator


Examples of org.infoglue.common.webappintegrator.WebappIntegrator

  public int doEndTag() throws JspException
    {
    try
    {
      WebappIntegrator wi = new WebappIntegrator();
     
      if(getController().getHttpServletRequest().getMethod().equalsIgnoreCase("post"))
        wi.setMethod("post");
     
      wi.setReferrer(getController().getCurrentPageUrl());
      wi.setTimeout(timeout);
      wi.setUserAgent("" + getController().getHttpServletRequest().getHeader("user-agent"));

      Map<String,String> proxyCookies = (Map<String,String>)pageContext.getSession().getAttribute("proxyCookies");
      logger.info("proxyCookies:" + proxyCookies);
      if(proxyCookies != null)
      {
        for(Map.Entry<String,String> proxyCookie : proxyCookies.entrySet())
        {
          logger.info("Setting ProxyCookie: " + proxyCookie.getKey() + "=" + proxyCookie.getValue());
          cookies.put(proxyCookie.getKey(), proxyCookie.getValue());
        }
      }

      wi.setCookies(cookies);
     
      logger.info("Adding all params:" + getController().getHttpServletRequest().getParameterMap());
      Enumeration paramsEnumeration = getController().getHttpServletRequest().getParameterNames();
      while(paramsEnumeration.hasMoreElements())
      {
        String parameterName = (String)paramsEnumeration.nextElement();
        if(parameterName.equals("siteNodeId") || parameterName.equals("originalRequestURL") || parameterName.equals("refresh"))
          continue;
       
        String value = getController().getHttpServletRequest().getParameter(parameterName);
       
        if(parameterName.startsWith("igproxy_"))
          parameterName = parameterName.replaceAll("igproxy_", "");
         
        requestParameters.put(parameterName, value);
      }
      wi.setRequestParameters(requestParameters);

      logger.info("RequestHeaders:" + getController().getHttpServletRequest().getHeaderNames());
      Enumeration headersEnumeration = getController().getHttpServletRequest().getHeaderNames();
      while(headersEnumeration.hasMoreElements())
      {
        String headerName = (String)headersEnumeration.nextElement();
        logger.info("headerName:" + headerName + "=" + getController().getHttpServletRequest().getHeader(headerName));
        requestProperties.put(headerName, getController().getHttpServletRequest().getHeader(headerName));
      }
     
      wi.setRequestProperties(requestProperties);

      wi.setCurrentBaseUrl(getController().getCurrentPageUrl());
      wi.setUrlToIntegrate(url);
      logger.info("this.elementSelector:" + this.elementSelector);
      wi.setElementSelector(this.elementSelector);
     
      wi.setProxyHost(proxyHost);
      wi.setProxyPort(proxyPort);
     
      Map<String,String> returnCookies = new HashMap<String,String>();
      Map<String,String> returnHeaders = new HashMap<String,String>();
      Map<String,String> returnStatus = new HashMap<String,String>();
     
      List<String> blockedParameters = new ArrayList<String>();
      blockedParameters.add("siteNodeId");
      blockedParameters.add("contentId");
      blockedParameters.add("languageId");
      blockedParameters.add("proxyUrl");
      produceResult(wi.integrate(returnCookies, returnHeaders, returnStatus, blockedParameters, hrefExclusionRegexp, linkExclusionRegexp, srcExclusionRegexp));
     
      pageContext.setAttribute("returnCookies", returnCookies);
      pageContext.setAttribute("returnHeaders", returnHeaders);
      pageContext.setAttribute("returnStatus", returnStatus);
     
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.