Saturday, May 10, 2014

HTTP POST vs PUSH

It's not as simple as Update vs Create.

According to the HTTP 1.1 specification, GET, HEAD, PUT and DELETE are idempotent, while POST is not.

http://jcalcote.wordpress.com/2008/10/16/put-or-post-the-rest-of-the-story/ Author states that there is no direct mapping between the HTTP and CRUD verb spaces and that a "higher level logic" should be added to complete the transformation.

Sunday, May 4, 2014

readObject and writeObject

Review the nuances of Java serialization, specifically see http://webcache.googleusercontent.com/search?q=cache:Q1Rpg2MReCIJ:www.javablogging.com/what-are-writeobject-and-readobject-customizing-the-serialization-process/+&cd=4&hl=en&ct=clnk&gl=us spells out how readObject and writeObject are called by ObjectOutputStream if present using getPrivateMethod. These are a way to customize serialization. Can call defaultReadObject/defaultWriteObject on ObjectInputStream/ObjectOutputStream before performing custom setup.

Thursday, May 1, 2014

Java vs. C# - Resource Auto Closing

       

            static String readFirstLineFromFile(String path) throws IOException {
              try (BufferedReader br =
                          new BufferedReader(new FileReader(path))) {
                      return br.readLine();
              }
            }
       
 
The above is similar and appears to have the same use case as the C# use statement, in that it allows you to omit the finally block so long as the resource in question implements java.lang.AutoCloseable (Java) vs IDisposeable .NET. The above was new in Java SE 7. ref: http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html