protected HttpGDataRequest(RequestType type,URL requestUrl,ContentType inputType,HttpAuthToken authToken,Map<String,String> headerMap,Map<String,String> privateHeaderMap,HttpUrlConnectionSource connectionSource) throws IOException {
  this.connectionSource=connectionSource;
  this.type=type;
  this.inputType=inputType;
  this.requestUrl=requestUrl;
  this.httpConn=getRequestConnection(requestUrl);
  this.authToken=authToken;
switch (type) {
case QUERY:
    hasOutput=true;
  break;
case INSERT:
case BATCH:
expectsInput=true;
hasOutput=true;
setMethod("POST");
setHeader("Content-Type",inputType.toString());
break;
case UPDATE:
expectsInput=true;
hasOutput=true;
if (Boolean.getBoolean(METHOD_OVERRIDE_PROPERTY)) {
setMethod("POST");
setHeader(Header.METHOD_OVERRIDE,"PUT");
}
 else {
setMethod("PUT");
}
setHeader("Content-Type",inputType.toString());
break;
case PATCH:
expectsInput=true;
hasOutput=true;
setMethod("POST");
setHeader(Header.METHOD_OVERRIDE,"PATCH");
setHeader("Content-Type",inputType.toString());
break;
case DELETE:
if (Boolean.getBoolean(METHOD_OVERRIDE_PROPERTY)) {
setMethod("POST");
setHeader(Header.METHOD_OVERRIDE,"DELETE");
}
 else {
setMethod("DELETE");
}
setHeader("Content-Length","0");
break;
default :
throw new UnsupportedOperationException("Unknown request type:" + type);
}
if (authToken != null) {
String authHeader=authToken.getAuthorizationHeader(requestUrl,httpConn.getRequestMethod());
setPrivateHeader("Authorization",authHeader);
}
if (headerMap != null) {
for (Map.Entry<String,String> e : headerMap.entrySet()) {
setHeader(e.getKey(),e.getValue());
}
}
if (privateHeaderMap != null) {
for (Map.Entry<String,String> e : privateHeaderMap.entrySet()) {
setPrivateHeader(e.getKey(),e.getValue());
}
}
setHeader("Accept-Encoding","gzip");
httpConn.setDoOutput(expectsInput);
}

protected HttpGDataRequest ( RequestType type , URL requestUrl , ContentType inputType , HttpAuthToken authToken , Map < String , String > headerMap , Map < String , String > privateHeaderMap , HttpUrlConnectionSource connectionSource ) throws IOException { this . connectionSource = connectionSource ; this . type = type ; this . inputType = inputType ; this . requestUrl = requestUrl ; this . httpConn = getRequestConnection ( requestUrl ) ; this . authToken = authToken ; switch ( type ) { case QUERY : hasOutput = true ; break ; case INSERT : case BATCH : expectsInput = true ; hasOutput = true ; setMethod ( "POST" ) ; setHeader ( "Content-Type" , inputType . toString ( ) ) ; break ; case UPDATE : expectsInput = true ; hasOutput = true ; if ( Boolean . getBoolean ( METHOD_OVERRIDE_PROPERTY ) ) { setMethod ( "POST" ) ; setHeader ( Header . METHOD_OVERRIDE , "PUT" ) ; } else { setMethod ( "PUT" ) ; } setHeader ( "Content-Type" , inputType . toString ( ) ) ; break ; case PATCH : expectsInput = true ; hasOutput = true ; setMethod ( "POST" ) ; setHeader ( Header . METHOD_OVERRIDE , "PATCH" ) ; setHeader ( "Content-Type" , inputType . toString ( ) ) ; break ; case DELETE : if ( Boolean . getBoolean ( METHOD_OVERRIDE_PROPERTY ) ) { setMethod ( "POST" ) ; setHeader ( Header . METHOD_OVERRIDE , "DELETE" ) ; } else { setMethod ( "DELETE" ) ; } setHeader ( "Content-Length" , "0" ) ; break ; default : throw new UnsupportedOperationException ( "Unknown request type:" + type ) ; } if ( authToken != null ) { String authHeader = authToken . getAuthorizationHeader ( requestUrl , httpConn . getRequestMethod ( ) ) ; setPrivateHeader ( "Authorization" , authHeader ) ; } if ( headerMap != null ) { for ( Map . Entry < String , String > e : headerMap . entrySet ( ) ) { setHeader ( e . getKey ( ) , e . getValue ( ) ) ; } } if ( privateHeaderMap != null ) { for ( Map . Entry < String , String > e : privateHeaderMap . entrySet ( ) ) { setPrivateHeader ( e . getKey ( ) , e . getValue ( ) ) ; } } setHeader ( "Accept-Encoding" , "gzip" ) ; httpConn . setDoOutput ( expectsInput ) ; }
constructs a new httpgdatarequest instance of the specified requesttype , targeting the specified url .
