<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: PGD</title>
    <description>The latest articles on DEV Community by PGD (@rudeh1253).</description>
    <link>https://dev.to/rudeh1253</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1295516%2F1d14769b-2f56-4b24-a5d8-f37fc3780471.png</url>
      <title>DEV Community: PGD</title>
      <link>https://dev.to/rudeh1253</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rudeh1253"/>
    <language>en</language>
    <item>
      <title>Linux Booting process</title>
      <dc:creator>PGD</dc:creator>
      <pubDate>Mon, 22 Apr 2024 09:59:16 +0000</pubDate>
      <link>https://dev.to/rudeh1253/linux-booting-process-2pde</link>
      <guid>https://dev.to/rudeh1253/linux-booting-process-2pde</guid>
      <description>&lt;p&gt;First of all, once a user turn the power on, the BIOS (Basic Input/Output System) is loaded from the ROM embedded on the motherboard. BIOS is responsible for initializing hardware such as screens, keyboard and testing the memory.&lt;br&gt;
BIOS is not a part of OS (Operating System), but a component of hardware. After BIOS completes its tasks, the system control is passed to boot loader, which is responsible for loading and initializing operating system.&lt;br&gt;
For BIOS/MBR system, the boot loader is stored in the boot sector, also known as MBR (Master Boot Record), which is the first sector of a disk, while for EFI ((Unified) Extensible Firmware Interface) system, the boot loader is stored in a partition of a storage (usually SSD or HDD), which is called ESP (EFI System Partition).&lt;br&gt;
There are several boot loaders can be used&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GRUB (GRand Unified Boot loader) for most of the Linux system&lt;/li&gt;
&lt;li&gt;ISOLINUX for booting Linux system from removable disk&lt;/li&gt;
&lt;li&gt;DAS U-Boot for booting Linux system in embedded devices&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At the beginning of tasks the boot loader will do, the boot loader prompts the user to choose options for booting Linux or even alternative operating systems. In case of booting Linux, the boot loader is responsible for loading the kernel image and the initial RAM disk or filesystem (contains critical files and device drivers necessary for starting the system) into memory.&lt;/p&gt;

&lt;p&gt;The boot loader is executed on the two distinct stage.&lt;br&gt;
At the first stage, for BIOS/MBR system, the boot loader looks up partition table and finds a bootable partition. Once it finds a bootable partition, then it finds and loads the second stage boot loader, such as GRUB. For EFI/UEFI system, UEFI firmware reads the Boot Manager data which describes which UEFI application is to be launched and which partition the EFI exists. The UEFI firmware launches UEFI application, GRUB for instance, as defined in the boot entry in the firmware's boot manager. EFI/UEFI method is more versatile than the old BIOS/MBR method.&lt;br&gt;
At the second stage, the GRUB allows the user to choose which operating system or kernel to be launched. Once an OS or kernel is selected, GRUB loads kernel on the memory and passes control to it. The kernel is usually compressed such that the first thing the kernel should do is uncompressing itself. And then, the kernel will analyze and check the state of hardware, and initialize hardware driver built into the kernel.&lt;/p&gt;

&lt;p&gt;[TODO]&lt;/p&gt;

</description>
      <category>linux</category>
    </item>
    <item>
      <title>HTTPS note</title>
      <dc:creator>PGD</dc:creator>
      <pubDate>Fri, 05 Apr 2024 09:51:21 +0000</pubDate>
      <link>https://dev.to/rudeh1253/https-note-5g68</link>
      <guid>https://dev.to/rudeh1253/https-note-5g68</guid>
      <description>&lt;h2&gt;
  
  
  SSL (Secure Socket Layer)
&lt;/h2&gt;

&lt;p&gt;SSL is a strategy of communication on the web, developed by Netscape in 1995.&lt;br&gt;
Since data transferred via web is composed of string, anyone can intercept and read the sensitive data. For security, SSL is used for encryption data to be transmitted.&lt;br&gt;
SSL is implemented by what is called SSL certificate. SSL certificate contains information of identity of client and asymmetric key. One that is stored on the website or application server contains private key and the other contains public key. The public key is used for encryption of data, and private key is for decryption. The private key keeps secret in the server.&lt;/p&gt;

&lt;h3&gt;
  
  
  SSL handshake
&lt;/h3&gt;

&lt;p&gt;SSL authentication is executed by a series of process called handshake.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The client, at first, initiates SSL handshake by sending "ClientHello" to the server. The "ClientHello" message contains information about security such as SSL/TLS version it can accept and cipher suites.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then the server responds to the message and sends "ServerHello" to the client. The "ServerHello" message also contain information about which SSL/TLS version to use by the both parties of the communication.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After that, the server sends its Digital Certificates, verified by Certificate Authority (CA) such as &lt;a href="http://www.SSL.com"&gt;www.SSL.com&lt;/a&gt;, to the client.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And then the browser validates the server's credential. Once it is verified, the client uses server's public key to encrypt a "premaster secret", a unique session key, and sends it back to the server.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The server decrypts the premaster secret with the server's private key. The server and client then compute the session key, which will be used as a symmetric encryption of every communication.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Components of SSL/TLS handshake
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Asymmetric Encryption
&lt;/h4&gt;

&lt;p&gt;There are private key and public key, which private key is for decryption, whereas public key is for encryption&lt;/p&gt;

&lt;h4&gt;
  
  
  Symmetric Encryption
&lt;/h4&gt;

&lt;p&gt;A single shared by both client and server. It is used for encryption and decryption. Symmetric encryption is faster than asymmetric encryption. SSL/TLS handshake uses asymmetric encryption to share symmetric session key.&lt;/p&gt;

&lt;h4&gt;
  
  
  Digital Certificates
&lt;/h4&gt;

&lt;p&gt;Digital Certificate is a digital document bind a public key to an entity like a website. Digital Certificate enables secure authentication on the internet. Digital Certificates are issued by Certificate Authorities (CAs) like &lt;a href="http://www.SSL.com"&gt;www.SSL.com&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Cypher Suite
&lt;/h4&gt;

&lt;p&gt;Cypher Suite is a set of algorithm defines the cryptographic parameters for an SSL/TLS session. It includes key exchange methods, encryption ciphers, and hash functions.&lt;/p&gt;

&lt;h4&gt;
  
  
  Session Key
&lt;/h4&gt;

&lt;p&gt;A session key is a temporary symmetric key generated by client and server. A session key is unique to each session. During the session, all data transmission is encrypted and decrypted by the temporary session key.&lt;/p&gt;

&lt;h3&gt;
  
  
  Types of SSL Certificates
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Single-domain&lt;/strong&gt;: is applied to a single domain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wildcard&lt;/strong&gt;: is similar to single-domain, but it includes subdomains of the domain. For instance, a wildcard certificate includes sampledomain.com, api.sampledomain.com, auth.sampledomain.com, while a single-domain certificate could only cover the first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-domain&lt;/strong&gt;: can apply to multiple unrelated domains.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Certificate
&lt;/h2&gt;

&lt;p&gt;To verify whether the website is authenticated/certified or not (uncertified websites can be a evil website). An authenticated website has a unique personal certificate purchase from one of the CA's.&lt;/p&gt;

&lt;h3&gt;
  
  
  CA
&lt;/h3&gt;

&lt;p&gt;Globally trusted companies, like GoDaddy, GeoTrust, VeriSign, etc. who provide digital certificate to the websites.&lt;/p&gt;

&lt;h3&gt;
  
  
  How a website get a certificate
&lt;/h3&gt;

&lt;p&gt;Website owner first generates a public key and private key. He gives a &lt;strong&gt;Certificate Signing Request file (CSR)&lt;/strong&gt; and his public key to the CA.&lt;br&gt;
CA then creates a personal certificate based on CSR including domain name, owner name, expiry date, serial number, etc. and also adds an &lt;strong&gt;encrypted text&lt;/strong&gt; (=&lt;strong&gt;digital signature&lt;/strong&gt;) to the certificate and finally encrypts the whole certificate with the public key of the server and sends it back to the website owner.&lt;br&gt;
This certificate is decrypted with the private key of the website owner and he installs it on the website.&lt;/p&gt;

&lt;p&gt;The encrypted text is the digital signature of the CA. That text is encrypted by the private key of the CA and &lt;strong&gt;can only be decrypted by a public key of CA&lt;/strong&gt;. When installing operating system or browser, &lt;strong&gt;root-certificates&lt;/strong&gt; form many trusted CAs come with it. These root-certificates &lt;strong&gt;contain the public key&lt;/strong&gt; of that CA provider which helps decrypt the signature.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTPS security split into 2 parts (handshake)
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. To validate the certificate of a website
&lt;/h4&gt;

