org.netbeans.modules.j2ee.dd.api.web.WebApp.removeServletMapping()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(74)

本文整理了Java中org.netbeans.modules.j2ee.dd.api.web.WebApp.removeServletMapping()方法的一些代码示例,展示了WebApp.removeServletMapping()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebApp.removeServletMapping()方法的具体详情如下:
包路径:org.netbeans.modules.j2ee.dd.api.web.WebApp
类名称:WebApp
方法名:removeServletMapping

WebApp.removeServletMapping介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-refactoring

@Override
protected void doChange() {
  webApp.removeServletMapping(mapping);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project

/**
 * Remove the web.xml servlets for the non-JSR 109 web service.
 *
 * @param serviceName Name of the web service to be removed
 */
private boolean removeNonJsr109ServletsFromDD(WebApp webApp, String serviceName) {
  boolean changed = false;
  //first remove the servlet
  Servlet[] servlets = webApp.getServlet();
  for(int i = 0; i < servlets.length; i++){
    Servlet servlet = servlets[i];
    if(servlet.getServletName().equals(serviceName)){
      webApp.removeServlet(servlet);
      changed = true;
      break;
    }
  }
  //remove the servlet mapping
  ServletMapping[] mappings = webApp.getServletMapping();
  for(int i = 0; i < mappings.length; i++){
    ServletMapping mapping = mappings[i];
    if(mapping.getServletName().equals(serviceName)){
      webApp.removeServletMapping(mapping);
      changed = true;
    }
  }
  return changed;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project

public void removeServiceEntry(String linkName) {
  //remove servlet entry in web.xml
  WebApp webApp = getWebApp();
  Servlet[] servlets = webApp.getServlet();
  for(int i = 0; i < servlets.length; i++) {
    Servlet servlet = servlets[i];
    if(servlet.getServletName().equals(linkName)) {
      webApp.removeServlet(servlet);
      break;
    }
  }
  ServletMapping[] mappings = webApp.getServletMapping();
  for(int j = 0; j < mappings.length; j++ ) {
    ServletMapping mapping = mappings[j];
    if(mapping.getServletName().equals(linkName)) {
      webApp.removeServletMapping(mapping);
    }
  }
  try {
    // This also saves server specific configuration, if necessary.
    webApp.write(getDeploymentDescriptor());
  }
  catch(java.io.IOException e) {
    NotifyDescriptor ndd =
    new NotifyDescriptor.Message(NbBundle.getMessage(this.getClass(), "MSG_Unable_WRITE_WS_DD"), // NOI18N
    NotifyDescriptor.ERROR_MESSAGE);
    DialogDisplayer.getDefault().notify(ndd);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project

public void removeServiceEntry(String linkName) {
  //remove servlet entry in web.xml
  WebApp webApp = getWebApp();
  Servlet[] servlets = webApp.getServlet();
  for(int i = 0; i < servlets.length; i++) {
    Servlet servlet = servlets[i];
    if(servlet.getServletName().equals(linkName)) {
      webApp.removeServlet(servlet);
      break;
    }
  }
  ServletMapping[] mappings = webApp.getServletMapping();
  for(int j = 0; j < mappings.length; j++ ) {
    ServletMapping mapping = mappings[j];
    if(mapping.getServletName().equals(linkName)) {
      webApp.removeServletMapping(mapping);
    }
  }
  try {
    // This also saves server specific configuration, if necessary.
    webApp.write(getDeploymentDescriptor());
  }
  catch(java.io.IOException e) {
    NotifyDescriptor ndd =
    new NotifyDescriptor.Message(NbBundle.getMessage(this.getClass(), "MSG_Unable_WRITE_WS_DD"), // NOI18N
    NotifyDescriptor.ERROR_MESSAGE);
    DialogDisplayer.getDefault().notify(ndd);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project

for(ServletMapping mapping:webApp.getServletMapping()) {
  if(mapping.getServletName().equals(servletName)){
    webApp.removeServletMapping(mapping);
    changed = true;
    break;

相关文章