Package org.eclipse.jst.j2ee.common

Examples of org.eclipse.jst.j2ee.common.ParamValue


      }

      servlet = ClickUtils.createOrUpdateServletRef(webApp, config, servlet, useSpring);

      if(useSpring){
        ParamValue contextParam = CommonFactory.eINSTANCE.createParamValue();
        contextParam.setName("contextConfigLocation");
        contextParam.setValue("WEB-INF/spring-beans.xml");
        webApp.getContextParams().add(contextParam);

        Listener listener = CommonFactory.eINSTANCE.createListener();
        listener.setListenerClassName("org.springframework.web.context.ContextLoaderListener");
        webApp.getListeners().add(listener);
      }

      // Add PerformanceFilter
      if(usePerformanceFilter){
        Filter filter = WebapplicationFactory.eINSTANCE.createFilter();
        filter.setName("PerformanceFilter");
        filter.setFilterClassName("org.apache.click.extras.filter.PerformanceFilter");

        if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) {
          // J2EE 1.4
          ParamValue initParam = CommonFactory.eINSTANCE.createParamValue();
          initParam.setName("cachable-paths");
          initParam.setValue("/assets/*");
          filter.getInitParamValues().add(initParam);
        } else {
          // J2EE 1.2 or 1.3
          InitParam initParam = WebapplicationFactory.eINSTANCE.createInitParam();
          initParam.setParamName("cachable-paths");
          initParam.setParamValue("/assets/*");
          filter.getInitParams().add(initParam);
        }

        webApp.getFilters().add(filter);

        FilterMapping mapping = WebapplicationFactory.eINSTANCE.createFilterMapping();
        mapping.setServletName(servlet.getServletName());
        mapping.setFilter(filter);
        webApp.getFilterMappings().add(mapping);

        String[] filterPatterns = {"*.css", "*.js", "*.gif", "*.png"};
        for(String pattern: filterPatterns){
          mapping = WebapplicationFactory.eINSTANCE.createFilterMapping();
          mapping.setFilter(filter);
          mapping.setUrlPattern(pattern);
          webApp.getFilterMappings().add(mapping);
        }
      }

      // init mappings
      String[] listOfMappings = {"*.htm"};
      ClickUtils.setUpURLMappings(webApp, listOfMappings, servlet);

      // welcome-file-list
      ClickUtils.createOrUpdateFilelist(webApp);

      // Add Cayenne Support
      if(useCayenne){
        Filter filter = WebapplicationFactory.eINSTANCE.createFilter();
        filter.setFilterClassName(ClickUtils.CAYENNE_FILTER_CLASS);
        filter.setName("DataContextFilter");

        if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) {
          // J2EE 1.4
          ParamValue initParam = CommonFactory.eINSTANCE.createParamValue();
          initParam.setName("session-scope");
          initParam.setValue("false");
          filter.getInitParamValues().add(initParam);
        } else {
          // J2EE 1.2 or 1.3
          InitParam initParam = WebapplicationFactory.eINSTANCE.createInitParam();
          initParam.setParamName("session-scope");
          initParam.setParamValue("false");
          filter.getInitParams().add(initParam);
        }

        webApp.getFilters().add(filter);

View Full Code Here


            }
          } else {
            EList contextParams = webApp.getContextParams();
            Iterator itContextParams = contextParams.iterator();
            while (itContextParams.hasNext()) {
              ParamValue paramValue = (ParamValue)itContextParams.next();
              if (paramValue.getName().equals(CONFIG_FILES_CONTEXT_PARAM_NAME)) {
                filesString = paramValue.getValue();
                break;
              }
            }
          }         
          filesList = parseFilesString(filesString);       
View Full Code Here

    }
    EList contextParams = webApp.getContextParams();
    if (contextParams != null) {
      Iterator itContextParams = contextParams.iterator();
      while (itContextParams.hasNext()) {
        ParamValue paramValue = (ParamValue)itContextParams.next();
        paramValue.eAdapters().add(contextParamAdapter);
      }
    }
  }
