示例#1
0
        @Override public HttpResponse getResponse()
        {
            // TODO: The doc seems to say that, for example, for a 404 error the connect call will throw a FileNotFoundException, and the caller can use getErrorStream to read the bod.  Test that & change to catch such exceptions here, so caller gets a valid response object
            // Scribe called getErrorStream when response code not in: return getCode() >= 200 && getCode() < 400;

            try {
                httpUrlConnection.connect();
                return(new HttpResponse(httpUrlConnection));
            } catch (java.io.IOException e) {
                throw JavaIOUtils.jSimpleExceptionFromDotNetIOException(e);
            }
        }
示例#2
0
        @Override public OutputStream getRequestBodyStream()
        {
            if (bodyStream == null)
            {
                try {
                    httpUrlConnection.setDoOutput(true);
                    bodyStream = new JSimpleOutputStreamOnJavaStream(httpUrlConnection.getOutputStream());
                } catch (java.io.IOException e) {
                    throw JavaIOUtils.jSimpleExceptionFromDotNetIOException(e);
                }
            }

            return(bodyStream);
        }