⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Simple oembed implementation for Java based on Apache HttpClient

License

Notifications You must be signed in to change notification settings

karendolan/java-oembed

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

162 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple oembed implementation for Java based on Apache HttpClient

This is a very simple Java client for consuming Oembed enabled sites.

It uses Jackson for JSON processing and JAXB for XML parsing.

The project is a ready to use configured maven/eclipse project.

java-oembed can be configured to use an ehcache CacheManager instance.

Usage

Dependency:

java-oembed is available in the Central Repository (since 0.2.10):


<dependency>
    <groupId>eu.michael-simons</groupId>
    <artifactId>java-oembed</artifactId>
    <version>0.2.10</version>
</dependency>

In a Spring 3.x application

The the httpClient reference must an instance of org.apache.http.client.HttpClient, the memcachedClient property is optional and is an instance of net.rubyeye.xmemcached.MemcachedClient.


<bean name="oembed" class="ac.simons.oembed.Oembed">
  <constructor-arg name="httpClient" ref="httpClient" />
  <property name="cacheManager" ref="cacheManager" />
  <property name="provider">
    <map>
      <entry key="youtube">
        <bean class="ac.simons.oembed.DefaultOembedProvider">
          <property name="name" value="youtube" />
          <property name="format" value="json" />
          <property name="maxWidth" value="480" />
          <property name="endpoint" value="http://www.youtube.com/oembed" />						
          <property name="urlSchemes">
            <list><value>http://(www|de)\.youtube\.com/watch\?v=.*</value></list>
          </property>						 
        </bean>
      </entry>
      <entry key="flickr">
        <bean class="ac.simons.oembed.DefaultOembedProvider">
          <property name="name" value="flickr" />
          <property name="format" value="json" />
          <property name="endpoint" value="http://www.flickr.com/services/oembed" />
          <property name="urlSchemes">
            <list><value>http://www\.flickr\.(com|de)/photos/.*</value></list>
          </property>						
        </bean>
      </entry>
    </map>
  </property>
</bean>

About

Simple oembed implementation for Java based on Apache HttpClient

Resources

License

Stars

Watchers

Forks

Packages

No packages published