本文整理了Java中org.netbeans.modules.j2ee.dd.api.web.WebApp.write()
方法的一些代码示例,展示了WebApp.write()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebApp.write()
方法的具体详情如下:
包路径:org.netbeans.modules.j2ee.dd.api.web.WebApp
类名称:WebApp
方法名:write
暂无
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-refactoring
private void writeDD(){
try{
webApp.write(webDD);
}catch(IOException ioe){
Exceptions.printStackTrace(ioe);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-core
void writeChanges() throws IOException {
LOG.finer("writeChanges()"); //NOI18N
if (webApp == null) {
return;
}
LOG.finer("now writing..."); //NOI18N
webApp.write(ddObject);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-tomcat5
public static void allowDebugging(TomcatManager tm) throws IOException, SAXException {
String url = tm.getUri();
// find the web.xml file
File webXML = getDefaultWebXML(tm);
if (webXML == null) {
Logger.getLogger(DebugSupport.class.getName()).log(Level.INFO, null, new Exception(url));
return;
}
WebApp webApp = DDProvider.getDefault().getDDRoot(webXML);
if (webApp == null) {
Logger.getLogger(DebugSupport.class.getName()).log(Level.INFO, null, new Exception(url));
return;
}
boolean needsSave = setMappedProperty(webApp);
if (needsSave) {
OutputStream os = new FileOutputStream(webXML);
try {
webApp.write(os);
} finally {
os.close();
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project
public void addServiceEntriesToDD(String serviceName, String serviceEndpointInterface, String servantClassName) {
//add servlet entry to web.xml
String servletName = WebServiceServlet_PREFIX + serviceName;
WebApp webApp = getWebApp();
if(webApp != null){
Servlet servlet = null;
try{
servlet = (Servlet)webApp.addBean("Servlet", new String[]{"ServletName","ServletClass"},
new Object[]{servletName,servantClassName}, "ServletName");
servlet.setLoadOnStartup(new java.math.BigInteger("1"));
ServletMapping servletMapping = (ServletMapping)
webApp.addBean("ServletMapping", new String[]{"ServletName","UrlPattern"},
new Object[]{servletName, "/" + serviceName}, "ServletName");
// This also saves server specific configuration, if necessary.
webApp.write(getDeploymentDescriptor());
} catch (ClassNotFoundException exc) {
exc.printStackTrace();
throw new RuntimeException(exc.getMessage());
} catch (NameAlreadyUsedException exc) {
exc.printStackTrace();
throw new RuntimeException(exc.getMessage());
} catch (IOException exc) {
exc.printStackTrace();
throw new RuntimeException(exc.getMessage());
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project
private void removeServiceRef(String serviceName) {
FileObject ddFO = getDeploymentDescriptor();
// If we get null for the deployment descriptor, ignore this step.
if (ddFO != null) {
String wsdlLocation = "WEB-INF/wsdl/"+serviceName+".wsdl"; //NOI18N;
try {
WebApp webApp = DDProvider.getDefault().getDDRoot(ddFO);
ServiceRef serviceRef = null;
for (ServiceRef ref:webApp.getServiceRef()) {
URI wsdl = ref.getWsdlFile();
if (wsdlLocation.equals(ref.getWsdlFile().getPath())) {
serviceRef = ref;
}
}
if (serviceRef != null) {
webApp.removeServiceRef(serviceRef);
webApp.write(ddFO);
}
} catch (IOException ex) {
Logger.getLogger("global").log(Level.INFO, null, ex); //NOI18N;
} catch (VersionNotSupportedException ex) {
// for old versions of DD
Logger.getLogger("global").log(Level.INFO, null, ex); //NOI18N;
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project
webApp.write(getDeploymentDescriptor());
} catch (ClassNotFoundException exc) {
Logger.getLogger("global").log(Level.INFO, exc.getLocalizedMessage());
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project
/**
* Removes the servlet entry from web.xml and
* the endpoint entry from the sun-jaxws.xml file
*/
public void removeJsr109Entries(String serviceName) throws IOException {
WebApp webApp = getWebApp();
if (webApp != null) {
JaxWsModel jaxWsModel = (JaxWsModel)project.getLookup().lookup(JaxWsModel.class);
if (jaxWsModel != null) {
Service service = jaxWsModel.findServiceByName(serviceName);
if (service != null) {
boolean changed = removeJsr109ServletsFromDD(webApp, service);
if(changed){
try{
webApp.write(getDeploymentDescriptor());
} catch(IOException e){
Exceptions.printStackTrace(e);
}
}
}
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-tomcat5
OutputStream os = new FileOutputStream(webXML);
try {
webApp.write(os);
代码示例来源: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
webApp.write(getDeploymentDescriptor());
} catch(IOException e){
Exceptions.printStackTrace(e);
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project
ddRoot.write(dd);
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project
new Object[]{wsName, "/" + wsName}, "UrlPattern");
webApp.write(getDeploymentDescriptor());
} catch (ClassNotFoundException exc) {
Logger.getLogger("global").log(Level.INFO, exc.getLocalizedMessage());
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project
private void writeDD(FileObject referencingFile, final String referencingClass) throws IOException {
ProjectWebModule jp = webProject.getLookup().lookup(ProjectWebModule.class);
// test if referencing class is injection target
final boolean[] isInjectionTarget = {false};
CancellableTask<CompilationController> task = new CancellableTask<CompilationController>() {
@Override
public void run(CompilationController controller) throws IOException {
Elements elements = controller.getElements();
TypeElement thisElement = elements.getTypeElement(referencingClass);
if (thisElement!=null) {
isInjectionTarget[0] = InjectionTargetQuery.isInjectionTarget(controller, thisElement);
}
}
@Override
public void cancel() {}
};
JavaSource refFile = JavaSource.forFileObject(referencingFile);
if (refFile!=null) {
refFile.runUserActionTask(task, true);
}
boolean shouldWrite = isDescriptorMandatory(jp.getJ2eeProfile()) || !isInjectionTarget[0];
if (shouldWrite) {
FileObject fo = jp.getDeploymentDescriptor();
getWebApp().write(fo);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-websvc-restapi
initParam.setParamValue(value);
webApp.write(ddFO);
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-project-jsf
ddRoot.write(dd);
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-websvc-restapi
webApp.write(ddFO);
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-websvc-restapi
webApp.write(ddFO);
restSupport.logResourceCreation();
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-websvc-restapi
webApp.write(ddFO);
restSupport.logResourceCreation();
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-project-jsf
ddRoot.write(dd);
内容来源于网络,如有侵权,请联系作者删除!