All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.geosolutions.geoserver.rest.GeoWebCacheRESTPublisher Maven / Gradle / Ivy

package it.geosolutions.geoserver.rest;

import it.geosolutions.geoserver.rest.gwc.GWCSeedTask;
import it.geosolutions.geoserver.rest.manager.GeoServerRESTAbstractManager;
import lombok.extern.slf4j.Slf4j;

import java.net.URL;

/**
 * @author Arjen10
 */
@Slf4j
public class GeoWebCacheRESTPublisher extends GeoServerRESTAbstractManager {

    public GeoWebCacheRESTPublisher(URL restURL, String username, String password) {
        super(restURL, username, password);
    }

    /**
     *
     * 
     *     send task to GeoWebCache
     *
     * @param workspace workSpace
     * @param layerName layerName
     * @return whether the task has been accepted
     * @since 1.8.0
     */
    public boolean gwcSendTask(String workspace, String layerName) {
        GWCSeedTask gwcSeedTask = new GWCSeedTask(workspace, layerName);
        return gwcSendTask(gwcSeedTask);
    }

    /**
     *
     * 
     *     send task to GeoWebCache
     *
     * @param gwcSeedTask send task param
     * @return whether the task has been accepted
     * @since 1.8.0
     */
    public boolean gwcSendTask(GWCSeedTask gwcSeedTask) {
        String jsonString = JacksonUtil.toJSONString(gwcSeedTask);
        String url = gsBaseUrl + "/gwc/rest/seed/" + Util.encodeUrl(gwcSeedTask.getSeedRequest().getName()) + ".json";
        HTTPUtils.post(url, jsonString, "application/json", gsuser, gspass);
        return true;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy