Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 38 package com.gargoylesoftware.htmlunit; 39 40 import org.org.apache.commons.httpclient.methods.PostMethod; 41 42 49 public final class FormEncodingType { 50 51 54 public static final FormEncodingType URL_ENCODED = 55 new FormEncodingType(PostMethod.FORM_URL_ENCODED_CONTENT_TYPE); 56 60 public static final FormEncodingType MULTIPART = new FormEncodingType("multipart/form-data"); 61 62 private final String name_; 63 64 private FormEncodingType(final String name) { 65 name_ = name; 66 } 67 68 73 public String getName() { 74 return name_; 75 } 76 77 83 public static FormEncodingType getInstance(final String name) { 84 final String lowerCaseName = name.toLowerCase(); 85 final FormEncodingType allInstances[] = new FormEncodingType[] { URL_ENCODED, MULTIPART }; 86 87 int i; 88 for (i = 0; i < allInstances.length; i++) { 89 if (allInstances[i].getName().equals(lowerCaseName)) { 90 return allInstances[i]; 91 } 92 } 93 94 if (name.equals("")) { 96 return URL_ENCODED; 97 } 98 99 throw new IllegalArgumentException ("No encoding type found for [" + name + "]"); 100 } 101 102 107 public String toString() { 108 return "EncodingType[name=" + getName() + "]"; 109 } 110 } 111
| Popular Tags
|