A Servlet is an object that receives a request and generates a response based on that request. To deploy and run a servlet, a web container must be used such as TomCat/JWS/Jetty/Resin. In order to create a servlet the class must extend servlet. The package javax.servlet.http defines HTTP-specific subclasses ofContinue Reading

JAX-RS stands for: Java API for RESTful Web Services ,hence it is a http uniformed verb based service. Some of The main annotations in JAX – RS: @Path : specifies the relative path for a class or method @GET/@PUT/@POST/@DELETE/@HEAD: Indicates the http request type on the method but only oneContinue Reading

JAX-WS stands for Java API for XML Web Services. Creating a Service Endpoint Interface (SEI) package com.yairshinar.ws; import javax.jws.WebMethod; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; import javax.jws.soap.SOAPBinding.Style; @WebService @SOAPBinding(style = Style.DOCUMENT) public interface HelloName{ @WebMethod String getName(String name); } Creating a Service Implementation Bean (SIB) that implements all the methods of theContinue Reading

A thread in most cases is a component of a process, and shares it’s resources. In Java – Creating a basic thread and starting it: (This Example doesn’t provide any code in the start method. So the thread will exit right after it is started). Thread thread = new Thread();Continue Reading

Thread Synchronization is basically suspending (making one thread wait) until the other thread meets a certain condition. Now some of you know the regular Join(), which suspends the calling thread until the called thread meets the condition of finish. But , I would like to take a look at theContinue Reading

#include <string> #include <iostream> #include <thread> using namespace std; // The function we want to execute on the new thread. void task1(string msg) { cout << “task1 says: ” << msg; } int main() { // Constructs the new thread and runs it. Does not block execution. thread t1(task1, “Hello”);Continue Reading

The observer(subject) is an object that maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods.   Example – Python: class Observable: def __init__(self): self.__observers = [] def register_observer(self, observer): self.__observers.append(observer) def notify_observers(self, *args, **kwargs): for observerContinue Reading