org.glassfish.grizzly.servlet
Class Registration

java.lang.Object
  extended by org.glassfish.grizzly.servlet.Registration
Direct Known Subclasses:
FilterRegistration, ServletRegistration

public abstract class Registration
extends Object

Base class for all complex registrable components within a web application.

Since:
2.2

Field Summary
protected  String className
           
protected  WebappContext ctx
           
protected  Map<String,String> initParameters
           
protected  String name
           
 
Constructor Summary
protected Registration(WebappContext ctx, String name, String className)
           
 
Method Summary
 boolean equals(Object o)
           
 String getClassName()
          Gets the fully qualified class name of the Servlet or Filter that is represented by this Registration.
 String getInitParameter(String name)
          Gets the value of the initialization parameter with the given name that will be used to initialize the Servlet or Filter represented by this Registration object.
 Map<String,String> getInitParameters()
          Gets an immutable (and possibly empty) Map containing the currently available initialization parameters that will be used to initialize the Servlet or Filter represented by this Registration object.
 String getName()
          Gets the name of the Servlet or Filter that is represented by this Registration.
 int hashCode()
           
 boolean setInitParameter(String name, String value)
          Sets the initialization parameter with the given name and value on the Servlet or Filter that is represented by this Registration.
 Set<String> setInitParameters(Map<String,String> initParameters)
          Sets the given initialization parameters on the Servlet or Filter that is represented by this Registration.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected String name

className

protected String className

initParameters

protected Map<String,String> initParameters

ctx

protected WebappContext ctx
Constructor Detail

Registration

protected Registration(WebappContext ctx,
                       String name,
                       String className)
Method Detail

getName

public String getName()
Gets the name of the Servlet or Filter that is represented by this Registration.

Returns:
the name of the Servlet or Filter that is represented by this Registration

getClassName

public String getClassName()
Gets the fully qualified class name of the Servlet or Filter that is represented by this Registration.

Returns:
the fully qualified class name of the Servlet or Filter that is represented by this Registration, or null if this Registration is preliminary

setInitParameter

public boolean setInitParameter(String name,
                                String value)
Sets the initialization parameter with the given name and value on the Servlet or Filter that is represented by this Registration.

Parameters:
name - the initialization parameter name
value - the initialization parameter value
Returns:
true if the update was successful, i.e., an initialization parameter with the given name did not already exist for the Servlet or Filter represented by this Registration, and false otherwise
Throws:
IllegalStateException - if the WebappContext from which this Registration was obtained has already been initialized
IllegalArgumentException - if the given name or value is null

getInitParameter

public String getInitParameter(String name)
Gets the value of the initialization parameter with the given name that will be used to initialize the Servlet or Filter represented by this Registration object.

Parameters:
name - the name of the initialization parameter whose value is requested
Returns:
the value of the initialization parameter with the given name, or null if no initialization parameter with the given name exists

setInitParameters

public Set<String> setInitParameters(Map<String,String> initParameters)
Sets the given initialization parameters on the Servlet or Filter that is represented by this Registration.

The given map of initialization parameters is processed by-value, i.e., for each initialization parameter contained in the map, this method calls setInitParameter(String,String). If that method would return false for any of the initialization parameters in the given map, no updates will be performed, and false will be returned. Likewise, if the map contains an initialization parameter with a null name or value, no updates will be performed, and an IllegalArgumentException will be thrown.

Parameters:
initParameters - the initialization parameters
Returns:
the (possibly empty) Set of initialization parameter names that are in conflict
Throws:
IllegalStateException - if the WebappContext from which this Registration was obtained has already been initialized
IllegalArgumentException - if the given map contains an initialization parameter with a null name or value

getInitParameters

public Map<String,String> getInitParameters()
Gets an immutable (and possibly empty) Map containing the currently available initialization parameters that will be used to initialize the Servlet or Filter represented by this Registration object.

Returns:
Map containing the currently available initialization parameters that will be used to initialize the Servlet or Filter represented by this Registration object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2012 Oracle Corporation. All Rights Reserved.