fixed that Login dialog so that hitting Enter after keying in your password
should trigger the "Log In" button, NOT the reminder button! Also, small enhancements to a couple of classes in conjunction with the new UI work.
This commit is contained in:
		
							parent
							
								
									1a7ebd0446
								
							
						
					
					
						commit
						c7edf62aae
					
				@ -47,14 +47,14 @@ import org.apache.log4j.*;
 | 
			
		||||
 * @see ServletMultipartException
 | 
			
		||||
 * @see javax.servlet.ServletRequest
 | 
			
		||||
 */
 | 
			
		||||
public class ServletMultipartHandler
 | 
			
		||||
public final class ServletMultipartHandler
 | 
			
		||||
{
 | 
			
		||||
  /*--------------------------------------------------------------------------------
 | 
			
		||||
   * Internal wrapper around the ServletRequest that implements DataSource
 | 
			
		||||
   *--------------------------------------------------------------------------------
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  class ServletDataSource implements DataSource
 | 
			
		||||
  static class ServletDataSource implements DataSource
 | 
			
		||||
  {
 | 
			
		||||
    private ServletRequest request;
 | 
			
		||||
    private InputStream istm = null;
 | 
			
		||||
@ -155,7 +155,7 @@ public class ServletMultipartHandler
 | 
			
		||||
   *--------------------------------------------------------------------------------
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  class MultipartParameter
 | 
			
		||||
  final class MultipartParameter
 | 
			
		||||
  {
 | 
			
		||||
    private MimeBodyPart part;   // the actual body part data
 | 
			
		||||
    private String name;         // the parameter name
 | 
			
		||||
@ -231,19 +231,19 @@ public class ServletMultipartHandler
 | 
			
		||||
 | 
			
		||||
    } // end constructor
 | 
			
		||||
 | 
			
		||||
    public String getName()
 | 
			
		||||
    public final String getName()
 | 
			
		||||
    {
 | 
			
		||||
      return name;
 | 
			
		||||
 | 
			
		||||
    } // end getName
 | 
			
		||||
 | 
			
		||||
    public boolean isFile()
 | 
			
		||||
    public final boolean isFile()
 | 
			
		||||
    {
 | 
			
		||||
      return (filename!=null);
 | 
			
		||||
 | 
			
		||||
    } // end isFile
 | 
			
		||||
 | 
			
		||||
    public String getValue()
 | 
			
		||||
    public final String getValue()
 | 
			
		||||
    {
 | 
			
		||||
      if (filename!=null)
 | 
			
		||||
	return filename;  // "value" for file parts is the filename
 | 
			
		||||
@ -265,7 +265,7 @@ public class ServletMultipartHandler
 | 
			
		||||
 | 
			
		||||
    } // end getValue
 | 
			
		||||
 | 
			
		||||
    public String getContentType()
 | 
			
		||||
    public final String getContentType()
 | 
			
		||||
    {
 | 
			
		||||
      try
 | 
			
		||||
      { // pass through to the interior part
 | 
			
		||||
@ -281,7 +281,7 @@ public class ServletMultipartHandler
 | 
			
		||||
 | 
			
		||||
    } // end getContentType
 | 
			
		||||
 | 
			
		||||
    public int getSize()
 | 
			
		||||
    public final int getSize()
 | 
			
		||||
    {
 | 
			
		||||
      try
 | 
			
		||||
      { // pass through to the interior part
 | 
			
		||||
@ -297,7 +297,7 @@ public class ServletMultipartHandler
 | 
			
		||||
 | 
			
		||||
    } // end getSize
 | 
			
		||||
 | 
			
		||||
    public MultipartDataValue getContent() throws ServletMultipartException
 | 
			
		||||
    public final MultipartDataValue getContent() throws ServletMultipartException
 | 
			
		||||
    {
 | 
			
		||||
      if (filename==null)
 | 
			
		||||
	return null;  // not a file parameter
 | 
			
		||||
@ -378,7 +378,8 @@ public class ServletMultipartHandler
 | 
			
		||||
      for (int i=0; i<count; i++)
 | 
			
		||||
      { // create the MultipartParameter structures and stash them for later use
 | 
			
		||||
	MultipartParameter parm = new MultipartParameter((MimeBodyPart)(multipart.getBodyPart(i)));
 | 
			
		||||
	param_byname.put(parm.getName(),parm);
 | 
			
		||||
	if (param_byname.get(parm.getName())==null)
 | 
			
		||||
	  param_byname.put(parm.getName(),parm);
 | 
			
		||||
	param_order.add(parm);
 | 
			
		||||
 | 
			
		||||
      } // end count
 | 
			
		||||
@ -409,7 +410,7 @@ public class ServletMultipartHandler
 | 
			
		||||
   * @return <CODE>true</CODE> if the given <CODE>ServletRequest</CODE> can be handled by
 | 
			
		||||
   *         the <CODE>ServletMultipartHandler</CODE>, <CODE>false</CODE> if not.
 | 
			
		||||
   */
 | 
			
		||||
  public static boolean canHandle(ServletRequest request)
 | 
			
		||||
  public final static boolean canHandle(ServletRequest request)
 | 
			
		||||
  {
 | 
			
		||||
    String ctype = request.getContentType();
 | 
			
		||||
    return (ctype.startsWith("multipart/form-data"));
 | 
			
		||||
@ -428,7 +429,7 @@ public class ServletMultipartHandler
 | 
			
		||||
   * @see #getParamNames()
 | 
			
		||||
   * @see java.util.Enumeration
 | 
			
		||||
   */
 | 
			
		||||
  public Enumeration getNames()
 | 
			
		||||
  public final Enumeration getNames()
 | 
			
		||||
  {
 | 
			
		||||
    ArrayList tmp_v = new ArrayList();
 | 
			
		||||
    Iterator it = param_order.iterator();
 | 
			
		||||
@ -451,7 +452,7 @@ public class ServletMultipartHandler
 | 
			
		||||
   * @see #getNames()
 | 
			
		||||
   * @see java.util.Iterator
 | 
			
		||||
   */
 | 
			
		||||
  public Iterator getParamNames()
 | 
			
		||||
  public final Iterator getParamNames()
 | 
			
		||||
  {
 | 
			
		||||
    ArrayList tmp_v = new ArrayList();
 | 
			
		||||
    Iterator it = param_order.iterator();
 | 
			
		||||
@ -473,7 +474,7 @@ public class ServletMultipartHandler
 | 
			
		||||
   * @return <CODE>true</CODE> if the specified parameter is a file parameter, <CODE>false</CODE> of not.
 | 
			
		||||
   *         If no parameter by this name exists in the request, the method returns <CODE>false</CODE>.
 | 
			
		||||
   */
 | 
			
		||||
  public boolean isFileParam(String name)
 | 
			
		||||
  public final boolean isFileParam(String name)
 | 
			
		||||
  {
 | 
			
		||||
    MultipartParameter parm = (MultipartParameter)(param_byname.get(name));
 | 
			
		||||
    if (parm==null)
 | 
			
		||||
@ -489,13 +490,15 @@ public class ServletMultipartHandler
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Returns the value of the parameter with the specified name.  In the case of file parameters, returns
 | 
			
		||||
   * the name of the file that was uploaded.
 | 
			
		||||
   * the name of the file that was uploaded.<P>
 | 
			
		||||
   * If the parameter may have multiple values, you should use {@link getParamValues(java.lang.String)} to
 | 
			
		||||
   * return all possible values for this parameter.
 | 
			
		||||
   *
 | 
			
		||||
   * @param name Name of the parameter to return.
 | 
			
		||||
   * @return Value of the parameter, which is a filename if this parameter is a file.  If no parameter by
 | 
			
		||||
   *         this name exists in the request, the method returns <CODE>null</CODE>.
 | 
			
		||||
   */
 | 
			
		||||
  public String getValue(String name)
 | 
			
		||||
  public final String getValue(String name)
 | 
			
		||||
  {
 | 
			
		||||
    MultipartParameter parm = (MultipartParameter)(param_byname.get(name));
 | 
			
		||||
    if (parm==null)
 | 
			
		||||
@ -509,6 +512,37 @@ public class ServletMultipartHandler
 | 
			
		||||
 | 
			
		||||
  } // end getValue
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Returns an array of <CODE>String</CODE> objects containing all of the values the given request
 | 
			
		||||
   * parameter has, or <CODE>null</CODE> if the parameter does not exist.  In the case of file parameters,
 | 
			
		||||
   * the value is ne name of the file that was uploaded.  If the parameter has a single value, the returned
 | 
			
		||||
   * array has a length of 1.
 | 
			
		||||
   *
 | 
			
		||||
   * @param name Name of the parameter to return.
 | 
			
		||||
   * @return Array containing all of the values associated with this parameter name.  If no values
 | 
			
		||||
   *         are associated with the parameter name, returns <CODE>null</CODE>.
 | 
			
		||||
   */
 | 
			
		||||
  public final String[] getParamValues(String name)
 | 
			
		||||
  {
 | 
			
		||||
    if (!(param_byname.containsKey(name)))
 | 
			
		||||
      return null;  // no parameters with this name
 | 
			
		||||
 | 
			
		||||
    // Collect all the parameter values with this name.
 | 
			
		||||
    ArrayList rc = new ArrayList(param_order.size());
 | 
			
		||||
    Iterator it = param_order.iterator();
 | 
			
		||||
    while (it.hasNext())
 | 
			
		||||
    { // find names that match, copy values
 | 
			
		||||
      MultipartParameter parm = (MultipartParameter)(it.next());
 | 
			
		||||
      if (parm.getName().equals(name))
 | 
			
		||||
	rc.add(parm.getValue());
 | 
			
		||||
 | 
			
		||||
    } // end while
 | 
			
		||||
 | 
			
		||||
    // return the results array
 | 
			
		||||
    return (String[])(rc.toArray(new String[0]));
 | 
			
		||||
 | 
			
		||||
  } // end getParamValues
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Returns the MIME type of the file parameter with the specified name.  Ordinary text parameters return
 | 
			
		||||
   * the MIME type <CODE>text/plain</CODE>.
 | 
			
		||||
@ -517,7 +551,7 @@ public class ServletMultipartHandler
 | 
			
		||||
   * @return Content type of the parameter.  If no parameter by this name exists in the request, the method
 | 
			
		||||
   *         returns <CODE>null</CODE>.
 | 
			
		||||
   */
 | 
			
		||||
  public String getContentType(String name)
 | 
			
		||||
  public final String getContentType(String name)
 | 
			
		||||
  {
 | 
			
		||||
    MultipartParameter parm = (MultipartParameter)(param_byname.get(name));
 | 
			
		||||
    if (parm==null)
 | 
			
		||||
@ -539,7 +573,7 @@ public class ServletMultipartHandler
 | 
			
		||||
   * @return Size in bytes of the parameter.  If no parameter by this name exists in the request, the method
 | 
			
		||||
   *         returns -1.
 | 
			
		||||
   */
 | 
			
		||||
  public int getContentSize(String name)
 | 
			
		||||
  public final int getContentSize(String name)
 | 
			
		||||
  {
 | 
			
		||||
    MultipartParameter parm = (MultipartParameter)(param_byname.get(name));
 | 
			
		||||
    if (parm==null)
 | 
			
		||||
@ -563,7 +597,7 @@ public class ServletMultipartHandler
 | 
			
		||||
   * @see #getFileContentStream()
 | 
			
		||||
   * @see java.sql.Blob
 | 
			
		||||
   */
 | 
			
		||||
  public Blob getFileContentBlob(String name) throws ServletMultipartException
 | 
			
		||||
  public final Blob getFileContentBlob(String name) throws ServletMultipartException
 | 
			
		||||
  {
 | 
			
		||||
    MultipartParameter parm = (MultipartParameter)(param_byname.get(name));
 | 
			
		||||
    if (parm==null)
 | 
			
		||||
@ -587,7 +621,7 @@ public class ServletMultipartHandler
 | 
			
		||||
   * @see #getFileContentBlob()
 | 
			
		||||
   * @see java.io.InputStream
 | 
			
		||||
   */
 | 
			
		||||
  public InputStream getFileContentStream(String name) throws ServletMultipartException
 | 
			
		||||
  public final InputStream getFileContentStream(String name) throws ServletMultipartException
 | 
			
		||||
  {
 | 
			
		||||
    MultipartParameter parm = (MultipartParameter)(param_byname.get(name));
 | 
			
		||||
    if (parm==null)
 | 
			
		||||
 | 
			
		||||
@ -33,13 +33,14 @@ public class LoginDialog extends ContentDialog
 | 
			
		||||
    super("Log In",null,"loginform","account");
 | 
			
		||||
    setHiddenField("cmd","L");
 | 
			
		||||
    setHiddenField("tgt","");
 | 
			
		||||
    setInstructions("Forgot your password?  Enter your user name and click the Reminder button to receive "
 | 
			
		||||
		    + "a password reminder via E-mail.");
 | 
			
		||||
    addFormField(new CDVeniceIDFormField("user","User name",null,false,32,64));
 | 
			
		||||
    addFormField(new CDPasswordFormFieldCommand("pass","Password",null,false,32,128,
 | 
			
		||||
						new CDImageButton("remind","bn_reminder.gif","Reminder",
 | 
			
		||||
								  80,24)));
 | 
			
		||||
    addFormField(new CDPasswordFormField("pass","Password",null,false,32,128));
 | 
			
		||||
    addFormField(new CDCheckBoxFormField("saveme","Remember me for next time so I can log in automatically",
 | 
			
		||||
    					 null,"Y"));
 | 
			
		||||
    addCommandButton(new CDImageButton("login","bn_log_in.gif","Log In",80,24));
 | 
			
		||||
    addCommandButton(new CDImageButton("remind","bn_reminder.gif","Password Reminder",80,24));
 | 
			
		||||
    addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24));
 | 
			
		||||
 | 
			
		||||
  } // end constructor
 | 
			
		||||
 | 
			
		||||
@ -241,6 +241,12 @@ public class XMLLoader
 | 
			
		||||
    
 | 
			
		||||
  } // end configVerifyNodeName
 | 
			
		||||
 | 
			
		||||
  public final void configVerifyNodeName(Node n, String name) throws ConfigException
 | 
			
		||||
  {
 | 
			
		||||
    configVerifyNodeName(n,name,(Element)(n.getParentNode()));
 | 
			
		||||
 | 
			
		||||
  } // end configVerifyNodeName
 | 
			
		||||
 | 
			
		||||
  public final void configVerifyTagName(Element tag, String name) throws ConfigException
 | 
			
		||||
  {
 | 
			
		||||
    if (tag.getTagName().equals(name))
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user