English 中文(简体)
如何建立协会。 网上网页从Juan Anders客户读取。
原标题:How to have ASP.Net Webpage read bytes from Java Android client?

I m试图通过电话将图像上载到外部MSQ数据库。 Im利用Java HttpClient向网络服务器或网页发送各种 by。 我不知道我应如何这样做。 网页应当放在ASP.net。 我对伙伴关系说得很新。 净额。 我进行了密集研究,研究如何利用伙伴关系在一阵列读。 净额仍然没有答案。 我希望我的网页或服务器能够读到斜线上,并将其储存在数据库中。

下面是我的 Java职能(由于我没有办法读书,所以这一职能尚未经过测试),我想用它来寄信。 但是,我不知道如何在网站上读到这些文件。 任何建议都会受到赞赏。 如果你认为我做错的话,如果让我知道并告诉我我我,我应该怎样做。 请具体说明,因为我确实是新鲜的,对网页没有真正了解。 感谢。

    private void sendImagesToServer() throws Exception
{
    ImageItem image;
    HttpURLConnection conn = null;
    ImageIterator iterator;
    DataOutputStream dos;
    byte[] byteArray;
    iterator = new ImageIterator(imageAdapter);
    String uploadUrl;

    while(iterator.hasNext())
    {
        image = iterator.getNext();
        Uri uri = Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, Integer.toString(image.id));

        Bitmap bmp=BitmapFactory.decodeStream(getContentResolver().openInputStream(uri));
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        bmp.compress(Bitmap.CompressFormat.JPEG, 100, stream);
        byteArray = stream.toByteArray();

        uploadUrl = "http://localhost:63776/SQLScript.aspx";

        // Send request
        try {
            // Configure connection

            URL url = new URL(uploadUrl);
            conn = (HttpURLConnection) url.openConnection();
            conn.setDoInput(true);
            conn.setDoOutput(true);
            conn.setUseCaches(false);
            conn.setRequestMethod("PUT");
            conn.setRequestProperty("Connection", "Keep-Alive");

            dos = new DataOutputStream(conn.getOutputStream());
            dos.write(byteArray, 0, byteArray.length);
            dos.flush();
            dos.close();

            // Read response
            try {
                if (conn.getResponseCode() == 200) {
                    Toast.makeText(this,"Yay, We Got 200 as Response Code",Toast.LENGTH_SHORT).show();
                }
            } catch (IOException ioex) {
                ioex.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            }

        } finally{

        }   

    }

}   
问题回答

If you ve verified the bytes are getting out of the Java fine, check this question, it may have what you need.

阅读Http Request into Byte/63/4/a。

在将档案输入数据库方面,你可以节省双元数据库中的档案(不同的MSQL编组),或在必要时将档案转换成护栏。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签