Solutions for Java developers
04/02/09
By Brian Sletten
One of the least-understood parts of REST and Roy Fielding's
thesis is the thinking behind the phrasehypertext as the engine
of state transfer(HATEOS). The breadth and depth of this
misunderstanding provoked Fielding to issue a recent series of
justified but cranky blog entries reminding people about this
point. HATEOS can be a fairly nuanced concept, but its direct
consequences are pretty straightforward.
Consider the Web again. The dominant means of experiencing it is
through a browser. You type in a URL to a site, and the browser
issues a request via a specific protocol (usually HTTP) for the
resource. At that point, the resource representation (usually an
HTML document) is transferred back to your application along
with metadata that indicates to the browser how to interpret it.
Embedded in the result are links to one or more other pages,
resources, images, and so on. Based on the content type
(application/html), the browser understands how to parse it. It
can find these embedded references and allow you to invoke them
transparently by clicking through. Each new result is requested,
interpreted, and rendered. As you probably well know, this
simple process can engage you for hours!
The point of this thought experiment is to remember what HATEOS
means in practice. In short:
1. REST is not equivalent to HTTP even though HTTP is the dominant
application protocol used. REST works with other schemes as
well.
2. The uniform interfaceisthe interface. Because of its
constraints, REST does not have the same need as other
approaches for service-description languages. The URL for a
resourceishow you interact with it using a semantically
constrained set of verbs. Approaches like the Web Application
Description Language (WADL) are unnecessary and confuse the
issue. REST is not about arbitrary behavior; it is about
manipulating information resources.
3. Resources -- even subresources -- should be linkable. Do not
return just blobs of data or collections of "dead" data.
Collections of links are perfectly reasonable results that your
client should understand.
4. You can indicate processing hints to the client by tagging
resources with appropriate content types. A client knows how to
parse HTML, render an image, or play a sound file. Nonbrowser
clients or sufficiently available plug-in technologies allow the
whole system to be extended. Content negotiation allows the same
resource to be requested in different formats as needed. You can
define your own content types using the MIME approach to
indicate how clients should interpret your data if standard
types don't apply.
Read more: REST foundations in the Semantic Web: Resource
description and discovery
http://www.networkworld.com/nljavaworldsente190066
1. REST for Java developers, Part 3: NetKernel
http://www.networkworld.com/nljavaworldsente180713
2. Wicked cool Java: The Semantic Web
http://www.networkworld.com/nljavaworldsente190067
3. Google rolls out semantic search
http://www.networkworld.com/nljavaworldsente190067
1. Dustin Marx: Overloading vs overriding in Java
http://www.javaworld.com/community/node/2729
2. Charles Nutter: How JRuby makes Ruby fast
http://www.javaworld.com/community/node/2730
3. Ted Neward: 'Multicore mania': A rebuttal
http://www.javaworld.com/community/node/2723
4. Obi Ezechukwu: Deadlock anti-pattern #1: No arbitration
http://www.javaworld.com/community/node/2701
5. Esther Schindler: Is software automation a career threat?
http://www.javaworld.com/community/node/2699
VonQ says: I'm trying to wrap my mind around why all my beginner
java books use the main method to instantiate objects of a
different class than the one it is being instantiated in, such
as the one below. I've tested it and know it works but why don't
I ever see it in the books? Is there a drawback to creating a
new object of the same object that you are in?
6 Replies:
-KKelly: You can obviously instantiate the class using either
form. However, when you instantiate the class from within the
main method of the same class, you're creating a little more
complexity than you'd probably like to have in a textbook trying
to explain how things work ...
-Garyo: Your question is actually quite good. Everyone has
thought the same thing at some point. No recreation of objects
is occurring. That is the program structure in Java. You can
break it up though (2 programs in the same directory) ...
More in this thread: Instantiating object main method
http://www.javaworld.com/community/node/2657 You've hit the tip of the iceberg: Read more in JW Blogs
http://www.javaworld.com/community/
_______________________________________________________________
This newsletter is sponsored by AMD
AMD and Red Hat: Driving Optimal Virtualization
Nearly every IT site either has undertaken virtualization
projects or has them planned. But as the projects expand, the
focus shifts from just implementing to optimizing virtualization
efforts. As this Webcast will clearly show, this optimization is
closely allied with the server and software components selected.
Learn more.
http://adserver.fattail.com/redir/redirect.asp?CID=293724
_______________________________________________________________
Create Your Own Agenda at IT Roadmap. Customize a day of learning
just for yourself! Attend IT Roadmap Conference & Expo and
explore new solutions and examine new technology across 10 relevant
areas of IT. Security, Virtualization, SaaS, VoIP, Green IT and
more. 10 U.S. cities in '09. Next up.. NYC-Feb, Denver-March,
Chicago-April. Select your city, register and attend free!
http://www.nww.com/rpgx.jsp?c=XU1PTAZ3905
_______________________________________________________________
This Newsletter Subscription Compliments of: Linuxworld.com http://www.linuxworld.com
ALSO FEATURED ON JAVAWORLD
Lamport's one-time password algorithm
http://www.networkworld.com/nljavaworldsente189566
The Lamport algorithm provides an elegant scheme for generating
and applying one-time passwords, or OTP. Find out how Lamport
works, then see it in action with an OTP reference
implementation for an extensible, Java-based library.
Understanding actor concurrency, Part 2: Actors on the JVM
http://www.networkworld.com/nljavaworldsente188943
Erlang isn't the only language for implementing actor
concurrency. Find out how actors work and see them implemented
in Scala's standard library, Groovy's GParallelizer, and the
Java libraries Kilim, ActorFoundry, Actors Guild, and Jetlang
Open source Java projects: Jakarta Cactus
http://www.networkworld.com/nljavaworldsente188428
Unit-testing server-side code is famously challenging, but
Jakarta Cactus does make it easier. Learn how Cactus extends
JUnit with an in-container strategy that lets you execute test
cases for servlets, EJBs, and other server-side code. You'll
also learn how to automate your Cactus-based tests.
Writing good unit tests, Part 1: Follow your GUTs
http://www.networkworld.com/nljavaworldsente187286
What do you know about the quality of your unit tests? Probably
not as much as you know about your production code. Klaus Berg
explains why craft matters just as much for test code as for
production code, then provides a comprehensive listing of agile
tools and best practices for improving the quality of your unit
tests.
_______________________________________________________________
This newsletter is sponsored by AMD
AMD and Red Hat: Driving Optimal Virtualization
Nearly every IT site either has undertaken virtualization
projects or has them planned. But as the projects expand, the
focus shifts from just implementing to optimizing virtualization
efforts. As this Webcast will clearly show, this optimization is
closely allied with the server and software components selected.
Learn more.
http://adserver.fattail.com/redir/redirect.asp?CID=293724
_______________________________________________________________
UPCOMING ON JAVAWORLD
-Writing good unit tests, Part 2
-Jump into JavaFX, Part 4: Advanced APIs
-Cloud-ready, multicore-friendly code, Part 2
-Introduction to Spring MVC
Podcasts:
-Alex Miller: Talkin' about Terracotta
-Make way for Jetty: Coming of age at 12
JavaWorld's Daily Brew - Starting conversations in the Java
developer community
http://www.javaworld.com/community
_______________________________________________________________
BONUS FEATURE
Network World's IT Resource Library. Whether you're looking to gear
up on one specific topic or you're trying to stay current on
several areas, Network World's resource library has what you're
looking for. Our comprehensive collection of resources will make
your job easier. Visit Now
http://www.nww.com/rpgx.jsp?c=XU1PTAZ3783
_______________________________________________________________
May we send you a free print subscription to Network World?
You've got the technology snapshot of your choice delivered at
your fingertips each day. Now, extend your knowledge by
receiving 50 FREE issues to our print publication. Apply today
at http://www.subscribenw.com/nl2
International subscribers click here:
http://nww1.com/go/circ_promo.html
_______________________________________________________________
SUBSCRIPTION SERVICES
To make newsletter subscription changes or cancellation, please
go to:
http://www.subscribenw.com/nl/login.jsp
To change your e-mail address, go to:
http://www.subscribenw.com/nl/eclogin.jsp
Subscription questions? Contact Customer Service by replying to
this message.
This message was sent to: athenssuthakar.javaupdates@blogger.com
Please use this address when modifying your subscription.
_______________________________________________________________
For advertising information, write Susan Cardoza, Associate
Publisher Online, at: mailto:sponsorships@nwfusion.com
_______________________________________________________________
JavaWorld is a trademark or registered trademark of Sun
Microsystems, Inc. in the United States and other countries, and
is used under license by International Data Group, Inc. All
other product names and trademarks used are the trademarks of
their respective owners.
Copyright 2009 JavaWorld.
http://www.javaworld.com