Showing posts with label Web Server. Show all posts
Showing posts with label Web Server. Show all posts

Friday, 29 January 2021

Web Server Vs. API Server | API Tutorial | Web Services Tutorial

🚀 Skyrocket Your Tech Knowledge!

Don't miss out on the simplest tech breakdowns. Join the Ram N Java family and start learning today!

SUBSCRIBE NOW

Web Server vs. API Server: The Ultimate Comparison

In the world of backend development, you'll often hear the terms "Web Server" and "API Server" used interchangeably, but they serve very different purposes. Understanding this distinction is vital for anyone building modern applications.

What is a Web Server?

A Web Server's primary job is to serve User Interface (UI). When you type a URL into your browser, the Web Server sends back HTML, CSS, and JavaScript files that your browser renders into a beautiful website. It is designed for humans to interact with.

What is an API Server?

An API Server, on the other hand, is designed for machines to interact with. It doesn't send back pretty layouts; instead, it sends raw data, usually in JSON or XML format. It handles the logic and data processing that powers the front-end application.

Key Differences at a Glance

1. Content Type

Web servers focus on static and dynamic content for browsers (HTML). API servers focus on data-driven content for applications (JSON/XML).

2. Target Audience

Web servers are for people browsing the web. API servers are for other software, mobile apps, or even other servers.

3. Interaction Style

Web servers provide a full visual experience. API servers provide a "headless" experience where only the raw data matters.

Most modern apps actually use both! A web server delivers the initial page, and then that page makes requests to an API server to fetch updated data. Watch the video above for a deep dive into how they work together!


Discover More from Ram N Java:

Thursday, 8 August 2019

Spring boot - How to configure Jetty Server option programmatically? | Spring Boot tutorial

🚀 Boost Your Java Career!

Love learning Spring Boot? Subscribe to Ram N Java for top-tier tutorials!

YES, I WANT TO SUBSCRIBE!

How to Configure Jetty in Spring Boot

While Tomcat is the default web server for Spring Boot, many developers prefer Jetty for its lightweight nature and high performance in specific cloud environments. In this guide, we'll walk through how to switch to Jetty and configure its options like a professional.

Step 1: Switching to Jetty

The first thing you need to do is exclude the default Tomcat starter and include the Jetty starter in your pom.xml file. This tells Spring Boot to use Jetty as the embedded servlet container.

Step 2: Configuring Server Options

Once Jetty is active, you can customize it using the application.properties file. You can control everything from the port number to advanced thread pool settings.

# Change the server port
server.port=8081

# Jetty specific configurations
server.jetty.threads.max=200
server.jetty.threads.min=10
server.jetty.threads.idle-timeout=60s
        

Why Choose Jetty?

Jetty is often praised for being more efficient with memory and having a smaller footprint than Tomcat. It is an excellent choice for microservices where resource optimization is key.

Explore More Spring Boot Tips

Don't stop here! Check out these other essential Spring Boot tutorials on my channel:

Saturday, 27 July 2019

How to install Tomcat 9 in windows operating system? | Tomcat 9 Installation | Tomcat

🚀 Master Web Server Setup!

Subscribe to Ram N Java for the most straightforward Java and Server tutorials on YouTube!

SUBSCRIBE TO THE CHANNEL

The Easy Way to Install Tomcat 9 on Windows

Apache Tomcat 9 is a powerful, open-source web server used by millions of developers to host Java-based web applications. While it might seem technical, installing it on Windows is actually quite simple when you follow the right steps. This guide will get your local server up and running in no time.

Step 1: Verify Java Installation

Before you even download Tomcat, you must have the Java Development Kit (JDK) installed on your Windows machine. Tomcat is written in Java and requires it to run. Open your Command Prompt and type java -version to make sure you're ready to go.

Step 2: Download the Tomcat 9 Installer

Head over to the official Apache Tomcat 9 download page. For Windows users, the easiest option is the "32-bit/64-bit Windows Service Installer" (the .exe file). This installer handles most of the configuration for you automatically.

Step 3: Run the Setup Wizard

Launch the downloaded installer and follow the prompts. During setup, you can choose which components to install (like the Manager GUI). You'll also be asked to specify the port—the default is usually 8080. Keep this in mind for later!

Step 4: Configure the Java Path

The installer will ask for the location of your JRE or JDK. It usually finds this automatically, but double-check that it points to the correct folder (e.g., C:\Program Files\Java\jdk-11) so Tomcat can launch without errors.

Step 5: Start and Test Your Server

Once the installation is complete, you can start the Tomcat service. Open your browser and go to http://localhost:8080. If you see the famous Tomcat "If you're seeing this, you've successfully installed Tomcat" page, congratulations! You're ready to deploy your apps.

Thursday, 13 June 2019

How to change the default port in spring boot application programmatically? | Spring Boot tutorial

🎯 Never Miss a Java Hack!

Level up your Spring Boot skills with weekly tutorials on Ram N Java. Join our coding community today!

SUBSCRIBE NOW

Changing the Spring Boot Port Programmatically

By default, Spring Boot applications start on port 8080. While changing this in a properties file is common, there are many scenarios—like building dynamic microservices—where you might need to change it directly in your Java code. This guide makes it simple!

Why Change the Port in Code?

Setting the port programmatically gives you ultimate control. You can calculate the port at runtime, read it from a database, or even find an available port automatically. This is especially useful for developers running multiple local instances of the same service.

The Main Methods

There are two primary ways to handle this in your Spring Boot project:

  • Using WebServerFactoryCustomizer: This is the modern, flexible way to customize the server. You create a component that tells Spring exactly how to configure the embedded server before it starts.
  • Using System Properties: You can set the port within your main method before calling SpringApplication.run(). It’s a quick and dirty way to override settings globally.

Beginner Tip: Keep it Dynamic

If you're worried about port conflicts, you can set the port to 0. This tells Spring Boot to find any randomly available port on your machine. It’s a great trick for integration testing or when you don't want to manually manage port numbers!

Remember: Any changes made programmatically will typically override what is written in your application.properties file.


Continue Your Spring Boot Journey

Check out these other helpful tutorials from the Ram N Java channel:

Tutorials