View Full Code Here

    }
    EList contextParams = webApp.getContextParams();
    if (contextParams != null) {
      Iterator itContextParams = contextParams.iterator();
      while (itContextParams.hasNext()) {
        ParamValue paramValue = (ParamValue)itContextParams.next();
        paramValue.eAdapters().remove(contextParamAdapter);
      }
    }
  }
View Full Code Here

        else if ("2.4".equals(webApp.getVersion())) //$NON-NLS-1$
        {
            Iterator it = webApp.getContextParams().iterator();
            while (it.hasNext())
            {
                ParamValue cp = (ParamValue) it.next();
                if (cp.getName().equals(paramName)) {
                    webApp.getContextParams().remove(cp);
                    break;
                }
            }
        }
View Full Code Here

   * @param paramName
   * @param paramValue
   */
  public static void setupContextParamForV2_4(final WebApp webApp, String paramName, String paramValue) {
    // if not default name and location, then add context param
    ParamValue foundCP = null;
    ParamValue cp = null;
    boolean found = false;
    // check to see if present
    Iterator it = webApp.getContextParams().iterator();
    while (it.hasNext()) {
      cp = (ParamValue) it.next();
      if (cp != null &&
          cp.getName() != null &&
          cp.getName().trim().equals(paramName)) {
        foundCP = cp;
        found = true;
      }
    }
    if (!found) {
      ParamValue pv = CommonFactory.eINSTANCE.createParamValue();
      pv.setName(paramName);
      pv.setValue(paramValue);
      webApp.getContextParams().add(pv);
    } else {
      cp = foundCP;
      if (cp.getValue().indexOf(paramValue) < 0) {
        String curVal = cp.getValue();
View Full Code Here

        }
        else if ("2.4".equals(webApp.getVersion())) //$NON-NLS-1$
        {
            for (Iterator it = webApp.getContextParams().iterator(); it.hasNext();)
            {
                ParamValue cp = (ParamValue) it.next();
          if (cp != null &&
              cp.getName() != null &&
              cp.getName().trim().equals(paramName)) {
                    return cp.getValue();
                }
            }
        }
        return null;
    }
View Full Code Here

            }
          } else {
            EList contextParams = webApp.getContextParams();
            Iterator itContextParams = contextParams.iterator();
            while (itContextParams.hasNext()) {
              ParamValue paramValue = (ParamValue)itContextParams.next();
              if (paramValue.getName().equals(CONFIG_FILES_CONTEXT_PARAM_NAME)) {
                filesString = paramValue.getValue();
                break;
              }
            }
          }         
          filesList = parseFilesString(filesString);       
View Full Code Here

        else if ("2.4".equals(webApp.getVersion())) //$NON-NLS-1$
        {
            Iterator it = webApp.getContextParams().iterator();
            while (it.hasNext())
            {
                ParamValue cp = (ParamValue) it.next();
                if (cp.getName().equals(paramName)) {
                    webApp.getContextParams().remove(cp);
                    break;
                }
            }
        }
View Full Code Here

   * @param paramName
   * @param paramValue
   */
  public static void setupContextParamForV2_4(final WebApp webApp, String paramName, String paramValue) {
    // if not default name and location, then add context param
    ParamValue foundCP = null;
    ParamValue cp = null;
    boolean found = false;
    // check to see if present
    Iterator it = webApp.getContextParams().iterator();
    while (it.hasNext()) {
      cp = (ParamValue) it.next();
      if (cp != null &&
          cp.getName() != null &&
          cp.getName().trim().equals(paramName)) {
        foundCP = cp;
        found = true;
      }
    }
    if (!found) {
      ParamValue pv = CommonFactory.eINSTANCE.createParamValue();
      pv.setName(paramName);
      pv.setValue(paramValue);
      webApp.getContextParams().add(pv);
    } else {
      cp = foundCP;
      if (cp.getValue().indexOf(paramValue) < 0) {
        String curVal = cp.getValue();
View Full Code Here

TOP

Related Classes of org.eclipse.jst.j2ee.common.ParamValue

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.