title: Grails/Groovy URL .getText receive status
body: <p>I'm including some wordpress contents to my grails app with a customTag
  everything works fine.Now i want to render some standard-text if the url's status-code is not 200 OK</p>
  
  <p>i have this so  far </p>
  
  <pre><code>def wordpressHp = { body -&gt;
  //  def url = grailsApplication.config.wordpress.server.url+'?include=true'
      def url = "http://www.dasdasdasgsdniga.nd"
      def content 
      try{
          content = url.toURL().getText(connectTimeout: 10000)
      }catch(e){
          content="SORRY WORDPRESS IS CURRENTLY NOT AVAILABLE"
      }
      out &lt;&lt; content
  }
  </code></pre>
  
  <p>The correct url is commented out, i now expect the try to fail.<br>
  But instead of faling it's rendering some dns-error page of my provider.
  So i think i have to look for http-status code, but how do i do that ?</p>
  
  <p>for any hint, thanks in advance</p>