&lt;p&gt;1) When you enter the URL &lt;a href="http://www.google.com"&gt;www.google.com&lt;/a&gt;, Google's server gives its public key and certificate (which was signed by GeoTrust) to the browser.&lt;br&gt;
2) Browser ahs to verify the authenticity of the certificate, in other words, it's actually signed from GeoTrust or not. As browsers come with a pre-installed list of public keys from all the major CA's, it picks the public key of the GeoTrust and tries to decrypt the digital signature of the certificate which was encrypted by the private key of GeoTrust.&lt;br&gt;
3) If it's able to decrypt the signature (which means it's a trustworthy website) then it proceeds to the next step, otherwise it stops and shows a red cross before the URL.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. To create a secure connection
&lt;/h4&gt;

&lt;p&gt;1) Google sends its public key when you enter &lt;a href="http://www.google.com"&gt;www.google.com&lt;/a&gt;. Any data encrypted with the public key can only be decrypted by Google's private key which Google doesn't share with anyone.&lt;br&gt;
2) After validating the certificate (phase 1 above), browser creates a new key, which is &lt;strong&gt;session key&lt;/strong&gt;.&lt;br&gt;
3) Browser encrypts a copy of session key and other request data with the Google's public key. Then it sends it back to the Google server.&lt;br&gt;
4) Google's server decrypts the encrypted data using its private key and gets the session key (Someone says that the session key is never transmitted at all. It is established via a secure key negotiation algorithm. The premaster secret is not the session key. For now, I will understand the session key as a symmetric key), and other request data. Client and server are the only one that has the key. The key will be used for both decryption and encryption the data.&lt;br&gt;
5) When google sends the data like requested HTML document and other HTTP data to the browser it first encrypts the data with the session key and browser decrypts with the other copy of the session key.&lt;br&gt;
6) Similarly, when browser sends the data to the Google server, it encrypts the data with the session key which server decrypts on the other side.&lt;br&gt;
The session key is only used for that session only. If the user closes the website and opens again, a new session key would be created.&lt;/p&gt;

&lt;h2&gt;
  
  
  TLS (Transport Layer Security)
&lt;/h2&gt;

&lt;p&gt;TLS was derived from SSL, but it is developed not by Netscape. Since TLS is no longer associated with Netscape, the protocol name had been changed. By historical reason, SSL and TLS can be used interchangably.&lt;/p&gt;

&lt;h3&gt;
  
  
  What TLS does
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Encryption&lt;/strong&gt;: hides the data being transferred.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authentication&lt;/strong&gt;: ensures that the parties exchanging information are who they claim to be.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integrity&lt;/strong&gt;: verifies that the data has not been forged or tampered with.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  TLS certificate
&lt;/h3&gt;

&lt;p&gt;TLS certificate (a.k.a. SSL certificate) should be installed on the origin server of a website or application to use TLS. A TLS certificate contains important information about who owns the domain, along with the server's public key, both of which are important for validating the server's identity.&lt;/p&gt;

&lt;h2&gt;
  
  
  HTTPS (Hypertext Transfer Protocol Secure)
&lt;/h2&gt;

&lt;p&gt;HTTPS simply uses SSL/TLS encryption on top of HTTP. HTTPS occurs based upon the transmission of SSL/TLS certificates, which verify that a particular provider is who they claim to be.&lt;br&gt;
Any website, especially uses sensitive information or requires login credentials, should use HTTPS.&lt;/p&gt;

&lt;h3&gt;
  
  
  Port
&lt;/h3&gt;

&lt;p&gt;HTTPS uses port 443.&lt;/p&gt;

&lt;p&gt;In networking, a port is a virtual software-based point where network connections start and end. All network-connected computers expose a number of ports to enable them to receive traffic. Each port is associated with a specific process or service, and different protocols use different ports.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.ssl.com/article/ssl-tls-handshake-ensuring-secure-online-interactions/"&gt;https://www.ssl.com/article/ssl-tls-handshake-ensuring-secure-online-interactions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.cloudflare.com/learning/ssl/what-is-ssl/"&gt;https://www.cloudflare.com/learning/ssl/what-is-ssl/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.cloudflare.com/learning/ssl/transport-layer-security-tls/"&gt;https://www.cloudflare.com/learning/ssl/transport-layer-security-tls/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.cloudflare.com/learning/ssl/what-is-https/"&gt;https://www.cloudflare.com/learning/ssl/what-is-https/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/6241991/how-exactly-https-ssl-works"&gt;https://stackoverflow.com/questions/6241991/how-exactly-https-ssl-works&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>ApplicationContext, DispatcherServlet, ContextLoaderListener</title>
      <dc:creator>PGD</dc:creator>
      <pubDate>Sat, 09 Mar 2024 08:34:30 +0000</pubDate>
      <link>https://dev.to/rudeh1253/applicationcontext-dispatcherservlet-contextloaderlistener-1jgb</link>
      <guid>https://dev.to/rudeh1253/applicationcontext-dispatcherservlet-contextloaderlistener-1jgb</guid>
      <description>&lt;p&gt;A context indicates an instance of Spring bean container. If we want a DispatcherServlet to dispatch the request to beans annotated with @Controller (i.e., controllers), we should provide a context containing controller beans, in other words, we should pass the location of metadata of Spring context to DispatcherServlet so that it can generate his Spring context. Typically, Spring context DispatcherServlet has contains beans related to Web MVC, such as controllers or rest controllers (beans annotated with @Controller or @RestController).&lt;br&gt;
