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

org.wiztools.oembed.OEmbedAbstractExecutor Maven / Gradle / Ivy

The newest version!
package org.wiztools.oembed;

/**
 * Defines the common methods used in all org.wiztools.oembed.OEmbedExecutor implementations.
 * @author subhash
 */
public abstract class OEmbedAbstractExecutor implements OEmbedExecutor {
    /**
     * 
     * @param contentType The content-type value extracted from the HTTP header.
     * @return The oEmbed parser implementation which corresponds to the content type.
     */
    protected OEmbedParser getParser(final String contentType) {
        if(contentType.startsWith("text/xml")) {
            return new OEmbedXmlParser();
        }
        else if(contentType.startsWith("application/json")) {
            return new OEmbedJsonParser();
        }
        else {
            throw new UnsupportedOperationException("Unsupported content-type in response: " + contentType);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy