JSP聊天系统

源代码在线查看: request.java

软件大小: 4920 K
上传用户: wylyyzjz
关键词: JSP
下载地址: 免注册下载 普通下载 VIP

相关代码

				package org.ehotsoft.yekki.upload;
				
				import java.util.Enumeration;
				import java.util.Hashtable;
				
				public class Request {
				
				    private Hashtable parameters;
				    private int counter;
				
				    Request() {
				
				        parameters = new Hashtable();
				        counter = 0;
				    }
				
				    protected void putParameter( String name, String value ) {
				
				        if( name == null ) {
				
				            throw new IllegalArgumentException( "The name of an element cannot be null." );
						}
				
						if( parameters.containsKey( name ) ) {
				
				            Hashtable values = ( Hashtable )parameters.get( name );
				            values.put( new Integer( values.size() ), value );
				        }
						else {
				
				            Hashtable values = new Hashtable();
				            values.put( new Integer( 0 ), value );
				            parameters.put( name, values );
				            counter++;
				        }
				    }
				
				    public String getParameter( String name ) {
				
				        if( name == null )
				            throw new IllegalArgumentException( "Form's name is invalid or does not exist ( 1305 )." );
				        Hashtable values = ( Hashtable )parameters.get( name );
				        if( values == null )
				            return null;
				        else
				            return ( String )values.get( new Integer( 0 ) );
				    }
				
				    public Enumeration getParameterNames() {
				
				        return parameters.keys();
				    }
				
				    public String[] getParameterValues( String name ) {
				
				        if( name == null ) {
				
				            throw new IllegalArgumentException( "Form's name is invalid or does not exist ( 1305 )." );
				        }
				
						Hashtable values = ( Hashtable )parameters.get( name );
				        
						if( values == null ) {
				
				            return null;
				        }
				
						String strValues[] = new String[ values.size() ];
				        
						for( int i = 0; i < values.size(); i++ ) {
				
				            strValues[i] = ( String )values.get( new Integer( i ) );
						}
				
				        return strValues;
				    }
				}
							

相关资源