ServletDef (Apache Tomcat 11.0.24 API Documentation)
Description: declaration: package: org.apache.tomcat.util.descriptor.web, class: ServletDef

# Class ServletDef

java.lang.Object
org.apache.tomcat.util.descriptor.web.ServletDef

All Implemented Interfaces:
  `Serializable`

public class ServletDef extends Object implements Serializable
Representation of a servlet definition for a web application, as represented in a `<servlet>` element in the deployment descriptor.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ServletDef()`
  Default constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addInitParameter(String name, String value)`
  Add an initialization parameter to the set of parameters associated with this servlet.
  `void`
  `addSecurityRoleRef(SecurityRoleRef securityRoleRef)`
  Add a security-role-ref to the set of security-role-refs associated with this servlet.
  `Boolean`
  `getAsyncSupported()`
  Returns whether this servlet supports async processing.
  `String`
  `getDescription()`
  Returns the description of this servlet.
  `String`
  `getDisplayName()`
  Returns the display name of this servlet.
  `Boolean`
  `getEnabled()`
  Returns whether this servlet is enabled.
  `String`
  `getJspFile()`
  Returns the name of the JSP file to which this servlet definition applies.
  `String`
  `getLargeIcon()`
  Returns the large icon associated with this servlet.
  `Integer`
  `getLoadOnStartup()`
  Returns the load-on-startup order for this servlet.
  `MultipartDef`
  `getMultipartDef()`
  Returns the multipart configuration for this servlet.
  `Map<String,String>`
  `getParameterMap()`
  Returns the set of initialization parameters for this servlet, keyed by parameter name.
  `String`
  `getRunAs()`
  Returns the run-as configuration for this servlet.
  `Set<SecurityRoleRef>`
  `getSecurityRoleRefs()`
  Returns the set of security role references for this servlet.
  `String`
  `getServletClass()`
  Returns the fully qualified name of the Java class that implements this servlet.
  `String`
  `getServletName()`
  Returns the name of this servlet.
  `String`
  `getSmallIcon()`
  Returns the small icon associated with this servlet.
  `boolean`
  `isOverridable()`
  Returns whether this ServletDef can be overridden by a Servlet Container Initializer.
  `void`
  `setAsyncSupported(String asyncSupported)`
  Sets whether this servlet supports async processing.
  `void`
  `setDescription(String description)`
  Sets the description of this servlet.
  `void`
  `setDisplayName(String displayName)`
  Sets the display name of this servlet.
  `void`
  `setEnabled(String enabled)`
  Sets whether this servlet is enabled.
  `void`
  `setJspFile(String jspFile)`
  Sets the name of the JSP file to which this servlet definition applies.
  `void`
  `setLargeIcon(String largeIcon)`
  Sets the large icon associated with this servlet.
  `void`
  `setLoadOnStartup(String loadOnStartup)`
  Sets the load-on-startup order for this servlet.
  `void`
  `setMultipartDef(MultipartDef multipartDef)`
  Sets the multipart configuration for this servlet.
  `void`
  `setOverridable(boolean overridable)`
  Sets whether this ServletDef can be overridden by a Servlet Container Initializer.
  `void`
  `setRunAs(String runAs)`
  Sets the run-as configuration for this servlet.
  `void`
  `setServletClass(String servletClass)`
  Sets the fully qualified name of the Java class that implements this servlet.
  `void`
  `setServletName(String servletName)`
  Sets the name of this servlet.
  `void`
  `setSmallIcon(String smallIcon)`
  Sets the small icon associated with this servlet.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ServletDef

    public ServletDef()
    Default constructor.