Each DispatcherServlet has one Spring context its own. If you want some beans to be shared across your web application, it doesn't be achieved by registering beans on the DispatcherServlet context.&lt;br&gt;
In that case, you can register your beans on the context included in ContextLoaderListener, which is so called bootstrap context since it is root of Spring contexts of web application. DispatcherServlet contexts are children of the bootstrap context. For a beans in parent context, it is visible to the child context, but not vice versa.&lt;br&gt;
Once you register your beans into the bootstrap context in ContextLoaderListener, your DispatcherServlet can access the beans.&lt;/p&gt;

&lt;p&gt;Registering ContextLoaderListener in web.xml:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;listener&amp;gt;
    &amp;lt;listner-class&amp;gt;
        org.springframework.web.context.ContextLoaderListener
    &amp;lt;/listener-class&amp;gt;
&amp;lt;/listener&amp;gt;

&amp;lt;!-- By default, ContextLoaderListener uses XmlWebApplicationContext

&amp;lt;context-param&amp;gt;
    &amp;lt;param-name&amp;gt;contextClass&amp;lt;/param-name&amp;gt;
    &amp;lt;param-value&amp;gt;org.springframework.web.context.support.XmlWebApplicationContext&amp;lt;/param-value&amp;gt;
&amp;lt;/context-param&amp;gt;

--&amp;gt;

&amp;lt;context-param&amp;gt;
    &amp;lt;param-name&amp;gt;contextConfigLocation&amp;lt;/param-name&amp;gt;
    &amp;lt;param-value&amp;gt;classpath*:spring-config/context-*.xml&amp;lt;/param-value&amp;gt; &amp;lt;!-- For instance --&amp;gt;
&amp;lt;/context-param&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ContextLoaderListener uses ServletContext to get the information where the metadata was placed.&lt;/p&gt;

</description>
      <category>spring</category>
      <category>webdev</category>
      <category>java</category>
    </item>
    <item>
      <title>Specifying context configuration location for DispatcherServlet</title>
      <dc:creator>PGD</dc:creator>
      <pubDate>Thu, 07 Mar 2024 10:34:15 +0000</pubDate>
      <link>https://dev.to/rudeh1253/specifying-context-configuration-location-for-dispatcherservlet-13jj</link>
      <guid>https://dev.to/rudeh1253/specifying-context-configuration-location-for-dispatcherservlet-13jj</guid>
      <description>&lt;p&gt;The DispatcherServlet is a front controller serving as a single point entry of request. In Spring MVC architecture, every request passes through DispatcherServlet. Once the DispatcherServlet receives the request then it recognizes the path, gets a controller mapped to the path, and lets the controller process the business logic.&lt;/p&gt;

&lt;p&gt;Since DispatcherServlet is a front controller, which is a single point entry, it's the only servlet to register in web application context. We can register it by specifying inside of web.xml file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0"&amp;gt;

    &amp;lt;servlet&amp;gt;
        &amp;lt;servlet-name&amp;gt;dispatcherServlet&amp;lt;/servlet-name&amp;gt;
        &amp;lt;servlet-class&amp;gt;org.springframework.web.servlet.DispatcherServlet&amp;lt;/servlet-class&amp;gt;
    &amp;lt;/servlet&amp;gt;
    &amp;lt;servlet-mapping&amp;gt;
        &amp;lt;servlet-name&amp;gt;dispatcherServlet&amp;lt;/servlet-name&amp;gt;
        &amp;lt;url-pattern&amp;gt;/&amp;lt;/url-pattern&amp;gt;
    &amp;lt;/servlet-mapping&amp;gt;
&amp;lt;/web-app&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also it's possible to tell DispatcherServlet where the Spring config file is by specifying an  whose param name is "contextConfigLocation". If I have a Spring config file named "context-common.xml" on the root directory of web application, then I can specify the location as follows.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;init-param&amp;gt;
    &amp;lt;param-name&amp;gt;contextConfigLocation&amp;lt;/param-name&amp;gt;
    &amp;lt;param-value&amp;gt;/context-common.xml&amp;lt;/param-value&amp;gt;
