title: Duration in traffic google api
body: <p>I am trying to find the travel duration from origin to destination using google's direction services api. I need to find out travel duration according to traffic conditions. I tried using javascript and it returns the duration in traffic value. But when i tried the same problem in java it doesn't seem to return the duration in traffic value. So how to obtain duration in traffic using direction services api of google?</p>
  
  <p>URL <code>url = new URL ("http://maps.googleapis.com/maps/api/directions/json?origin=" + URLEncoder.encode(origin, "UTF-8") +"&amp;destination="+ URLEncoder.encode(destination, "UTF-8")  +"&amp;waypoints=optimize:true|Bagbazar,Kathmandu|Thapathali,Kathmandu|Kamal+Pokhari,Kathmandu"+"&amp;sensor=false");</code></p>
  
  <p>Above I have pasted the url I used to send to google server.
  Below is the java script code, in the following code I can set durationInTraffic: true, which returns the time required to travel under traffic conditions. What is the equivalent process in java?</p>
  
  <pre><code> var request = {
  
        origin:"Wollongong, Australia",
        destination:"Sydney,Australia",
        travelMode: google.maps.DirectionsTravelMode.DRIVING,
        provideRouteAlternatives: true,
        durationInTraffic: true
      };
  </code></pre>