查询帖子http时出现非法字符

时间:2014-02-25 17:43:29

标签: java android web-services http

我遇到了发布网络服务的http链接

的问题

因此我习惯将pic编码为64字节编码以将其发送到网络服务

img参数中的问题但没有空格

任何人都可以帮我解决这个问题吗?

 java.lang.IllegalArgumentException: Illegal character in query at index 204: http://ictfox.com/Hafil_Updates/SchoolLocation_Insert.aspx?schoolId=212&Location_Longitude=0&Location_Latitude=0&Location_Image=/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB

这是我的班级代码:

                File file = new File(picturePath);
            // Get image size
            BitmapFactory.Options o = new BitmapFactory.Options();
            o.inJustDecodeBounds = true;
            BitmapFactory.decodeStream(new FileInputStream(file), null, o);

            // The new size we want to scale to
            final int MIN_SIZE = 70;

            // Find the correct scale value.
            int scale = 1;
            while (((o.outWidth / scale) >> 1) >= MIN_SIZE
                    && ((o.outHeight / scale) >> 1) >= MIN_SIZE) {
                scale <<= 1;
            }

            BitmapFactory.Options opts2 = new BitmapFactory.Options();
            opts2.inSampleSize = scale;



            try {
                // Bitmap bm = BitmapFactory.decodeFile();

                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                BitmapFactory.decodeStream(new FileInputStream(file), null,
                        opts2).compress(Bitmap.CompressFormat.JPEG, 100, baos); // bm
                                                                                // is
                                                                                // the
                                                                                // bitmap
                                                                                // object
                BitmapFactory.decodeStream(new FileInputStream(file), null,
                        opts2).recycle();
                byte[] b = baos.toByteArray();
                imageString = Base64.encodeToString(b, Base64.DEFAULT);

                Log.d("Http Response:",imageString);
                } catch (Exception e) {
                    e.printStackTrace();
                    Log.d("Http Response:", e.toString());
                }

        } catch (FileNotFoundException e) {
              Log.d("Http Response:", e.toString());
        }



    String date2 = new SimpleDateFormat("yyyy-MM-ddhh:mm:ss",Locale.getDefault()).format(new Date());

    HttpClient httpClient = new DefaultHttpClient();
    httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.BROWSER_COMPATIBILITY);
    // Creating HTTP Post
    HttpPost httpPost = new HttpPost("http://ictfox.com/Hafil_Updates/SchoolLocation_Insert.aspx?schoolId="+((MyApplication) mActivity.getApplication()).schoolNum+"&Location_Longitude="+this.txtLag+"&Location_Latitude="+this.txtLat+"&Location_Image="+imageString+"&Action_Date="+date2);




    02-25 19:56:13.103: D/GestureDetector(29778): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 5 mFalseSizeCnt:0
02-25 19:56:13.608: D/SensorManager(29778): unregisterListener:: Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,*:bb+)(
02-25 19:56:13.613: D/Sensors(29778): Remain listener = Sending .. normal delay 200ms
02-25 19:56:13.613: I/Sensors(29778): sendDelay --- 200000000
02-25 19:56:13.628: D/SensorManager(29778): JNI - sendDelay
02-25 19:56:13.633: I/SensorManager(29778): Set normal delay = true
02-25 19:56:15.773: W/IInputConnectionWrapper(29778): showStatusIcon on inactive InputConnection
02-25 19:56:46.398: D/(29778): Device driver API match
02-25 19:56:46.398: D/(29778): Device driver API version: 10
02-25 19:56:46.398: D/(29778): User space API version: 10 
02-25 19:56:46.403: D/(29778): mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Thu Oct 25 08:43:05 KST 2012 
02-25 19:56:46.508: E/SensorManager(29778): thread start
02-25 19:56:46.513: D/SensorManager(29778): registerListener :: handle = 0  name= K3DH Acceleration Sensor delay= 200000 Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,*:bb+)(
02-25 19:56:49.943: D/GestureDetector(29778): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 3 mFalseSizeCnt:0
02-25 19:56:52.628: D/GestureDetector(29778): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 4 mFalseSizeCnt:0
02-25 19:56:52.713: D/ProgressBar(29778): setProgress = 0
02-25 19:56:52.713: D/ProgressBar(29778): setProgress = 0, fromUser = false
02-25 19:56:52.713: D/ProgressBar(29778): mProgress = 0mIndeterminate = false, mMin = 0, mMax = 10000
02-25 19:56:53.093: D/SensorManager(29778): unregisterListener:: Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,*:bb+)(
02-25 19:56:53.098: D/Sensors(29778): Remain listener = Sending .. normal delay 200ms
02-25 19:56:53.098: I/Sensors(29778): sendDelay --- 200000000
02-25 19:56:53.098: D/SensorManager(29778): JNI - sendDelay
02-25 19:56:53.098: I/SensorManager(29778): Set normal delay = true
02-25 19:56:53.823: D/Http Response:(29778): /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
02-25 19:56:53.823: D/Http Response:(29778): AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEB
02-25 19:56:53.823: D/Http Response:(29778): AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCABLAGQDASIA
02-25 19:56:53.823: D/Http Response:(29778): AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA
02-25 19:56:53.823: D/Http Response:(29778): AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3
02-25 19:56:53.823: D/Http Response:(29778): ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm
02-25 19:56:53.823: D/Http Response:(29778): p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA
02-25 19:56:53.823: D/Http Response:(29778): AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx
02-25 19:56:53.823: D/Http Response:(29778): BhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK
02-25 19:56:53.823: D/Http Response:(29778): U1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3
02-25 19:56:53.823: D/Http Response:(29778): uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD+zn4p
02-25 19:56:53.823: D/Http Response:(29778): fEy+8A3WlRw2Bnt7u7SGeYFlEUZL/MAoYux2n5SME7gGDdfLf2rf2mdQ+A/wF1f4neG9Ih17VLG1
02-25 19:56:53.823: D/Http Response:(29778): tJ4rCSSRYzC86rczyGCOSQi1hEkuxF3yMojVlJzTfjv4z0jVdYh0CEo/9mOJLyXK4WXawWFeT8wB
02-25 19:56:53.823: D/Http Response:(29778): DseoG0Ec5r5P+NPiTw/J8LvEFl4puhLolvptyGt7lswrH5UpdWRz8ygYCochSTgYHP8AiT4pftB8
02-25 19:56:53.823: D/Http Response:(29778): 88KvpLeK/AORQx3iXw3iKvDXDvDVDAyweEw/C/F1KSwme5dQxMKDnj6NWrO1WrOdaths0pV8JCm6
02-25 19:56:53.823: D/Http Response:(29778): Sml/Yfhh4bZFmdfwzxmfcMSx1GnnGDr55lN68anEGW1cZTlHCylTaqUpYilHk/duLdOUZXbab98/
02-25 19:56:53.823: D/Http Response:(29778): Yz/by8F/tGeB7zVtZvtN0PX9MkSHUrE3amN9yeZHc2ryOjyW0oUMG6q3mRNh0YlPiL+2J4dvdR8V
02-25 19:56:53.823: D/Http Response:(29778): eBvDOuWw1JrSaHRbmyu1eWbUY4rh1SMox2tG0akKGJb5hjgmv5afgTo3iXxt4+8QeG/gzDqclpJq
02-25 19:56:53.823: D/Http Response:(29778): V5KselXU1nb22myXk7RrcXEUiBLdiGaOHkAF0RCqNX6OfC34Q+KfDfxY8IeFvEemTafrM11Hqz3s
02-25 19:56:53.823: D/Http Response:(29778): shntk03T3M+pXhuMAsI4dwIfDSSywxBnLZr/AEYhm3G3FGJ4BxWDzTOckoZTn+VZjmWHweGw0qnE
02-25 19:56:53.823: D/Http Response:(29778): UJXjHh/NZV8PXVKjKdWM6ywUqVapiaFKH1h0HVpT/rPxm+hj4J8KZn4lYifFM8mwWZcJ5tmuW8L1
02-25 19:56:53.823: D/Http Response:(29778): auFw+P4UwTyrE18RmOIq1MXPERw+BjGdVTlTvRoQnL2s3CFU/oB+FH7R3hTxD4A0XWPEmoRWmpE2
02-25 19:56:53.823: D/Http Response:(29778): 2nX3DMsl46v5EyhMkLej50AyolLwjLKM9n8TPiff6N4G1bWPAugah4q1xbKWTSNJtfItpL26KSfZ
02-25 19:56:53.823: D/Http Response:(29778): 4vNv57WKJXcJueWRVQMSzYWvkP4fjwt4D0S00fTZI4UQMQwO+6nCHLn92GdljGOVBCA5LDG4+sWX
02-25 19:56:53.823: D/Http Response:(29778): ivRZoRKbmKWN1DLIkqsGXMgO192DgrhsZ5BU4JGf7SzrgeGJzLM55fjK+Cy7ETcsJQhhISxWFjU5
02-25 19:56:53.823: D/Http Response:(29778): 00qjqyhyqXM6CdJuMbRlKThJv/B/w+8asJlnDfCkOJMgwnEPE2VxoxzzF189q0shzp4apFU08LRw
02-25 19:56:53.823: D/Http Response:(29778): NLGxlWpKMcdUhjoe1nOdaj7FShGPzN+z/wDHr9sKPXfH1/8AtAeArbwpoDXWl2PgiKWbTZZm1C9b
02-25 19:56:53.823: D/Http Response:(29778): UJrszNpOrakG02xs7f5JLowS3F8BbZRJ4nXzj9p39rDx34QlTT/CtlqOpX105UyWlpc3+oXMhcht
02-25 19:56:53.823: D/Http Response:(29778): sdrFNLs82WNI4YI1iEjxQxJkhG90+PnjjRLPwpZLa6nDDfprem3MNvvXfdW6NdW9xhC2fLhFykzu
02-25 19:56:53.823: D/Http Response:(29778): y7R8ibhIVJ8v0f4f2vxW1bwd4l0i2vr6bw74m8L+JLq4sT5dosvh7XtL1ptMu712W3IvW09IpLSa
02-25 19:56:53.823: D/Http Response:(29778): UMY3jmKMsZYebknCtDhyccJi8Tjcwp8/tZ4vMYqVfkqOVlJQdFOmpwlazTSaV5JKJ/onwN4kZHxx
02-25 19:56:53.823: D/Http Response:(29778): wTxL475Z4R8FRx+VrNcowvAvD+JxuX8NVs44fyfKq2CwksVjY5rWoV80oYmnipc6ruvmFdqKvUpq
02-25 19:56:53.823: D/Http Response:(29778): P562n7cHxjttZ/sebTfEC+IkuYoIdFuNM1ax1xbx5GWGCPTri1iv1uHYqsaJH5rMflUknP8ARX8C
02-25 19:56:53.823: D/Http Response:(29778): bv4g658Gfh9q/wAU9MOkeOdR8P295r+mMrC5tJp5ZpLOHUEkAZNTGntaHVIW5i1I3UWcLmvRo/E3
02-25 19:56:53.823: D/Http Response:(29778): hljG1z5du4WPE1zZkIh+cf68xsEVck73ZUCqzFgBmvLfGvxv0fSPtFr4ea3vniBE2rTFn02Ft0ij
02-25 19:56:53.823: D/Http Response:(29778): 7Msbhr1sjCsGWIsyiNpScDjxzq5zKnRwuSrAumuarUdSfJyJSXNKpUhThTp6OTTcm20oyb5k/mvE
02-25 19:56:53.823: D/Http Response:(29778): vxBn4pYfJ8syjwxy/g+pga8sVicdh6zrzxDdKpRVOOIeW5fHCYO7dWeGf1ipVrRotT5qdpepzQbQ
02-25 19:56:53.823: D/Http Response:(29778): 2cADnd2wN+SSewHXOTggHgZPwv4o+P8A8RrLxD4z0e28E2FvBo2vato2mz3bvKbqwsdRmtbPWopE
02-25 19:56:53.823: D/Http Response:(29778): vY45v7Ss0W9SBlKxfaIoZAZIJ0futa1HxjrtlLf6xqE8sDW5ujpaahBb3BtgWYlNJieNH4/1YZmk
02-25 19:56:53.823: D/Http Response:(29778): Y7QrM4IrwDVPEXgo2wuotQSaKVFkjaN8qysWPzbuVbJwQcMCCG2kE1HCdLhrNK2OVDMsqz+pho06
02-25 19:56:53.823: D/Http Response:(29778): dbDYOtLELBznUbp1Kk6NWLcavsqkKcpQ9nL9441JWnE+W4d4WoUJVpZlhqOaznCEIU40MQ6WHnGp
02-25 19:56:53.823: D/Http Response:(29778): GbnGftaSq88YcsoulZJy5ZKLnf274L/Eqbx54Fj1/wAenR/CviD+2vEOmzaXdajY2dy9jputXlpp
02-25 19:56:53.823: D/Http Response:(29778): moTWktzugfULGOC6wuIpFdbiFEilWIFfGF/4s8Gfapf3w7ZO8qTywyQDjoq/hjOTySvcr8E4atiK
02-25 19:56:53.823: D/Http Response:(29778): 9anXrYenVqzqQoQwblCjGc5SjSjJ1ryjBNRi3q1a6blI9DFeH1LE4rE4ijUr4SlXrVKtPC08KnSw
02-25 19:56:53.823: D/Http Response:(29778): 8KlSpKNGm5VW+Smnyxvryxjdton8U+Jbix8d+KJLrdJNFqOoGJWG52dbkqmxG++4gBMYPUHIPy18
02-25 19:56:53.823: D/Http Response:(29778): D/8ABRX4lalb/AHxJ/YiXcc89peeVI8RS4FqtrLvMrICMLnKjuQDgsQK+4fi5PpWpfETxNc6c6Pb
02-25 19:56:53.823: D/Http Response:(29778): vf8AmBoiColUbXKFWYA7kGQScP34avmb9obS9K8bfD3UtCNiJC9nIshlCvlikgYJwdwbAPO0EkZA
02-25 19:56:53.823: D/Http Response:(29778): 3ZP/ADD+HXivwNwHnfiXwLxHhcixs8D4zYriHL+JamWvMsbn0afFeIp1pxxUIT5J0qeFp4uniKlX
02-25 19:56:53.823: D/Http Response:(29778): kSqqcXJ0KtSf+jfg3Ry3LOOvC/ivH5fXrYfASySvjctm408NTjD6tVvUUovmknzRsk20pRu03f8A
02-25 19:56:53.823: D/Http Response:(29778): P7/gnzqS/s2fBnUfjH8Sdd0qw0Hx7JbX1rf+YBeaZYyhbW3EtxIwXeTGbqVAB9mMpTDNE5f7j8Ef
02-25 19:56:53.823: D/Http Response:(29778): tgeA/jR4s8Y6x4Hvhqdl4J0zRdBGuupP2mXWJ7ie6+zzkAzq0dnB58sZ2M5VASRKo/mp+MMvj7wX
02-25 19:56:53.823: D/Http Response:(29778): fX3wyuvE2tyeDLW7ku9I0Ca9uDpcMZlc7IrYttCxMAFTGxAEwCTuP1b+x1e+MPgX44g8KfFfwrr/
02-25 19:56:53.823: D/Http Response:(29778): AIM8O/HbQrRPBup+IdLu9NgvdasLgTaLLbG6jhPlaj9s+ysWAmL3Gn7
02-25 19:56:53.943: W/dalvikvm(29778): threadid=15: thread exiting with uncaught exception (group=0x40d3b2a0)
02-25 19:56:53.978: E/AndroidRuntime(29778): FATAL EXCEPTION: AsyncTask #2
02-25 19:56:53.978: E/AndroidRuntime(29778): java.lang.RuntimeException: An error occured while executing doInBackground()
02-25 19:56:53.978: E/AndroidRuntime(29778):    at android.os.AsyncTask$3.done(AsyncTask.java:299)
02-25 19:56:53.978: E/AndroidRuntime(29778):    at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
02-25 19:56:53.978: E/AndroidRuntime(29778):    at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
02-25 19:56:53.978: E/AndroidRuntime(29778):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
02-25 19:56:53.978: E/AndroidRuntime(29778):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
02-25 19:56:53.978: E/AndroidRuntime(29778):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
02-25 19:56:53.978: E/AndroidRuntime(29778):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
02-25 19:56:53.978: E/AndroidRuntime(29778):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
02-25 19:56:53.978: E/AndroidRuntime(29778):    at java.lang.Thread.run(Thread.java:856)
02-25 19:56:53.978: E/AndroidRuntime(29778): Caused by: java.lang.IllegalArgumentException: Illegal character in query at index 204: http://ictfox.com/Hafil_Updates/SchoolLocation_Insert.aspx?schoolId=212&Location_Longitude=0&Location_Latitude=0&Location_Image=/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
02-25 19:56:53.978: E/AndroidRuntime(29778): AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEB
02-25 19:56:53.978: E/AndroidRuntime(29778): AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCABLAGQDASIA
02-25 19:56:53.978: E/AndroidRuntime(29778): AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA
02-25 19:56:53.978: E/AndroidRuntime(29778): AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3
02-25 19:56:53.978: E/AndroidRuntime(29778): ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm
02-25 19:56:53.978: E/AndroidRuntime(29778): p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA
02-25 19:56:53.978: E/AndroidRuntime(29778): AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx
02-25 19:56:53.978: E/AndroidRuntime(29778): BhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK
02-25 19:56:53.978: E/AndroidRuntime(29778): U1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3
02-25 19:56:53.978: E/AndroidRuntime(29778): uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD+zn4p
02-25 19:56:53.978: E/AndroidRuntime(29778): fEy+8A3WlRw2Bnt7u7SGeYFlEUZL/MAoYux2n5SME7gGDdfLf2rf2mdQ+A/wF1f4neG9Ih17VLG1
02-25 19:56:53.978: E/AndroidRuntime(29778): tJ4rCSSRYzC86rczyGCOSQi1hEkuxF3yMojVlJzTfjv4z0jVdYh0CEo/9mOJLyXK4WXawWFeT8wB
02-25 19:56:53.978: E/AndroidRuntime(29778): DseoG0Ec5r5P+NPiTw/J8LvEFl4puhLolvptyGt7lswrH5UpdWRz8ygYCochSTgYHP8AiT4pftB8
02-25 19:56:53.978: E/AndroidRuntime(29778): 88KvpLeK/AORQx3iXw3iKvDXDvDVDAyweEw/C/F1KSwme5dQxMKDnj6NWrO1WrOdaths0pV8JCm6
02-25 19:56:53.978: E/AndroidRuntime(29778): Sml/Yfhh4bZFmdfwzxmfcMSx1GnnGDr55lN68anEGW1cZTlHCylTaqUpYilHk/duLdOUZXbab98/
02-25 19:56:53.978: E/AndroidRuntime(29778): Yz/by8F/tGeB7zVtZvtN0PX9MkSHUrE3amN9yeZHc2ryOjyW0oUMG6q3mRNh0YlPiL+2J4dvdR8V
02-25 19:56:53.978: E/AndroidRuntime(29778): eBvDOuWw1JrSaHRbmyu1eWbUY4rh1SMox2tG0akKGJb5hjgmv5afgTo3iXxt4+8QeG/gzDqclpJq
02-25 19:56:53.978: E/AndroidRuntime(29778): V5KselXU1nb22myXk7RrcXEUiBLdiGaOHkAF0RCqNX6OfC34Q+KfDfxY8IeFvEemTafrM11Hqz3s
02-25 19:56:53.978: E/AndroidRuntime(29778): shntk03T3M+pXhuMAsI4dwIfDSSywxBnLZr/AEYhm3G3FGJ4BxWDzTOckoZTn+VZjmWHweGw0qnE
02-25 19:56:53.978: E/AndroidRuntime(29778): UJXjHh/NZV8PXVKjKdWM6ywUqVapiaFKH1h0HVpT/rPxm+hj4J8KZn4lYifFM8mwWZcJ5tmuW8L1
02-25 19:56:53.978: E/AndroidRuntime(29778): auFw+P4UwTyrE18RmOIq1MXPERw+BjGdVTlTvRoQnL2s3CFU/oB+FH7R3hTxD4A0XWPEmoRWmpE2
02-25 19:56:53.978: E/AndroidRuntime(29778): 2nX3DMsl46v5EyhMkLej50AyolLwjLKM9n8TPiff6N4G1bWPAugah4q1xbKWTSNJtfItpL26KSfZ
02-25 19:56:53.978: E/AndroidRuntime(29778): 4vNv57WKJXcJueWRVQMSzYWvkP4fjwt4D0S00fTZI4UQMQwO+6nCHLn92GdljGOVBCA5LDG4+sWX
02-25 19:56:53.978: E/AndroidRuntime(29778): ivRZoRKbmKWN1DLIkqsGXMgO192DgrhsZ5BU4JGf7SzrgeGJzLM55fjK+Cy7ETcsJQhhISxWFjU5
02-25 19:56:53.978: E/AndroidRuntime(29778): 00qjqyhyqXM6CdJuMbRlKThJv/B/w+8asJlnDfCkOJMgwnEPE2VxoxzzF189q0shzp4apFU08LRw
02-25 19:56:53.978: E/AndroidRuntime(29778): NLGxlWpKMcdUhjoe1nOdaj7FShGPzN+z/wDHr9sKPXfH1/8AtAeArbwpoDXWl2PgiKWbTZZm1C9b
02-25 19:56:53.978: E/AndroidRuntime(29778): UJrszNpOrakG02xs7f5JLowS3F8BbZRJ4nXzj9p39rDx34QlTT/CtlqOpX105UyWlpc3+oXMhcht
02-25 19:56:53.978: E/AndroidRuntime(29778): sdrFNLs82WNI4YI1iEjxQxJkhG90+PnjjRLPwpZLa6nDDfprem3MNvvXfdW6NdW9xhC2fLhFykzu
02-25 19:56:53.978: E/AndroidRuntime(29778): y7R8ibhIVJ8v0f4f2vxW1bwd4l0i2vr6bw74m8L+JLq4sT5dosvh7XtL1ptMu712W3IvW09IpLSa
02-25 19:56:53.978: E/AndroidRuntime(29778): UMY3jmKMsZYebknCtDhyccJi8Tjcwp8/tZ4vMYqVfkqOVlJQdFOmpwlazTSaV5JKJ/onwN4kZHxx
02-25 19:56:53.978: E/AndroidRuntime(29778): wTxL475Z4R8FRx+VrNcowvAvD+JxuX8NVs44fyfKq2CwksVjY5rWoV80oYmnipc6ruvmFdqKvUpq
02-25 19:56:53.978: E/AndroidRuntime(29778): P562n7cHxjttZ/sebTfEC+IkuYoIdFuNM1ax1xbx5GWGCPTri1iv1uHYqsaJH5rMflUknP8ARX8C
02-25 19:56:53.978: E/AndroidRuntime(29778): bv4g658Gfh9q/wAU9MOkeOdR8P295r+mMrC5tJp5ZpLOHUEkAZNTGntaHVIW5i1I3UWcLmvRo/E3
02-25 19:56:53.978: E/AndroidRuntime(29778): hljG1z5du4WPE1zZkIh+cf68xsEVck73ZUCqzFgBmvLfGvxv0fSPtFr4ea3vniBE2rTFn02Ft0ij
02-25 19:56:53.978: E/AndroidRuntime(29778): 7Msbhr1sjCsGWIsyiNpScDjxzq5zKnRwuSrAumuarUdSfJyJSXNKpUhThTp6OTTcm20oyb5k/mvE
02-25 19:56:53.978: E/AndroidRuntime(29778): vxBn4pYfJ8syjwxy/g+pga8sVicdh6zrzxDdKpRVOOIeW5fHCYO7dWeGf1ipVrRotT5qdpepzQbQ
02-25 19:56:53.978: E/AndroidRuntime(29778): 2cADnd2wN+SSewHXOTggHgZPwv4o+P8A8RrLxD4z0e28E2FvBo2vato2mz3bvKbqwsdRmtbPWopE
02-25 19:56:53.978: E/AndroidRuntime(29778): vY45v7Ss0W9SBlKxfaIoZAZIJ0futa1HxjrtlLf6xqE8sDW5ujpaahBb3BtgWYlNJieNH4/1YZmk
02-25 19:56:53.978: E/AndroidRuntime(29778): Y7QrM4IrwDVPEXgo2wuotQSaKVFkjaN8qysWPzbuVbJwQcMCCG2kE1HCdLhrNK2OVDMsqz+pho06
02-25 19:56:53.978: E/AndroidRuntime(29778): dbDYOtLELBznUbp1Kk6NWLcavsqkKcpQ9nL9441JWnE+W
02-25 19:56:54.098: D/dalvikvm(29778): GC_CONCURRENT freed 927K, 20% free 32826K/40903K, paused 26ms+5ms, total 103ms
02-25 19:57:03.463: I/Choreographer(29778): Skipped 523 frames!  The application may be doing too much work on its main thread.
02-25 19:57:03.808: E/WindowManager(29778): Activity com.ictfox.hafil_tc.LocationsActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@420e78e0 that was originally added here
02-25 19:57:03.808: E/WindowManager(29778): android.view.WindowLeaked: Activity com.ictfox.hafil_tc.LocationsActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@420e78e0 that was originally added here
02-25 19:57:03.808: E/WindowManager(29778):     at android.view.ViewRootImpl.<init>(ViewRootImpl.java:409)
02-25 19:57:03.808: E/WindowManager(29778):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:312)
02-25 19:57:03.808: E/WindowManager(29778):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:224)
02-25 19:57:03.808: E/WindowManager(29778):     at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:149)
02-25 19:57:03.808: E/WindowManager(29778):     at android.view.Window$LocalWindowManager.addView(Window.java:559)
02-25 19:57:03.808: E/WindowManager(29778):     at android.app.Dialog.show(Dialog.java:277)
02-25 19:57:03.808: E/WindowManager(29778):     at com.ictfox.hafil_tc.LocationsActivity$2.onClick(LocationsActivity.java:124)
02-25 19:57:03.808: E/WindowManager(29778):     at android.view.View.performClick(View.java:4261)
02-25 19:57:03.808: E/WindowManager(29778):     at android.view.View$PerformClick.run(View.java:17330)
02-25 19:57:03.808: E/WindowManager(29778):     at android.os.Handler.handleCallback(Handler.java:615)
02-25 19:57:03.808: E/WindowManager(29778):     at android.os.Handler.dispatchMessage(Handler.java:92)
02-25 19:57:03.808: E/WindowManager(29778):     at android.os.Looper.loop(Looper.java:137)
02-25 19:57:03.808: E/WindowManager(29778):     at android.app.ActivityThread.main(ActivityThread.java:4921)
02-25 19:57:03.808: E/WindowManager(29778):     at java.lang.reflect.Method.invokeNative(Native Method)
02-25 19:57:03.808: E/WindowManager(29778):     at java.lang.reflect.Method.invoke(Method.java:511)
02-25 19:57:03.808: E/WindowManager(29778):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
02-25 19:57:03.808: E/WindowManager(29778):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
02-25 19:57:03.808: E/WindowManager(29778):     at dalvik.system.NativeStart.main(Native Method)
02-25 19:57:03.973: E/SpannableStringBuilder(29778): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
02-25 19:57:03.973: E/SpannableStringBuilder(29778): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
02-25 19:57:03.973: E/SpannableStringBuilder(29778): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
02-25 19:57:03.973: E/SpannableStringBuilder(29778): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