&amp;lt;/init-param
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also I can put the config file at the resources file and prepend "classpath:" at the config file path so that DispatcherServlet knows the config file places on the classpath.&lt;/p&gt;

&lt;p&gt;DispatcherServlet lookups spring beans of controllers using WebApplicationContext. &lt;strong&gt;By default&lt;/strong&gt;, its implementation the DispatcherServlet is using is org.springframework.web.context.support.XmlWebApplcationContext. That receives an XML configuration file for initial config file.&lt;br&gt;
If I want to use a Java class annotated with &lt;code&gt;@Configuration&lt;/code&gt; to configure Spring context, I have to say to DispatcherServlet that it should make use of other implementation of WebApplicationContext. AnnotationWebConfigApplicationContext is needed in order for the Spring Container to contain the configuration bean. It is possible to configure that in web.xml:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;servlet&amp;gt;
    &amp;lt;servlet-name&amp;gt;dispatcherServlet&amp;lt;/servlet-name&amp;gt;
    &amp;lt;servlet-class&amp;gt;org.springframework.web.servlet.DispatcherServlet&amp;lt;/servlet-class&amp;gt;
    &amp;lt;init-param&amp;gt;
        &amp;lt;param-name&amp;gt;contextClass&amp;lt;/param-name&amp;gt;
        &amp;lt;param-value&amp;gt;org.springframework.web.context.support.AnnotationConfigWebApplicationContext&amp;lt;/param-value&amp;gt;
    &amp;lt;/init-param&amp;gt;
    &amp;lt;init-param&amp;gt;
        &amp;lt;param-name&amp;gt;contextConfigLocation&amp;lt;/param-name&amp;gt;
        &amp;lt;param-value&amp;gt;com.springmvc.demo.web.config.WebMVCConfig&amp;lt;/param-value&amp;gt;
    &amp;lt;/init-param&amp;gt;
&amp;lt;/servlet&amp;gt;
&amp;lt;servlet-mapping&amp;gt;
    &amp;lt;servlet-name&amp;gt;dispatcherServlet&amp;lt;/servlet-name&amp;gt;
    &amp;lt;url-pattern&amp;gt;/&amp;lt;/url-pattern&amp;gt;
&amp;lt;/servlet-mapping&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>spring</category>
      <category>java</category>
      <category>springmvc</category>
    </item>
    <item>
      <title>RMI (Remote Method Invocation)</title>
      <dc:creator>PGD</dc:creator>
      <pubDate>Thu, 29 Feb 2024 03:11:32 +0000</pubDate>
      <link>https://dev.to/rudeh1253/rmi-remote-method-invocation-d0p</link>
      <guid>https://dev.to/rudeh1253/rmi-remote-method-invocation-d0p</guid>
      <description>&lt;p&gt;RMI (Remote Method Invocation) is an API provided by J2EE platform that defines methods for applications in different systems (JVM in running) to communicate by invocating a method. It defines methods to communicate with different applications in distributed system environment.&lt;br&gt;
RMI provides two objects, each called &lt;strong&gt;stub&lt;/strong&gt; and &lt;strong&gt;skeleton&lt;/strong&gt;. Both stub and skeleton are for building connection. A stub is the object for client-side application and a skeleton is for server-side application.&lt;br&gt;
Once the client invokes a method of stub object, then the stub processes the following tasks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build a connection to the remote machine (JVM).&lt;/li&gt;
&lt;li&gt;Route to the server.&lt;/li&gt;
&lt;li&gt;Convert the parameter data of the remote method to call into a serialized data suitable for transmission (Marshaling).&lt;/li&gt;
&lt;li&gt;Wait for result from the remote method.&lt;/li&gt;
&lt;li&gt;Read the result or exception (Unmarshalling).&lt;/li&gt;
&lt;li&gt;Return the result to the caller.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once the server receives the signal, then the skeleton process the following tasks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unmarshall parameters.&lt;/li&gt;
&lt;li&gt;Invoke the method providing the parameters.&lt;/li&gt;
&lt;li&gt;Get the return from the method called and marshal it.&lt;/li&gt;
&lt;li&gt;Send.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Distributed applications should perform the following process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Locating remote method&lt;/li&gt;
&lt;li&gt;Providing communication with the remote object.&lt;/li&gt;
&lt;li&gt;Load class definition the method belongs to.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>java</category>
      <category>j2ee</category>
    </item>
  </channel>
</rss>
