Dear Friends:
    url = 
"http://localhost:8080/geoserver/rest/workspaces/ChinaMap/datastores/newPoint/file.shp?charset=GB2312&target=shp&configure=all";;
    filePath = "E:\newLayerFile/newPoint.zip";
    curl_easy_setopt(_curl_handle, CURLOPT_USERPWD, userPassword.c_str());
    curl_easy_setopt(_curl_handle, CURLOPT_URL, url.c_str());
    struct  stat fileInfo;
    stat(filePath.c_str(), &fileInfo);
    FILE* hd_src = fopen(filePath.c_str(), "rb");
    if(hd_src)
    {
        curl_easy_setopt(_curl_handle, CURLOPT_PUT, 1);
        curl_easy_setopt(_curl_handle, CURLOPT_UPLOAD, 1);
        curl_easy_setopt(_curl_handle, CURLOPT_HEADER, 1);
        headers = curl_slist_append(NULL, "Conten-Type: application/zip");
        curl_easy_setopt(_curl_handle, CURLOPT_INFILE, hd_src);
        curl_easy_setopt(_curl_handle, CURLOPT_INFILESIZE, 
(curl_off_t)fileInfo.st_size);
    }
    curl_easy_setopt(_curl_handle, CURLOPT_HTTPHEADER, headers);
    curl_easy_setopt(_curl_handle, CURLOPT_VERBOSE, 1);
    curl_easy_perform(_curl_handle);

    Using the upper function, I can create new store successfully in 
geoserver2.3.x  and geoserver2.4.x. In geoserver2.3.x the new store's features 
can be locked, but in geoserver2.4.x the new store's features can not be 
locked. So I think whether creating a new store has some problem, or in 
geoserver2.4.x has some difference from geoserver2.3.x.
------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to