Changeset 13634 in osm for applications
- Timestamp:
- 2009-02-09T16:57:02+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java
r13497 r13634 24 24 import java.net.MalformedURLException; 25 25 import java.net.URL; 26 import java.nio.ByteBuffer; 27 import java.nio.CharBuffer; 28 import java.nio.charset.Charset; 29 import java.nio.charset.CharsetEncoder; 30 import java.nio.charset.CharacterCodingException; 26 31 import java.text.DateFormat; 27 32 import java.text.SimpleDateFormat; … … 167 172 if(checkForErrors(username, password, description, gpxData)) 168 173 return; 169 170 171 174 175 OkButton.setEnabled(false); 176 172 177 description = description.replaceAll("[&?/\\\\]"," "); 173 178 tags = tags.replaceAll("[&?/\\\\.,;]"," "); … … 185 190 connect.setRequestMethod("POST"); 186 191 connect.setDoOutput(true); 187 connect.addRequestProperty("Authorization", "Basic " + Base64.encode(username + ":" + password)); 192 193 CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder(); 194 String auth = username + ":" + password; 195 ByteBuffer bytes = encoder.encode(CharBuffer.wrap(auth)); 196 connect.addRequestProperty("Authorization", "Basic " + Base64.encode(bytes)); 197 188 198 connect.addRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY); 189 199 connect.addRequestProperty("Connection", "close"); // counterpart of keep-alive
Note:
See TracChangeset
for help on using the changeset viewer.