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

com.kaltura.client.utils.request.ServeRequestBuilder Maven / Gradle / Ivy

Go to download

KalturaClient is a library of Java classes that can be used to interact with the Kaltura REST API. More information about the REST API can be found at http://corp.kaltura.com/Products/Kaltura-API Many of the Java classes in this library are auto-generated from a schema that defines the objects that are used to interect with the API. The current schema can be found at http://www.kaltura.com/api_v3/api_schema.php

There is a newer version: 19.3.0
Show newest version
package com.kaltura.client.utils.request;

import com.kaltura.client.Client;
import com.kaltura.client.Params;
import com.kaltura.client.types.APIException;
import com.kaltura.client.utils.APIConstants;

public abstract class ServeRequestBuilder extends RequestBuilder {

    public ServeRequestBuilder(String service, String action) {
        super(String.class, service, action);
    }

	@Override
    public String getMethod() {
    	return "GET";
    }

    @Override
    public String getBody() {
        return null;
    }

	@Override
    public RequestElement build(final Client client, boolean addSignature) {
		Params kParams = prepareParams(client, true);
		prepareHeaders(client.getConnectionConfiguration());
		String endPoint = client.getConnectionConfiguration().getEndpoint().replaceAll("/$", "");
        StringBuilder urlBuilder = new StringBuilder(endPoint)
        .append("/")
        .append(APIConstants.UrlApiVersion)
        .append("/service/")
        .append(service)
        .append("/action/")
        .append(action)
        .append("?")
        .append(kParams.toQueryString());
        
        url = urlBuilder.toString();
		
		return this;
    }
	
	@Override
    protected Object parse(String response) throws APIException {
    	return response;
    }

	@Override
	public String getTokenizer() throws APIException {
		throw new APIException(APIException.FailureStep.OnRequest, "Served content response can not be used as multi-request token");
	}
	
	@Override
    public MultiRequestBuilder add(RequestBuilder another) throws APIException {
    	throw new APIException("Multi-request is not supported on serve actions"); 
    }
}


















© 2015 - 2024 Weber Informatics LLC | Privacy Policy