- ## Method Details

  - ### getDescription

    public String getDescription()
    Returns the description of this servlet.
    Returns:
      the description

  - ### setDescription

    public void setDescription(String description)
    Sets the description of this servlet.
    Parameters:
      `description` - the description

  - ### getDisplayName

    public String getDisplayName()
    Returns the display name of this servlet.
    Returns:
      the display name

  - ### setDisplayName

    public void setDisplayName(String displayName)
    Sets the display name of this servlet.
    Parameters:
      `displayName` - the display name

  - ### getSmallIcon

    public String getSmallIcon()
    Returns the small icon associated with this servlet.
    Returns:
      the small icon

  - ### setSmallIcon

    public void setSmallIcon(String smallIcon)
    Sets the small icon associated with this servlet.
    Parameters:
      `smallIcon` - the small icon

  - ### getLargeIcon

    public String getLargeIcon()
    Returns the large icon associated with this servlet.
    Returns:
      the large icon

  - ### setLargeIcon

    public void setLargeIcon(String largeIcon)
    Sets the large icon associated with this servlet.
    Parameters:
      `largeIcon` - the large icon

  - ### getServletName

    public String getServletName()
    Returns the name of this servlet.
    Returns:
      the servlet name

  - ### setServletName

    public void setServletName(String servletName)
    Sets the name of this servlet.
    Parameters:
      `servletName` - the servlet name

  - ### getServletClass

    public String getServletClass()
    Returns the fully qualified name of the Java class that implements this servlet.
    Returns:
      the servlet class

  - ### setServletClass

    public void setServletClass(String servletClass)
    Sets the fully qualified name of the Java class that implements this servlet.
    Parameters:
      `servletClass` - the servlet class

  - ### getJspFile

    public String getJspFile()
    Returns the name of the JSP file to which this servlet definition applies.
    Returns:
      the JSP file

  - ### setJspFile

    public void setJspFile(String jspFile)
    Sets the name of the JSP file to which this servlet definition applies.
    Parameters:
      `jspFile` - the JSP file

  - ### getParameterMap

    public Map<String,String> getParameterMap()
    Returns the set of initialization parameters for this servlet, keyed by parameter name.
    Returns:
      the parameter map

  - ### addInitParameter

    public void addInitParameter(String name, String value)
    Add an initialization parameter to the set of parameters associated with this servlet.
    Parameters:
      `name` - The initialisation parameter name
      `value` - The initialisation parameter value

  - ### getLoadOnStartup

    public Integer getLoadOnStartup()
    Returns the load-on-startup order for this servlet.
    Returns:
      the load-on-startup order

  - ### setLoadOnStartup

    public void setLoadOnStartup(String loadOnStartup)
    Sets the load-on-startup order for this servlet.
    Parameters:
      `loadOnStartup` - the load-on-startup order as a string

  - ### getRunAs

    public String getRunAs()
    Returns the run-as configuration for this servlet.
    Returns:
      the run-as role name

  - ### setRunAs

    public void setRunAs(String runAs)
    Sets the run-as configuration for this servlet.
    Parameters:
      `runAs` - the run-as role name

  - ### getSecurityRoleRefs

    public Set<SecurityRoleRef> getSecurityRoleRefs()
    Returns the set of security role references for this servlet.
    Returns:
      the security role references

  - ### addSecurityRoleRef

    public void addSecurityRoleRef(SecurityRoleRef securityRoleRef)
    Add a security-role-ref to the set of security-role-refs associated with this servlet.
    Parameters:
      `securityRoleRef` - The security role

  - ### getMultipartDef

    public MultipartDef getMultipartDef()
    Returns the multipart configuration for this servlet.
    Returns:
      the multipart configuration

  - ### setMultipartDef

    public void setMultipartDef(MultipartDef multipartDef)
    Sets the multipart configuration for this servlet.
    Parameters:
      `multipartDef` - the multipart configuration

  - ### getAsyncSupported

    public Boolean getAsyncSupported()
    Returns whether this servlet supports async processing.
    Returns:
      whether async is supported

  - ### setAsyncSupported

    public void setAsyncSupported(String asyncSupported)
    Sets whether this servlet supports async processing.
    Parameters:
      `asyncSupported` - whether async is supported as a string

  - ### getEnabled

    public Boolean getEnabled()
    Returns whether this servlet is enabled.
    Returns:
      whether the servlet is enabled

  - ### setEnabled

    public void setEnabled(String enabled)
    Sets whether this servlet is enabled.
    Parameters:
      `enabled` - whether the servlet is enabled as a string

  - ### isOverridable

    public boolean isOverridable()
    Returns whether this ServletDef can be overridden by a Servlet Container Initializer.
    Returns:
      whether the servlet definition is overridable

  - ### setOverridable

    public void setOverridable(boolean overridable)
    Sets whether this ServletDef can be overridden by a Servlet Container Initializer.
    Parameters:
      `overridable` - whether the servlet definition is overridable