Active Resource Spy
I'm doing a lot of work lately using ActiveResource. I wanted to get 'down to the wire' and see the traffic flowing over http... so a quick google search, and I found an entry I had written in 2008. I love it when that happens! So I'm reblogging it with a slight change to make it work in Ruby 1.9.
If you're using rails, create an initializer name active_resource_spy.rb and drop in this content:
# Creates new Net::HTTP instance for communication with
# remote service and resources.
http = Net::HTTP.new(@site.host, @site.port)
http.use_ssl = @site.is_a?(URI::HTTPS)
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if http.use_ssl?
http.read_timeout = @timeout if @timeout
#Here's the addition that allows you to see the output
All the data that flows over the http connection will be dumped to $stderr (the terminal you started the app in, unless you redirected it).
About David Bock
David Bock is a Principal Consultant at CodeSherpas, a company he founded in 2007. Mr. Bock is also the President of the Northern Virginia Java Users Group, the Editor of O'Reilly's OnJava.com website, and a frequent speaker on technology in venues such as the No Fluff Just Stuff Software Symposiums.
In January 2006, Mr. Bock was honored by being awarded the title of Java Champion by a panel of esteemed leaders in the Java Community in a program sponsored by Sun. There are approximately 100 active Java Champions worldwide.
In addition to his public speaking and training activities, Mr. Bock actively consults as a software engineer, project manager, and team mentor for commercial and government clients.More About David »
November 1 - 3, 2013
Current Topics on the NFJS Tour
- Core Java, JEE
- Dynamic Languages: Groovy, JRuby, Scala, Clojure
- RESTful Web Apps
- Frameworks: Hibernate, Grails, Spring, JSF, GWT, more
- Test Driven Design
- Ajax, Flex, RIA
Why Attend the NFJS Tour?
- » Cutting-Edge Technologies
- » Agile Practices
- » Peer Exchange
- Languages on the JVM: Scala, Groovy, Clojure
- Enterprise Java
- Core Java, Java 7
- Testing: Geb, Spock, Easyb
- NoSQL: MongoDB, Cassandra
- Spring 3
- Automation Tools: Git, Hudson, Sonar
- HTML5, Ajax, jQuery, Usability
- Mobile Applications - iPhone and Android
NFJS, the MagazineMay Issue Now Available
On the road to learningby Raju Gandhi
Refactoring to Modularityby Kirk Knoernschild
RESTful Groovyby Kenneth Kousen
Getting Started with D3.jsby Brian Sletten