@ Override public void register ( Builder . Registry registry ) { registry . add ( new AzureAdTokenFactory ( ) ) ; registry . add ( MediaContract . class , MediaExceptionProcessor . class ) ; registry . add ( MediaRestProxy . class ) ; registry . add ( OAuthFilter . class ) ; registry . add ( ResourceLocationManager . class ) ; registry . add ( RedirectFilter . class ) ; registry . add ( VersionHeadersFilter . class ) ; registry . add ( UserAgentFilter . class ) ; registry . alter ( MediaContract . class , ClientConfig . class , new Builder . Alteration < ClientConfig > ( ) { @ SuppressWarnings ( "rawtypes" ) @ Override public ClientConfig alter ( String profile , ClientConfig instance , Builder builder , Map < String , Object > properties ) { instance . getProperties ( ) . put ( JSONConfiguration . FEATURE_POJO_MAPPING , true ) ; // Turn off auto-follow redirects, because Media // Services rest calls break if it's on instance . getProperties ( ) . put ( ClientConfig . PROPERTY_FOLLOW_REDIRECTS , false ) ; try { instance . getSingletons ( ) . add ( new ODataEntityProvider ( ) ) ; instance . getSingletons ( ) . add ( new ODataEntityCollectionProvider ( ) ) ; instance . getSingletons ( ) . add ( new MediaContentProvider ( ) ) ; instance . getSingletons ( ) . add ( new BatchMimeMultipartBodyWritter ( ) ) ; } catch ( JAXBException e ) { throw new RuntimeException ( e ) ; } catch ( ParserConfigurationException e ) { throw new RuntimeException ( e ) ; } return instance ; } } ) ; }
register the Media services .