You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2009/06/25 00:05:50 UTC
svn commit: r788194 [6/6] - in
/geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet:
./ annotation/ annotation/jaxrs/ http/ http/annotation/
Modified: geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSession.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSession.java?rev=788194&r1=788193&r2=788194&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSession.java (original)
+++ geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSession.java Wed Jun 24 22:05:48 2009
@@ -20,408 +20,281 @@
package javax.servlet.http;
import java.util.Enumeration;
+
import javax.servlet.ServletContext;
/**
- *
* Provides a way to identify a user across more than one page
* request or visit to a Web site and to store information about that user.
- *
+ * <p/>
* <p>The servlet container uses this interface to create a session
* between an HTTP client and an HTTP server. The session persists
* for a specified time period, across more than one connection or
- * page request from the user. A session usually corresponds to one
- * user, who may visit a site many times. The server can maintain a
+ * page request from the user. A session usually corresponds to one
+ * user, who may visit a site many times. The server can maintain a
* session in many ways such as using cookies or rewriting URLs.
- *
- * <p>This interface allows servlets to
+ * <p/>
+ * <p>This interface allows servlets to
* <ul>
* <li>View and manipulate information about a session, such as
- * the session identifier, creation time, and last accessed time
- * <li>Bind objects to sessions, allowing user information to persist
- * across multiple user connections
+ * the session identifier, creation time, and last accessed time
+ * <li>Bind objects to sessions, allowing user information to persist
+ * across multiple user connections
* </ul>
- *
+ * <p/>
* <p>When an application stores an object in or removes an object from a
* session, the session checks whether the object implements
- * {@link HttpSessionBindingListener}. If it does,
- * the servlet notifies the object that it has been bound to or unbound
- * from the session. Notifications are sent after the binding methods complete.
+ * {@link HttpSessionBindingListener}. If it does,
+ * the servlet notifies the object that it has been bound to or unbound
+ * from the session. Notifications are sent after the binding methods complete.
* For session that are invalidated or expire, notifications are sent after
* the session has been invalidated or expired.
- *
+ * <p/>
* <p> When container migrates a session between VMs in a distributed container
* setting, all session attributes implementing the {@link HttpSessionActivationListener}
* interface are notified.
- *
+ * <p/>
* <p>A servlet should be able to handle cases in which
* the client does not choose to join a session, such as when cookies are
* intentionally turned off. Until the client joins the session,
- * <code>isNew</code> returns <code>true</code>. If the client chooses
+ * <code>isNew</code> returns <code>true</code>. If the client chooses
* not to join
* the session, <code>getSession</code> will return a different session
* on each request, and <code>isNew</code> will always return
* <code>true</code>.
- *
+ * <p/>
* <p>Session information is scoped only to the current web application
* (<code>ServletContext</code>), so information stored in one context
* will not be directly visible in another.
*
- * @author Various
- * @version $Version$
- *
- *
- * @see HttpSessionBindingListener
- * @see HttpSessionContext
- *
+ * @version $Rev$ $Date$
+ * @see HttpSessionBindingListener
+ * @see HttpSessionContext
*/
public interface HttpSession {
-
-
-
/**
- *
* Returns the time when this session was created, measured
* in milliseconds since midnight January 1, 1970 GMT.
*
- * @return a <code>long</code> specifying
- * when this session was created,
- * expressed in
- * milliseconds since 1/1/1970 GMT
- *
- * @exception IllegalStateException if this method is called on an
- * invalidated session
- *
+ * @throws IllegalStateException if this method is called on an
+ * invalidated session
+ * @return a <code>long</code> specifying
+ * when this session was created,
+ * expressed in
+ * milliseconds since 1/1/1970 GMT
*/
+ long getCreationTime();
- public long getCreationTime();
-
-
-
-
/**
- *
- * Returns a string containing the unique identifier assigned
- * to this session. The identifier is assigned
+ * Returns a string containing the unique identifier assigned
+ * to this session. The identifier is assigned
* by the servlet container and is implementation dependent.
- *
- * @return a string specifying the identifier
- * assigned to this session
- *
- * @exception IllegalStateException if this method is called on an
- * invalidated session
*
+ * @throws IllegalStateException if this method is called on an
+ * invalidated session
+ * @return a string specifying the identifier
+ * assigned to this session
*/
-
- public String getId();
-
-
-
+ String getId();
/**
- *
* Returns the last time the client sent a request associated with
* this session, as the number of milliseconds since midnight
- * January 1, 1970 GMT, and marked by the time the container received the request.
- *
+ * January 1, 1970 GMT, and marked by the time the container received the request.
+ * <p/>
* <p>Actions that your application takes, such as getting or setting
* a value associated with the session, do not affect the access
* time.
*
- * @return a <code>long</code>
- * representing the last time
- * the client sent a request associated
- * with this session, expressed in
- * milliseconds since 1/1/1970 GMT
- *
- * @exception IllegalStateException if this method is called on an
- * invalidated session
- *
+ * @throws IllegalStateException if this method is called on an
+ * invalidated session
+ * @return a <code>long</code>
+ * representing the last time
+ * the client sent a request associated
+ * with this session, expressed in
+ * milliseconds since 1/1/1970 GMT
*/
+ long getLastAccessedTime();
- public long getLastAccessedTime();
-
-
/**
- * Returns the ServletContext to which this session belongs.
- *
- * @return The ServletContext object for the web application
- * @since 2.3
- */
-
- public ServletContext getServletContext();
-
+ * Returns the ServletContext to which this session belongs.
+ *
+ * @return The ServletContext object for the web application
+ * @since 2.3
+ */
+ ServletContext getServletContext();
/**
- *
- * Specifies the time, in seconds, between client requests before the
+ * Specifies the time, in seconds, between client requests before the
* servlet container will invalidate this session. A negative time
* indicates the session should never timeout.
*
- * @param interval An integer specifying the number
- * of seconds
- *
+ * @param interval An integer specifying the number
+ * of seconds
*/
-
- public void setMaxInactiveInterval(int interval);
-
-
-
+ void setMaxInactiveInterval(int interval);
- /**
- * Returns the maximum time interval, in seconds, that
- * the servlet container will keep this session open between
- * client accesses. After this interval, the servlet container
- * will invalidate the session. The maximum time interval can be set
- * with the <code>setMaxInactiveInterval</code> method.
- * A negative time indicates the session should never timeout.
- *
- *
- * @return an integer specifying the number of
- * seconds this session remains open
- * between client requests
- *
- * @see #setMaxInactiveInterval
- *
- *
- */
-
- public int getMaxInactiveInterval();
-
-
-
-
- /**
- *
- * @deprecated As of Version 2.1, this method is
- * deprecated and has no replacement.
- * It will be removed in a future
- * version of the Java Servlet API.
- *
- */
-
- public HttpSessionContext getSessionContext();
-
-
-
-
/**
+ * Returns the maximum time interval, in seconds, that
+ * the servlet container will keep this session open between
+ * client accesses. After this interval, the servlet container
+ * will invalidate the session. The maximum time interval can be set
+ * with the <code>setMaxInactiveInterval</code> method.
+ * A negative time indicates the session should never timeout.
*
- * Returns the object bound with the specified name in this session, or
- * <code>null</code> if no object is bound under the name.
- *
- * @param name a string specifying the name of the object
- *
- * @return the object with the specified name
- *
- * @exception IllegalStateException if this method is called on an
- * invalidated session
- *
+ * @return an integer specifying the number of
+ * seconds this session remains open
+ * between client requests
+ * @see #setMaxInactiveInterval
*/
-
- public Object getAttribute(String name);
-
-
-
-
+ int getMaxInactiveInterval();
+
/**
- *
- * @deprecated As of Version 2.2, this method is
- * replaced by {@link #getAttribute}.
- *
- * @param name a string specifying the name of the object
- *
- * @return the object with the specified name
- *
- * @exception IllegalStateException if this method is called on an
- * invalidated session
- *
+ * @deprecated As of Version 2.1, this method is
+ * deprecated and has no replacement.
+ * It will be removed in a future
+ * version of the Java Servlet API.
*/
-
- public Object getValue(String name);
-
-
-
+ HttpSessionContext getSessionContext();
/**
+ * Returns the object bound with the specified name in this session, or
+ * <code>null</code> if no object is bound under the name.
*
- * Returns an <code>Enumeration</code> of <code>String</code> objects
- * containing the names of all the objects bound to this session.
- *
- * @return an <code>Enumeration</code> of
- * <code>String</code> objects specifying the
- * names of all the objects bound to
- * this session
- *
- * @exception IllegalStateException if this method is called on an
- * invalidated session
- *
+ * @param name a string specifying the name of the object
+ * @throws IllegalStateException if this method is called on an
+ * invalidated session
+ * @return the object with the specified name
+ */
+ Object getAttribute(String name);
+
+ /**
+ * @param name a string specifying the name of the object
+ * @throws IllegalStateException if this method is called on an
+ * invalidated session
+ * @return the object with the specified name
+ * @deprecated As of Version 2.2, this method is
+ * replaced by {@link #getAttribute}.
*/
-
- public Enumeration getAttributeNames();
-
-
-
+ Object getValue(String name);
/**
+ * Returns an <code>Enumeration</code> of <code>String</code> objects
+ * containing the names of all the objects bound to this session.
*
- * @deprecated As of Version 2.2, this method is
- * replaced by {@link #getAttributeNames}
- *
- * @return an array of <code>String</code>
- * objects specifying the
- * names of all the objects bound to
- * this session
- *
- * @exception IllegalStateException if this method is called on an
- * invalidated session
- *
+ * @throws IllegalStateException if this method is called on an
+ * invalidated session
+ * @return an <code>Enumeration</code> of
+ * <code>String</code> objects specifying the
+ * names of all the objects bound to
+ * this session
+ */
+ Enumeration<String> getAttributeNames();
+
+ /**
+ * @throws IllegalStateException if this method is called on an
+ * invalidated session
+ * @return an array of <code>String</code>
+ * objects specifying the
+ * names of all the objects bound to
+ * this session
+ * @deprecated As of Version 2.2, this method is
+ * replaced by {@link #getAttributeNames}
*/
-
- public String[] getValueNames();
-
-
-
+ String[] getValueNames();
/**
* Binds an object to this session, using the name specified.
* If an object of the same name is already bound to the session,
* the object is replaced.
- *
+ * <p/>
* <p>After this method executes, and if the new object
* implements <code>HttpSessionBindingListener</code>,
- * the container calls
- * <code>HttpSessionBindingListener.valueBound</code>. The container then
- * notifies any <code>HttpSessionAttributeListener</code>s in the web
+ * the container calls
+ * <code>HttpSessionBindingListener.valueBound</code>. The container then
+ * notifies any <code>HttpSessionAttributeListener</code>s in the web
* application.
-
+ * <p/>
* <p>If an object was already bound to this session of this name
- * that implements <code>HttpSessionBindingListener</code>, its
+ * that implements <code>HttpSessionBindingListener</code>, its
* <code>HttpSessionBindingListener.valueUnbound</code> method is called.
- *
- * <p>If the value passed in is null, this has the same effect as calling
+ * <p/>
+ * <p>If the value passed in is null, this has the same effect as calling
* <code>removeAttribute()<code>.
*
- *
- * @param name the name to which the object is bound;
- * cannot be null
- *
- * @param value the object to be bound
- *
- * @exception IllegalStateException if this method is called on an
- * invalidated session
- *
+ * @param name the name to which the object is bound;
+ * cannot be null
+ * @param value the object to be bound
+ * @throws IllegalStateException if this method is called on an
+ * invalidated session
+ */
+ void setAttribute(String name, Object value);
+
+ /**
+ * @param name the name to which the object is bound;
+ * cannot be null
+ * @param value the object to be bound; cannot be null
+ * @throws IllegalStateException if this method is called on an
+ * invalidated session
+ * @deprecated As of Version 2.2, this method is
+ * replaced by {@link #setAttribute}
*/
-
- public void setAttribute(String name, Object value);
-
+ void putValue(String name, Object value);
-
-
-
/**
- *
- * @deprecated As of Version 2.2, this method is
- * replaced by {@link #setAttribute}
- *
- * @param name the name to which the object is bound;
- * cannot be null
- *
- * @param value the object to be bound; cannot be null
- *
- * @exception IllegalStateException if this method is called on an
- * invalidated session
- *
- */
-
- public void putValue(String name, Object value);
-
-
-
-
-
- /**
- *
* Removes the object bound with the specified name from
* this session. If the session does not have an object
* bound with the specified name, this method does nothing.
- *
+ * <p/>
* <p>After this method executes, and if the object
* implements <code>HttpSessionBindingListener</code>,
- * the container calls
+ * the container calls
* <code>HttpSessionBindingListener.valueUnbound</code>. The container
- * then notifies any <code>HttpSessionAttributeListener</code>s in the web
+ * then notifies any <code>HttpSessionAttributeListener</code>s in the web
* application.
- *
- *
- *
- * @param name the name of the object to
- * remove from this session
*
- * @exception IllegalStateException if this method is called on an
- * invalidated session
+ * @param name the name of the object to
+ * remove from this session
+ * @throws IllegalStateException if this method is called on an
+ * invalidated session
+ */
+ void removeAttribute(String name);
+
+ /**
+ * @param name the name of the object to
+ * remove from this session
+ * @throws IllegalStateException if this method is called on an
+ * invalidated session
+ * @deprecated As of Version 2.2, this method is
+ * replaced by {@link #removeAttribute}
*/
-
- public void removeAttribute(String name);
-
-
-
-
+ void removeValue(String name);
/**
- *
- * @deprecated As of Version 2.2, this method is
- * replaced by {@link #removeAttribute}
- *
- * @param name the name of the object to
- * remove from this session
- *
- * @exception IllegalStateException if this method is called on an
- * invalidated session
- */
-
- public void removeValue(String name);
-
-
-
-
- /**
- *
* Invalidates this session then unbinds any objects bound
- * to it.
- *
- * @exception IllegalStateException if this method is called on an
- * already invalidated session
+ * to it.
*
+ * @throws IllegalStateException if this method is called on an
+ * already invalidated session
*/
+ void invalidate();
- public void invalidate();
-
-
-
-
/**
- *
* Returns <code>true</code> if the client does not yet know about the
- * session or if the client chooses not to join the session. For
+ * session or if the client chooses not to join the session. For
* example, if the server used only cookie-based sessions, and
* the client had disabled the use of cookies, then a session would
* be new on each request.
*
- * @return <code>true</code> if the
- * server has created a session,
- * but the client has not yet joined
- *
- * @exception IllegalStateException if this method is called on an
- * already invalidated session
- *
+ * @return <code>true</code> if the
+ * server has created a session,
+ * but the client has not yet joined
+ * @throws IllegalStateException if this method is called on an
+ * already invalidated session
*/
-
- public boolean isNew();
-
-
+ boolean isNew();
}
Modified: geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionActivationListener.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionActivationListener.java?rev=788194&r1=788193&r2=788194&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionActivationListener.java (original)
+++ geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionActivationListener.java Wed Jun 24 22:05:48 2009
@@ -21,20 +21,27 @@
import java.util.EventListener;
- /** Objects that are bound to a session may listen to container
- ** events notifying them that sessions will be passivated and that
- ** session will be activated. A container that migrates session between VMs
- ** or persists sessions is required to notify all attributes bound to sessions
- ** implementing HttpSessionActivationListener.
- **
- * @since 2.3
- */
-
-public interface HttpSessionActivationListener extends EventListener {
-
- /** Notification that the session is about to be passivated.*/
- public void sessionWillPassivate(HttpSessionEvent se);
- /** Notification that the session has just been activated.*/
- public void sessionDidActivate(HttpSessionEvent se);
+/**
+ * Objects that are bound to a session may listen to container
+ * events notifying them that sessions will be passivated and that
+ * session will be activated. A container that migrates session between VMs
+ * or persists sessions is required to notify all attributes bound to sessions
+ * implementing HttpSessionActivationListener.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.3
+ */
+
+public interface HttpSessionActivationListener extends EventListener {
+
+ /**
+ * Notification that the session is about to be passivated.
+ */
+ void sessionWillPassivate(HttpSessionEvent se);
+
+ /**
+ * Notification that the session has just been activated.
+ */
+ void sessionDidActivate(HttpSessionEvent se);
}
Modified: geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionAttributeListener.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionAttributeListener.java?rev=788194&r1=788193&r2=788194&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionAttributeListener.java (original)
+++ geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionAttributeListener.java Wed Jun 24 22:05:48 2009
@@ -21,19 +21,30 @@
import java.util.EventListener;
- /** This listener interface can be implemented in order to
- * get notifications of changes to the attribute lists of sessions within
- * this web application.
- * @since v 2.3
-*/
+/**
+ * This listener interface can be implemented in order to
+ * get notifications of changes to the attribute lists of sessions within
+ * this web application.
+ *
+ * @version $Rev$ $Date$
+ * @since v 2.3
+ */
public interface HttpSessionAttributeListener extends EventListener {
- /** Notification that an attribute has been added to a session. Called after the attribute is added.*/
- public void attributeAdded ( HttpSessionBindingEvent se );
- /** Notification that an attribute has been removed from a session. Called after the attribute is removed. */
- public void attributeRemoved ( HttpSessionBindingEvent se );
- /** Notification that an attribute has been replaced in a session. Called after the attribute is replaced. */
- public void attributeReplaced ( HttpSessionBindingEvent se );
+ /**
+ * Notification that an attribute has been added to a session. Called after the attribute is added.
+ */
+ void attributeAdded(HttpSessionBindingEvent se);
+
+ /**
+ * Notification that an attribute has been removed from a session. Called after the attribute is removed.
+ */
+ void attributeRemoved(HttpSessionBindingEvent se);
+
+ /**
+ * Notification that an attribute has been replaced in a session. Called after the attribute is replaced.
+ */
+ void attributeReplaced(HttpSessionBindingEvent se);
}
Modified: geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionBindingEvent.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionBindingEvent.java?rev=788194&r1=788193&r2=788194&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionBindingEvent.java (original)
+++ geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionBindingEvent.java Wed Jun 24 22:05:48 2009
@@ -21,121 +21,93 @@
/**
* Events of this type are either sent to an object that implements
- * {@link HttpSessionBindingListener} when it is bound or
- * unbound from a session, or to a {@link HttpSessionAttributeListener}
+ * {@link HttpSessionBindingListener} when it is bound or
+ * unbound from a session, or to a {@link HttpSessionAttributeListener}
* that has been configured in the deployment descriptor when any attribute is
* bound, unbound or replaced in a session.
- *
+ * <p/>
* <p>The session binds the object by a call to
* <code>HttpSession.setAttribute</code> and unbinds the object
* by a call to <code>HttpSession.removeAttribute</code>.
*
- *
- *
- * @author Various
- * @version $Version$
- *
- * @see HttpSession
- * @see HttpSessionBindingListener
- * @see HttpSessionAttributeListener
+ * @version $Rev$ $Date$
+ * @see HttpSessionAttributeListener
+ * @see HttpSession
+ * @see HttpSessionBindingListener
*/
public class HttpSessionBindingEvent extends HttpSessionEvent {
+
/* The name to which the object is being bound or unbound */
+ private final String name;
- private String name;
-
/* The object is being bound or unbound */
-
- private Object value;
-
-
+ private final Object value;
/**
- *
* Constructs an event that notifies an object that it
- * has been bound to or unbound from a session.
+ * has been bound to or unbound from a session.
* To receive the event, the object must implement
* {@link HttpSessionBindingListener}.
*
- *
- *
- * @param session the session to which the object is bound or unbound
- *
- * @param name the name with which the object is bound or unbound
- *
- * @see #getName
- * @see #getSession
- *
+ * @param session the session to which the object is bound or unbound
+ * @param name the name with which the object is bound or unbound
+ * @see #getName
+ * @see #getSession
*/
-
public HttpSessionBindingEvent(HttpSession session, String name) {
- super(session);
- this.name = name;
+ super(session);
+ this.name = name;
+ value = null;
}
-
+
/**
- *
* Constructs an event that notifies an object that it
- * has been bound to or unbound from a session.
+ * has been bound to or unbound from a session.
* To receive the event, the object must implement
* {@link HttpSessionBindingListener}.
*
- *
- *
- * @param session the session to which the object is bound or unbound
- *
- * @param name the name with which the object is bound or unbound
- *
- * @see #getName
- * @see #getSession
- *
+ * @param session the session to which the object is bound or unbound
+ * @param name the name with which the object is bound or unbound
+ * @see #getName
+ * @see #getSession
*/
-
public HttpSessionBindingEvent(HttpSession session, String name, Object value) {
- super(session);
- this.name = name;
- this.value = value;
+ super(session);
+ this.name = name;
+ this.value = value;
}
-
-
- /** Return the session that changed. */
- public HttpSession getSession () {
- return super.getSession();
+
+ /**
+ * Return the session that changed.
+ */
+ public HttpSession getSession() {
+ return super.getSession();
}
-
-
-
-
+
/**
- *
* Returns the name with which the attribute is bound to or
* unbound from the session.
*
- *
- * @return a string specifying the name with which
- * the object is bound to or unbound from
- * the session
- *
- *
+ * @return a string specifying the name with which
+ * the object is bound to or unbound from
+ * the session
*/
-
public String getName() {
- return name;
+ return name;
}
-
+
/**
- * Returns the value of the attribute that has been added, removed or replaced.
- * If the attribute was added (or bound), this is the value of the attribute. If the attribute was
- * removed (or unbound), this is the value of the removed attribute. If the attribute was replaced, this
- * is the old value of the attribute.
- *
- * @since 2.3
- */
-
- public Object getValue() {
- return this.value;
- }
-
+ * Returns the value of the attribute that has been added, removed or replaced.
+ * If the attribute was added (or bound), this is the value of the attribute. If the attribute was
+ * removed (or unbound), this is the value of the removed attribute. If the attribute was replaced, this
+ * is the old value of the attribute.
+ *
+ * @since 2.3
+ */
+ public Object getValue() {
+ return this.value;
+ }
+
}
Modified: geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionBindingListener.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionBindingListener.java?rev=788194&r1=788193&r2=788194&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionBindingListener.java (original)
+++ geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionBindingListener.java Wed Jun 24 22:05:48 2009
@@ -28,44 +28,31 @@
* of a servlet programmer explicitly unbinding an attribute from a session,
* due to a session being invalidated, or due to a session timing out.
*
- *
- * @author Various
- * @version $Version$
- *
+ * @version $Rev$ $Date$
* @see HttpSession
* @see HttpSessionBindingEvent
*/
public interface HttpSessionBindingListener extends EventListener {
/**
- *
* Notifies the object that it is being bound to
* a session and identifies the session.
*
- * @param event the event that identifies the
- * session
- *
+ * @param event the event that identifies the
+ * session
* @see #valueUnbound
- *
- */
+ */
+ void valueBound(HttpSessionBindingEvent event);
- public void valueBound(HttpSessionBindingEvent event);
-
-
/**
- *
* Notifies the object that it is being unbound
* from a session and identifies the session.
*
- * @param event the event that identifies
- * the session
- *
+ * @param event the event that identifies
+ * the session
* @see #valueBound
- *
*/
+ void valueUnbound(HttpSessionBindingEvent event);
- public void valueUnbound(HttpSessionBindingEvent event);
-
-
}
Modified: geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionContext.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionContext.java?rev=788194&r1=788193&r2=788194&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionContext.java (original)
+++ geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionContext.java Wed Jun 24 22:05:48 2009
@@ -22,45 +22,32 @@
import java.util.Enumeration;
/**
- * @author Various
- * @version $Version$
- *
- * @deprecated As of Java(tm) Servlet API 2.1
- * for security reasons, with no replacement.
- * This interface will be removed in a future
- * version of this API.
- *
- * @see HttpSession
- * @see HttpSessionBindingEvent
- * @see HttpSessionBindingListener
- *
+ * @version $Rev$ $Date$
+ * @see HttpSession
+ * @see HttpSessionBindingEvent
+ * @see HttpSessionBindingListener
+ * @deprecated As of Java(tm) Servlet API 2.1
+ * for security reasons, with no replacement.
+ * This interface will be removed in a future
+ * version of this API.
*/
public interface HttpSessionContext {
/**
- *
- * @deprecated As of Java Servlet API 2.1 with
- * no replacement. This method must
- * return null and will be removed in
- * a future version of this API.
- *
+ * @deprecated As of Java Servlet API 2.1 with
+ * no replacement. This method must
+ * return null and will be removed in
+ * a future version of this API.
*/
+ HttpSession getSession(String sessionId);
- public HttpSession getSession(String sessionId);
-
-
-
-
/**
- *
- * @deprecated As of Java Servlet API 2.1 with
- * no replacement. This method must return
- * an empty <code>Enumeration</code> and will be removed
- * in a future version of this API.
- *
+ * @deprecated As of Java Servlet API 2.1 with
+ * no replacement. This method must return
+ * an empty <code>Enumeration</code> and will be removed
+ * in a future version of this API.
*/
-
- public Enumeration getIds();
+ Enumeration<String> getIds();
}
Modified: geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionEvent.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionEvent.java?rev=788194&r1=788193&r2=788194&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionEvent.java (original)
+++ geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionEvent.java Wed Jun 24 22:05:48 2009
@@ -19,16 +19,25 @@
package javax.servlet.http;
- /** This is the class representing event notifications for
- * changes to sessions within a web application.
- * @since v 2.3
- */
+/**
+ * This is the class representing event notifications for
+ * changes to sessions within a web application.
+ *
+ * @version $Rev$ $Date$
+ * @since v 2.3
+ */
public class HttpSessionEvent extends java.util.EventObject {
- /** Construct a session event from the given source.*/
- public HttpSessionEvent(HttpSession source) {
- super(source);
-}
- /** Return the session that changed.*/
+
+ /**
+ * Construct a session event from the given source.
+ */
+ public HttpSessionEvent(HttpSession source) {
+ super(source);
+ }
+
+ /**
+ * Return the session that changed.
+ */
public HttpSession getSession () {
return (HttpSession) super.getSource();
}
Modified: geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionListener.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionListener.java?rev=788194&r1=788193&r2=788194&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionListener.java (original)
+++ geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpSessionListener.java Wed Jun 24 22:05:48 2009
@@ -21,28 +21,32 @@
import java.util.EventListener;
- /**
- * Implementations of this interface are notified of changes to the
- * list of active sessions in a web application.
- * To receive notification events, the implementation class
- * must be configured in the deployment descriptor for the web application.
- * @see HttpSessionEvent
- * @since v 2.3
- */
+/**
+ * Implementations of this interface are notified of changes to the
+ * list of active sessions in a web application.
+ * To receive notification events, the implementation class
+ * must be configured in the deployment descriptor for the web application.
+ *
+ * @version $Rev$ $Date$
+ * @see HttpSessionEvent
+ * @since v 2.3
+ */
public interface HttpSessionListener extends EventListener {
-
- /**
- * Notification that a session was created.
- * @param se the notification event
- */
- public void sessionCreated ( HttpSessionEvent se );
-
- /**
- * Notification that a session is about to be invalidated.
- * @param se the notification event
- */
- public void sessionDestroyed ( HttpSessionEvent se );
-
+
+ /**
+ * Notification that a session was created.
+ *
+ * @param se the notification event
+ */
+ void sessionCreated(HttpSessionEvent se);
+
+ /**
+ * Notification that a session is about to be invalidated.
+ *
+ * @param se the notification event
+ */
+ void sessionDestroyed(HttpSessionEvent se);
+
}
Modified: geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpUtils.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpUtils.java?rev=788194&r1=788193&r2=788194&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpUtils.java (original)
+++ geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/HttpUtils.java Wed Jun 24 22:05:48 2009
@@ -20,183 +20,159 @@
package javax.servlet.http;
import javax.servlet.ServletInputStream;
+
import java.util.Hashtable;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
import java.io.IOException;
/**
- * @deprecated As of Java(tm) Servlet API 2.3.
- * These methods were only useful
- * with the default encoding and have been moved
- * to the request interfaces.
- *
-*/
+ * @version $Rev$ $Date$
+ * @deprecated As of Java(tm) Servlet API 2.3.
+ * These methods were only useful
+ * with the default encoding and have been moved
+ * to the request interfaces.
+ */
public class HttpUtils {
private static final String LSTRING_FILE =
- "javax.servlet.http.LocalStrings";
+ "javax.servlet.http.LocalStrings";
private static ResourceBundle lStrings =
- ResourceBundle.getBundle(LSTRING_FILE);
-
-
-
+ ResourceBundle.getBundle(LSTRING_FILE);
+
/**
* Constructs an empty <code>HttpUtils</code> object.
- *
*/
-
- public HttpUtils() {}
-
-
-
-
+ public HttpUtils() {
+ }
/**
- *
* Parses a query string passed from the client to the
* server and builds a <code>HashTable</code> object
- * with key-value pairs.
+ * with key-value pairs.
* The query string should be in the form of a string
* packaged by the GET or POST method, that is, it
* should have key-value pairs in the form <i>key=value</i>,
* with each pair separated from the next by a & character.
- *
+ * <p/>
* <p>A key can appear more than once in the query string
- * with different values. However, the key appears only once in
+ * with different values. However, the key appears only once in
* the hashtable, with its value being
* an array of strings containing the multiple values sent
* by the query string.
- *
+ * <p/>
* <p>The keys and values in the hashtable are stored in their
* decoded form, so
* any + characters are converted to spaces, and characters
* sent in hexadecimal notation (like <i>%xx</i>) are
* converted to ASCII characters.
*
- * @param s a string containing the query to be parsed
- *
- * @return a <code>HashTable</code> object built
- * from the parsed key-value pairs
- *
- * @exception IllegalArgumentException if the query string
- * is invalid
- *
+ * @param s a string containing the query to be parsed
+ * @throws IllegalArgumentException if the query string
+ * is invalid
+ * @return a <code>HashTable</code> object built
+ * from the parsed key-value pairs
*/
+ static public Hashtable<String, String[]> parseQueryString(String s) {
- static public Hashtable parseQueryString(String s) {
+ String valArray[];
- String valArray[] = null;
-
- if (s == null) {
- throw new IllegalArgumentException();
- }
- Hashtable ht = new Hashtable();
- StringBuffer sb = new StringBuffer();
- StringTokenizer st = new StringTokenizer(s, "&");
- while (st.hasMoreTokens()) {
- String pair = (String)st.nextToken();
- int pos = pair.indexOf('=');
- if (pos == -1) {
- // XXX
- // should give more detail about the illegal argument
- throw new IllegalArgumentException();
- }
- String key = parseName(pair.substring(0, pos), sb);
- String val = parseName(pair.substring(pos+1, pair.length()), sb);
- if (ht.containsKey(key)) {
- String oldVals[] = (String []) ht.get(key);
- valArray = new String[oldVals.length + 1];
- for (int i = 0; i < oldVals.length; i++)
- valArray[i] = oldVals[i];
- valArray[oldVals.length] = val;
- } else {
- valArray = new String[1];
- valArray[0] = val;
- }
- ht.put(key, valArray);
- }
- return ht;
+ if (s == null) {
+ throw new IllegalArgumentException();
+ }
+ Hashtable<String, String[]> ht = new Hashtable<String, String[]>();
+ StringBuffer sb = new StringBuffer();
+ StringTokenizer st = new StringTokenizer(s, "&");
+ while (st.hasMoreTokens()) {
+ String pair = st.nextToken();
+ int pos = pair.indexOf('=');
+ if (pos == -1) {
+ // XXX
+ // should give more detail about the illegal argument
+ throw new IllegalArgumentException();
+ }
+ String key = parseName(pair.substring(0, pos), sb);
+ String val = parseName(pair.substring(pos + 1, pair.length()), sb);
+ if (ht.containsKey(key)) {
+ String oldVals[] = ht.get(key);
+ valArray = new String[oldVals.length + 1];
+ System.arraycopy(oldVals, 0, valArray, 0, oldVals.length);
+ valArray[oldVals.length] = val;
+ } else {
+ valArray = new String[1];
+ valArray[0] = val;
+ }
+ ht.put(key, valArray);
+ }
+ return ht;
}
-
-
-
/**
- *
- * Parses data from an HTML form that the client sends to
- * the server using the HTTP POST method and the
+ * Parses data from an HTML form that the client sends to
+ * the server using the HTTP POST method and the
* <i>application/x-www-form-urlencoded</i> MIME type.
- *
+ * <p/>
* <p>The data sent by the POST method contains key-value
* pairs. A key can appear more than once in the POST data
- * with different values. However, the key appears only once in
+ * with different values. However, the key appears only once in
* the hashtable, with its value being
* an array of strings containing the multiple values sent
* by the POST method.
- *
+ * <p/>
* <p>The keys and values in the hashtable are stored in their
* decoded form, so
* any + characters are converted to spaces, and characters
* sent in hexadecimal notation (like <i>%xx</i>) are
* converted to ASCII characters.
*
- *
- *
- * @param len an integer specifying the length,
- * in characters, of the
- * <code>ServletInputStream</code>
- * object that is also passed to this
- * method
- *
- * @param in the <code>ServletInputStream</code>
- * object that contains the data sent
- * from the client
- *
- * @return a <code>HashTable</code> object built
- * from the parsed key-value pairs
- *
- *
- * @exception IllegalArgumentException if the data
- * sent by the POST method is invalid
- *
+ * @param len an integer specifying the length,
+ * in characters, of the
+ * <code>ServletInputStream</code>
+ * object that is also passed to this
+ * method
+ * @param in the <code>ServletInputStream</code>
+ * object that contains the data sent
+ * from the client
+ * @throws IllegalArgumentException if the data
+ * sent by the POST method is invalid
+ * @return a <code>HashTable</code> object built
+ * from the parsed key-value pairs
*/
-
- static public Hashtable parsePostData(int len,
- ServletInputStream in)
- {
- // XXX
- // should a length of 0 be an IllegalArgumentException
-
- if (len <=0)
- return new Hashtable(); // cheap hack to return an empty hash
-
- if (in == null) {
- throw new IllegalArgumentException();
- }
-
- //
- // Make sure we read the entire POSTed body.
- //
- byte[] postedBytes = new byte [len];
+
+ static public Hashtable<String, String[]> parsePostData(int len,
+ ServletInputStream in) {
+ // XXX
+ // should a length of 0 be an IllegalArgumentException
+
+ if (len <= 0)
+ return new Hashtable<String, String[]>(); // cheap hack to return an empty hash
+
+ if (in == null) {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ // Make sure we read the entire POSTed body.
+ //
+ byte[] postedBytes = new byte[len];
try {
int offset = 0;
-
- do {
- int inputLen = in.read (postedBytes, offset, len - offset);
- if (inputLen <= 0) {
- String msg = lStrings.getString("err.io.short_read");
- throw new IllegalArgumentException (msg);
- }
- offset += inputLen;
- } while ((len - offset) > 0);
-
- } catch (IOException e) {
- throw new IllegalArgumentException(e.getMessage());
- }
+
+ do {
+ int inputLen = in.read(postedBytes, offset, len - offset);
+ if (inputLen <= 0) {
+ String msg = lStrings.getString("err.io.short_read");
+ throw new IllegalArgumentException(msg);
+ }
+ offset += inputLen;
+ } while ((len - offset) > 0);
+
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e.getMessage());
+ }
// XXX we shouldn't assume that the only kind of POST body
// is FORM data encoded using ASCII or ISO Latin/1 ... or
@@ -214,94 +190,84 @@
}
-
-
/*
- * Parse a name in the query string.
- */
-
+ * Parse a name in the query string.
+ */
static private String parseName(String s, StringBuffer sb) {
- sb.setLength(0);
- for (int i = 0; i < s.length(); i++) {
- char c = s.charAt(i);
- switch (c) {
- case '+':
- sb.append(' ');
- break;
- case '%':
- try {
- sb.append((char) Integer.parseInt(s.substring(i+1, i+3),
- 16));
- i += 2;
- } catch (NumberFormatException e) {
- // XXX
- // need to be more specific about illegal arg
- throw new IllegalArgumentException();
- } catch (StringIndexOutOfBoundsException e) {
- String rest = s.substring(i);
- sb.append(rest);
- if (rest.length()==2)
- i++;
- }
-
- break;
- default:
- sb.append(c);
- break;
- }
- }
- return sb.toString();
+ sb.setLength(0);
+ for (int i = 0; i < s.length(); i++) {
+ char c = s.charAt(i);
+ switch (c) {
+ case '+':
+ sb.append(' ');
+ break;
+ case '%':
+ try {
+ sb.append((char) Integer.parseInt(s.substring(i + 1, i + 3),
+ 16));
+ i += 2;
+ } catch (NumberFormatException e) {
+ // XXX
+ // need to be more specific about illegal arg
+ throw new IllegalArgumentException();
+ } catch (StringIndexOutOfBoundsException e) {
+ String rest = s.substring(i);
+ sb.append(rest);
+ if (rest.length() == 2)
+ i++;
+ }
+
+ break;
+ default:
+ sb.append(c);
+ break;
+ }
+ }
+ return sb.toString();
}
-
-
-
/**
- *
* Reconstructs the URL the client used to make the request,
* using information in the <code>HttpServletRequest</code> object.
* The returned URL contains a protocol, server name, port
* number, and server path, but it does not include query
* string parameters.
- *
+ * <p/>
* <p>Because this method returns a <code>StringBuffer</code>,
* not a string, you can modify the URL easily, for example,
* to append query parameters.
- *
+ * <p/>
* <p>This method is useful for creating redirect messages
* and for reporting errors.
*
- * @param req a <code>HttpServletRequest</code> object
- * containing the client's request
- *
- * @return a <code>StringBuffer</code> object containing
- * the reconstructed URL
- *
+ * @param req a <code>HttpServletRequest</code> object
+ * containing the client's request
+ * @return a <code>StringBuffer</code> object containing
+ * the reconstructed URL
*/
-
- public static StringBuffer getRequestURL (HttpServletRequest req) {
- StringBuffer url = new StringBuffer ();
- String scheme = req.getScheme ();
- int port = req.getServerPort ();
- String urlPath = req.getRequestURI();
-
- //String servletPath = req.getServletPath ();
- //String pathInfo = req.getPathInfo ();
-
- url.append (scheme); // http, https
- url.append ("://");
- url.append (req.getServerName ());
- if ((scheme.equals ("http") && port != 80)
- || (scheme.equals ("https") && port != 443)) {
- url.append (':');
- url.append (req.getServerPort ());
- }
- //if (servletPath != null)
- // url.append (servletPath);
- //if (pathInfo != null)
- // url.append (pathInfo);
- url.append(urlPath);
- return url;
+ public static StringBuffer getRequestURL(HttpServletRequest req) {
+ StringBuffer url = new StringBuffer();
+ String scheme = req.getScheme();
+ int port = req.getServerPort();
+ String urlPath = req.getRequestURI();
+
+ //String servletPath = req.getServletPath ();
+ //String pathInfo = req.getPathInfo ();
+
+ url.append(scheme); // http, https
+ url.append("://");
+ url.append(req.getServerName());
+ if ((scheme.equals("http") && port != 80)
+ || (scheme.equals("https") && port != 443)) {
+ url.append(':');
+ url.append(req.getServerPort());
+ }
+ //if (servletPath != null)
+ // url.append (servletPath);
+ //if (pathInfo != null)
+ // url.append (pathInfo);
+ url.append(urlPath);
+ return url;
}
}
Added: geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/Part.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/Part.java?rev=788194&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/Part.java (added)
+++ geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/Part.java Wed Jun 24 22:05:48 2009
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package javax.servlet.http;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+/**
+ * multipart/form-data part or form item
+ *
+ * @version $Rev$ $Date$
+ * @since 3.0
+ */
+public interface Part {
+
+ void delete() throws IOException;
+
+ String getContentType();
+
+ String getHeader();
+
+ Iterable<String> getHeaderNames();
+
+ Iterable<String> getHeaders();
+
+ InputStream getInputStream() throws IOException;
+
+ String getName();
+
+ long getSize();
+
+ void write(String fileName) throws IOException;
+
+}
Propchange: geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/Part.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/Part.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/specs/trunk/geronimo-servlet_3.0_spec/src/main/java/javax/servlet/http/Part.java
------------------------------------------------------------------------------
svn:mime-type = text/plain