RESTful

RESTful web services are light weight, highly scalable and maintainable and are very commonly used to create APIs for web-based applications.

REST stands for REpresentational State Transfer. uses HTTP Protocol. REST uses various representation to represent a resource like text, JSON, XML. JSON is the most popular one. Resources sent via:
  1. GET method – get or list the resources.
  2. POST method – create a resource.
  3. PUT method – update or replace a resource.
  4. DELETE method – removing the resource.
  5. REST – POST – Create a new resource and add, used to update the record too. Rest services does not restrict either use HTTP POST or HTTP PUT.
A web service is a collection of open protocols and standards used for exchanging data between applications or systems.

What is a Resource?

REST architecture treats every content as a resource. These resources can be Text Files, Html Pages, Images, Videos or Dynamic Business Data.

RESTful Web Services – Messages

RESTful Web Services make use of HTTP protocols as a medium of communication between client and server. A client sends a message in form of a HTTP Request and the server responds in the form of an HTTP Response. This technique is termed as Messaging.
 

RESTful Web Services – Statelessness

a RESTful Web Service should not keep a client state on the server.

RESTful Web Services – Caching

Caching refers to storing the server response in the client itself, so that a client need not make a server request for the same resource again and again.

SOAP

SOAP is XML based protocol. It is platform independent and language independent. By using SOAP, you will be able to interact with other programming language applications.

 WS Security: SOAP defines its own security known as WS Security.

WSDL dependent: SOAP uses WSDL and doesn’t have any other mechanism to discover the service.

WS – Web Service

It is a client-server application or application component for communication.

Web Service Components

  • SOAP
  • WSDL –  Web Services Description Language.
  • UDDI – Universal Description, Discovery and Integration.

RESTful Web Services

Fast (consumes less bandwidth and resource), Language and Platform independent, Can use SOAP, Permits different data format (Text, HTML, XML and JSON).

Service Oriented Architecture (SOA)

is a design pattern. provide services to other applications through protocol (URL). sending request and getting response.

Service – A service can exchange information from another service.

JAX-RS – Jersey, RESTEasy.

JAVA8

hibernate criteria, function – lambda expression addThen(), compose(), identity() methods.

Stream

iterate over a list of objects stream and hold it to the different object stream.

List<ZoneTypeDetail> clusterList = sndZoneTypeDetail.stream().map(e -> {

                                                ZoneTypeDetail zm = zoneTypeDetailServiceImpl.entityToBean(e);

                                                return zm;

                                }).collect(Collectors.toList());

java.util.stream.Collectors;

java.util.stream.StreamSupport;

Stream methods

map() – converts an list of object stream to different object stream.

collect() – get stuff out of stream. uses Collector interface toList() method.

Stream.of() – create a stream from individual objects using Stream.of().

filter() – it filters the stream depending upon certain conditions.

findFirst() – returns the first stream.

flatMap() – flatten the data structure to smplify further operations.

peek() – is an intermediate operation.

sorted() – sort the elements depending upon the comparator passed.

min() & max() – returns minimum and maximum element in the stream.

distinct() – eleminates duplicates and return the stream.

 Hibernate Cascading – save(), delete(), saveOrUpdate()

 Hibernate FetchType

FetchType.LAZY – it fetches the child entities lazily and improve the performance.

FetchType.EAGER – fetches child entities with parent, speed is slow.

Thread Pool

A thread pool reuses previously created threads to execute current tasks and offers a solution to the problem of thread cycle overhead and resource thrashing.

Executor framework which is centered around the Executor interface, its sub-interface –ExecutorService and the class-ThreadPoolExecutor, which implements both of these interfaces.

Facebooktwittergoogle_plusredditpinterestlinkedinmail
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...