2 个答案:

答案 0 :(得分:2)

您的查询参数中包含“/”字符。尝试使用URLEncoder.encode将它们编码为“%2F”(不带引号)。

HttpPost httpPost = new HttpPost("http://ictfox.com/Hafil_Updates/SchoolLocation_Insert.aspx?schoolId="+((MyApplication) mActivity.getApplication()).schoolNum+"&Location_Longitude="+this.txtLag+"&Location_Latitude="+this.txtLat+"&Location_Image="+URLEncoder.encode(imageString)+"&Action_Date="+date2);

这应该产生: http://ictfox.com/Hafil_Updates/SchoolLocation_Insert.aspx?schoolId=212&Location_Longitude=0&Location_Latitude=0&Location_Image=%2F9j%2F4AAQSkZJRgABAQAAAQABAAD%2F2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB

[编辑] 如果图片太大,您需要在请求正文中提交:

String url = "http://ictfox.com/Hafil_Updates/SchoolLocation_Insert.aspx";

HttpClient client = HttpClientBuilder.create().build();
HttpPost post = new HttpPost(url);

List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
urlParameters.add(new BasicNameValuePair("schoolId", ((MyApplication) mActivity.getApplication()).schoolNum));
urlParameters.add(new BasicNameValuePair("Location_Longitude", this.txtLag));
urlParameters.add(new BasicNameValuePair("Location_Latitude", this.txtLat));
urlParameters.add(new BasicNameValuePair("Location_Image", imageString));
urlParameters.add(new BasicNameValuePair("Location_Longitude", date2));

post.setEntity(new UrlEncodedFormEntity(urlParameters));

HttpResponse response = client.execute(post);

答案 1 :(得分:2)

Base64编码使用URL查询参数值('/'和'+')中不允许的一些字符。为避免这种情况,请将Base64.URL_SAFE作为第二个参数传递给Base64.encodeToString(),而不是Base64.DEFAULT