Class RequestUtils


  • @Service
    public class RequestUtils
    extends java.lang.Object
    Since:
    : 15.02.21
    • Constructor Summary

      Constructors 
      Constructor Description
      RequestUtils()  
      RequestUtils​(org.springframework.web.client.RestTemplate restTemplate)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<SongData> getSongsFromArtist​(java.lang.String artist, java.lang.String jwt)
      Get all the songs made from the given artist.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RequestUtils

        public RequestUtils​(org.springframework.web.client.RestTemplate restTemplate)
      • RequestUtils

        public RequestUtils()
    • Method Detail

      • getSongsFromArtist

        public java.util.List<SongData> getSongsFromArtist​(java.lang.String artist,
                                                           java.lang.String jwt)
                                                    throws java.net.UnknownHostException,
                                                           org.springframework.web.client.HttpClientErrorException,
                                                           java.util.NoSuchElementException
        Get all the songs made from the given artist. This will make a request to song service.
        Parameters:
        artist - Artist to be searched
        jwt - Jwt token to be used in authorization header
        Returns:
        Songs made from given artist, will throw exception if none found
        Throws:
        java.net.UnknownHostException - if host not resolved
        org.springframework.web.client.HttpClientErrorException - if reply has no body
        java.util.NoSuchElementException - if no song for artist found