BEA Systems, Inc.

weblogic.servlet.annotation
Interface WLServlet

All Superinterfaces:
Annotation

@Target(value=TYPE)
@Retention(value=RUNTIME)
public interface WLServlet
extends Annotation

The WLServlet annotation is used to mark a Servlet class with necessary metadata so it can be deployed without being declared in the web.xml descriptor.

Example:

  @WLServlet (
    name = "FOO",
    runAs = "SuperUser"
    initParams = { @WLInitParam (name="one", value="1") }
    mapping = {"/foo/*"}
  )
  public class MyServlet extends HttpServlet { . . . }
 

Annotating a Servlet class with the above annotation is equivalent to declaring the following in the web.xml descriptor:

  . . .
  <servlet>
     <servlet-name>FOO</servlet-name>
     <servlet-class>MyServlet</servlet-class>
     <init-param>
        <param-name>one</param-name>
        <param-value>1</param-value>
     </init-param>
  </servlet>
  . . .
  <servlet-mapping>
    <servlet-name>FOO</servlet-name>
    <url-pattern>/foo/*</url-pattern>
  </servlet-mapping>
  . . .
 


Method Summary
 String description()
          The description attribute for the Servlet.
 String displayName()
          The display name attribute for the Servlet.
 String icon()
          The icon attribute for the Servlet.
 WLInitParam[] initParams()
          The init parameters for the Servlet.
 int loadOnStartup()
          The load-on-startup attribute for the Servlet, as defined on the servlet element in the web.xml descriptor.
 String[] mapping()
          The url patterns for the Servlet mapping.
 String name()
          The name attribute for the Servlet.
 String runAs()
          The 'run-as' attribute for the Servlet, as defined on the servlet element in the web.xml descriptor.
 
Methods inherited from interface java.lang.annotation.Annotation
annotationType, equals, hashCode, toString
 

Method Detail

description

String description()
The description attribute for the Servlet. This corresponds to the 'description' attribute on the servlet element in the web.xml descriptor. Defaults to an empty string.


icon

String icon()
The icon attribute for the Servlet. This corresponds to the 'icon' attribute on the servlet element in the web.xml descriptor. Defaults to an empty string.


displayName

String displayName()
The display name attribute for the Servlet. This corresponds to the 'display-name' attribute on the servlet element in the web.xml descriptor. Defaults to an empty string.


name

String name()
The name attribute for the Servlet. This corresponds to the 'name' attribute on the servlet element in the web.xml descriptor. If absent, this will default to the class name of the Servlet being annotated.


initParams

WLInitParam[] initParams()
The init parameters for the Servlet. This corresponds to the 'init-param' attribute on the servlet element in the web.xml descriptor.


loadOnStartup

int loadOnStartup()
The load-on-startup attribute for the Servlet, as defined on the servlet element in the web.xml descriptor. Defaults to -1.


runAs

String runAs()
The 'run-as' attribute for the Servlet, as defined on the servlet element in the web.xml descriptor. Defaults to an empty string.


mapping

String[] mapping()
The url patterns for the Servlet mapping. This corresponds to the 'servlet-mapping' attribute on the servlet element in the web.xml descriptor.


Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs100
Copyright 2006 BEA Systems Inc.