Skip navigation links
org.netbeans.api.web.webmodule 1.42

Web APIs
Under Development

See: Description

Web APIs 
Package Description
org.netbeans.modules.web.api.webmodule
API to access the properties of J2EE web modules.
org.netbeans.modules.web.spi.webmodule
SPI for providers of J2EE web modules and frameworks.

WebModuleAPI The API part provides access to web module properties and defines constants for use web module projects (such as action commands or source types). The SPI part can be implemented by modules that provide web module "project" support. It can be implemented with project APIs but other implementations are also possible. There is also an SPI which allows implementors to provides support for web frameworks such as Struts and JSF.

What is New (see all changes)?

Use Cases

Retrieving the propertis of a web module

The WebModule class, which encapsulates a web module, has methods for retrieving the module's properties:

   FileObject myServlet = ...;
   WebModule wm1 = WebModule.getWebModule (myServlet);
   String version = wm1.getJ2eePlatformVersion ();
   System.out.println ("Servlet is in version:" + version + " web module");
  
Implementing a web module

Most often the web module is implemented inside a project:

   public class MyProjectType implements Project {
     Lookup getLookup () {
       return Lookups.fixed(new Object[] {
         new MyProvider (),
         ...
       }
     }
     private class MyProvider implements WebModuleProvider {
       WebModule findWebModule(FileObject file) {
         if (isMyFile (file)) {
           WebModule wm;
           synchronized (this) {
             wm = cachedWebModule (file);
             if (wm == null) {
               wm = WebModuleFactory.createWebModule (new WebModuleImpl ());
               cache (file, wm);
             }
           }
           return wm;
         }
       }
       boolean isMyFile (FileObject file) {...}
       WebModule cachedWebModule (FileObject file) {...}
       cache (FileObject file, WebModule wm) {...}
     }
     
     private class WebModuleImpl implements WebModuleImplementation {
       ...
     }
   }
  

It is also possible to implement web modules backed by other means than a project by implementing a WebModuleProvider and registering it in the default lookup.

Implementing support for a web framework

Support for web frameworks, such as Struts and JSF, can extend a WebModule with framework-specific features, such as configuration files. An implementor wanting to provide such support implements WebFrameworkProvider and registers it in the j2ee/webtier/framework in the default file system.

Exported Interfaces

This table lists all of the module exported APIs with defined stability classifications. It is generated based on answers to questions about the architecture of the module. Read them all...
Group of java interfaces
Interface NameIn/OutStabilitySpecified in What Document?
WebModuleAPIExportedUnder Development

The API part provides access to web module properties and defines constants for use web module projects (such as action commands or source types). The SPI part can be implemented by modules that provide web module "project" support. It can be implemented with project APIs but other implementations are also possible. There is also an SPI which allows implementors to provides support for web frameworks such as Struts and JSF.

Implementation Details

Where are the sources for the module?

The sources for the module are in the NetBeans Mercurial repositories.

What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?

Nothing.

Read more about the implementation in the answers to architecture questions.

Skip navigation links
org.netbeans.api.web.webmodule 1.42