0

I got this error from my program when i am call a URL from URLConnector.. the URL is

http://192.168.2.107/cgi-bin/mediaFileFind.cgi?action=findFile&object=27544704&condition.Channel=0&conditon.Dir[0]="/mnt/sd"&condition.StartTime=2014-8-1 00:00:00&condition.EndTime=2014-8-31 23:59:59

but when i capture HTTP using wire-shark then wire-shark the URl is loss wire-shark capture only

  http://192.168.2.107/cgi-bin/mediaFileFind.cgi?action=findFile&object=27544704&condition.Channel=0&conditon.Dir[0]="/mnt/sd"&condition.StartTime=2014-8-1 00:00:00

only this URL

my Java program is

public String intilizeObject(String IP, String user, String pass, String objectID, String dir, String startTime, String endTime) {
        String result = "";
        try {
            String URL = "http://" + IP + "/cgi-bin/mediaFileFind.cgi?action=findFile&object=" + objectID + "&condition.Channel=0&conditon.Dir[0]=\"" + dir + "\"&condition.StartTime=" + startTime + "&condition.EndTime=" + endTime;           
            String authString = user + ":" + pass;
            byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
            String authStringEnc = new String(authEncBytes);
            URL url = new URL(URL);
            System.out.println(url);
            URLConnection urlConnection = url.openConnection();
            urlConnection.setRequestProperty("Authorization", "Basic " + authStringEnc);

            InputStream is = urlConnection.getInputStream();
            InputStreamReader isr = new InputStreamReader(is);

            int numCharsRead;
            char[] charArray = new char[1024];
            StringBuffer sb = new StringBuffer();
            while ((numCharsRead = isr.read(charArray)) > 0) {
                sb.append(charArray, 0, numCharsRead);
            }
            result = sb.toString();

        } catch (Exception e) {
            result = e.toString();
        }
        return result;
    }
2
  • @user3218114 The OP isn't passing anything with this GET request. What are you talking about? Commented Aug 2, 2014 at 9:35
  • I found some thing at this link, try check this [java.net.SocketException: Unexpected end of file from server][1] [1]: stackoverflow.com/questions/22147457/… Commented Oct 29, 2014 at 9:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.