RESTful Java Web Services Interview Questions You'll Most Likely Be Asked: Second Edition
RESTful Java Web Services Interview Questions You'll Most Likely Be Asked: Second Edition
Services Interview
Questions
Review these typical interview questions and think about how you would
answer them. Read the answers listed; you will find best possible answers
along with strategies and suggestions.
This page is intentionally left blank
Chapter 1
Introduction to REST
1: What is REST?
Answer:
REST stands for REpresentational State Transfer. It is an
architectural style for developing web services. In a REST
application, the REST server exposes various services and client
applications access those services. It makes use of the HTTP
protocol, so the REST client and server communicate via HTTP.
The data exchanged between the client and server can be in
different formats like plain text, XML, HTML or JSON. So, a REST
client requests a REST service via a URI, the REST service
processes the client request and sends back the data in the
appropriate format.
2: Which are the six principles on which REST API is based?
Answer:
a) Client server – Concerns should be separated between
clients and servers. This allows client and server
applications to be developed independently.
b) Stateless – The communication between the client and
server should be stateless. The server need not remember
the state of the client.
c) Layered System – Layered system simply means there can
be several layers on the server side, but the client application
need not be aware of this. So, your server code may be on
one machine, database on another, etc. Multiple hierarchies
such as gateways, firewalls, proxies can also be present
between the client and server.
d) Cache – Responses from the server should be cacheable
where possible in order to improve performance for the
client.
e) Uniform Interface – The services provided by a REST
application must be exposed via URIs. All interactions
between client, server and intermediary components are
based on the uniformity of their interfaces.
f) Code on demand – In addition to static data like XML or
JSON, the REST application can send code like JavaScript,
Applets which can be downloaded and executed by client
applications.