Package org.eclipse.jst.j2ee.webapplication

Examples of org.eclipse.jst.j2ee.webapplication.ServletMapping


    if (servletName != null) {
      @SuppressWarnings("unchecked")
      Iterator oldMappings = webApp.getServletMappings().iterator();
     
      while (oldMappings.hasNext()) {
        ServletMapping mapping = (ServletMapping) oldMappings.next();
        if (mapping.getServlet().getServletName().equals(servletName)) {
          webApp.getServletMappings().remove(mapping);
        }
      }
    }
  }
View Full Code Here


  @SuppressWarnings("unchecked")
  public static void setUpURLMappings(WebApp webApp, String[] urlMappingList, Servlet servlet) {
    // Add mappings
    for (int i=0;i<urlMappingList.length;i++) {
      String pattern = urlMappingList[i];
      ServletMapping mapping = WebapplicationFactory.eINSTANCE.createServletMapping();
      mapping.setServlet(servlet);
      mapping.setName(servlet.getServletName());
      mapping.setUrlPattern(pattern);
      webApp.getServletMappings().add(mapping);
    }
  }
View Full Code Here

      EList servlets = webApp.getServlets();
      for (Iterator i = servlets.iterator(); i.hasNext();) {
        Servlet servlet = (Servlet) i.next();
        WebType webType = servlet.getWebType();
        if (webType instanceof ServletType && ((ServletType) webType).getClassName().endsWith(getRemoteInterfaceName().concat("Impl"))) {
          ServletMapping servletMapping = webApp.getServletMapping(servlet);
          servlets.remove(servlet);
          webApp.getServletMappings().remove(servletMapping);
          break;
        }
      }
View Full Code Here

      IVirtualComponent component = ComponentCore.createComponent(Util.getProject(projectText));
      WebArtifactEdit artifactEdit = WebArtifactEdit.getWebArtifactEditForWrite(component);
      WebApp webApp = (WebApp) artifactEdit.getContentModelRoot();
      webApp.getServlets().add(servlet);

      ServletMapping mapping = WebapplicationFactory.eINSTANCE.createServletMapping();
      mapping.setServlet(servlet);
      mapping.setName(servlet.getServletName());
      mapping.setUrlPattern("/" + serviceUri);
      webApp.getServletMappings().add(mapping);

      artifactEdit.saveIfNecessary(monitor);

      artifactEdit.dispose();
View Full Code Here

      IVirtualComponent component = ComponentCore.createComponent(Util.getProject(projectText));
      WebArtifactEdit artifactEdit = WebArtifactEdit.getWebArtifactEditForWrite(component);
      WebApp webApp = (WebApp) artifactEdit.getContentModelRoot();
      webApp.getServlets().add(servlet);

      ServletMapping mapping = WebapplicationFactory.eINSTANCE.createServletMapping();
      mapping.setServlet(servlet);
      mapping.setName(servlet.getServletName());
      mapping.setUrlPattern("/" + serviceUri);
      webApp.getServletMappings().add(mapping);

      artifactEdit.saveIfNecessary(monitor);

      artifactEdit.dispose();
View Full Code Here

      IVirtualComponent component = ComponentCore.createComponent(Util.getProject(projectText));
      WebArtifactEdit artifactEdit = WebArtifactEdit.getWebArtifactEditForWrite(component);
      WebApp webApp = (WebApp) artifactEdit.getContentModelRoot();
      webApp.getServlets().add(servlet);

      ServletMapping mapping = WebapplicationFactory.eINSTANCE.createServletMapping();
      mapping.setServlet(servlet);
      mapping.setName(servlet.getServletName());
      mapping.setUrlPattern("/" + serviceUri);
      webApp.getServletMappings().add(mapping);

      artifactEdit.saveIfNecessary(monitor);

      artifactEdit.dispose();
View Full Code Here

      IVirtualComponent component = ComponentCore.createComponent(Util.getProject(projectText));
      WebArtifactEdit artifactEdit = WebArtifactEdit.getWebArtifactEditForWrite(component);
      WebApp webApp = (WebApp) artifactEdit.getContentModelRoot();
      webApp.getServlets().add(servlet);

      ServletMapping mapping = WebapplicationFactory.eINSTANCE.createServletMapping();
      mapping.setServlet(servlet);
      mapping.setName(servlet.getServletName());
      mapping.setUrlPattern("/" + serviceUri);
      webApp.getServletMappings().add(mapping);

      artifactEdit.saveIfNecessary(monitor);

      artifactEdit.dispose();
View Full Code Here

          servletType.setClassName( "com.formgen.core.FormGenServlet" );
          servlet.setWebType( servletType );
          servlet.setServletName( "FormGenServlet" );
          root.getServlets().add( servlet );
 
          final ServletMapping mapping
              = WebapplicationFactory.eINSTANCE.createServletMapping();
 
          mapping.setServlet( servlet );
          mapping.setUrlPattern( urlPattern );
          root.getServletMappings().add( mapping );

          artifact.saveIfNecessary( null );
        }
        finally
View Full Code Here

      EList servlets = webApp.getServlets();
      for (Iterator i = servlets.iterator(); i.hasNext();) {
        Servlet servlet = (Servlet) i.next();
        WebType webType = servlet.getWebType();
        if(webType instanceof ServletType && ((ServletType)webType).getClassName().endsWith(getRemoteInterfaceName().concat("Impl"))){
          ServletMapping servletMapping = webApp.getServletMapping(servlet);
          servlets.remove(servlet);
          webApp.getServletMappings().remove(servletMapping);
        }
      }
     
View Full Code Here

      String servletName = servlet.getServletName();
      servletName = servletName != null ? servletName.trim() : servletName;
      final List<ServletMapping> mappings = new ArrayList<ServletMapping>();
    final List<ServletMapping> allMappings = webApp.getServletMappings();
    for (int i=allMappings.size()-1;i>=0;--i){
      ServletMapping mapping = allMappings.get(i);
      if (mapping != null &&
          mapping.getServlet() != null &&
          mapping.getServlet().getServletName() != null &&
          mapping.getServlet().getServletName().trim().equals(servletName))
        mappings.add(mapping);
    }
    return mappings;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jst.j2ee.webapplication.ServletMapping

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.