API Flashcards
What is the purpose of an API?
APIs facilitate communication between different software applications, enabling them to interact, exchange data, or access functionalities.
What are the common types of APIs?
Common types include Web APIs (utilized over the internet), Library-Based APIs (functions within programming libraries), and Operating System APIs (interaction with operating system functions).
How do APIs ensure security?
APIs often employ authentication methods such as API keys, OAuth, or tokens to secure access to data or services.
What benefits do APIs offer in software development?
APIs promote interoperability, integration between systems, and boost development efficiency by leveraging existing functionalities.
Dispatcher Servlet
Central servlet in the Spring MVC framework that receives incoming requests and directs them to the appropriate controllers for processing.
Initialization
During application startup, the Dispatcher Servlet is initialized by the Spring container and configured based on application settings.
Request Handling
When a request comes in, the Dispatcher Servlet maps it to the appropriate handler (controller) based on the request URL using handler mappings.
Handler Mapping
Configured components within the Dispatcher Servlet that determine which controller should handle an incoming request based on URL patterns or other criteria.
View Resolution
Once the controller processes the request, the Dispatcher Servlet identifies the correct view (often a JSP, Thymeleaf, or HTML file) to render the response.
Response Handling
The Dispatcher Servlet takes the view returned by the controller and generates the response to be sent back to the client.
@Controller
An annotation used in Spring MVC to denote a class as a controller. It handles HTTP requests and typically returns data to the view layer.
@RestController
A specialized version of the @Controller annotation in Spring MVC that combines @Controller and @ResponseBody. It’s used for RESTful APIs, automatically serializing data to JSON or XML and returning it in the response body.
AbstractController
A base controller class in Spring MVC that provides common functionalities like request handling methods and view handling. Developers can extend this class to create custom controllers.
HandlerInterceptor
Not exactly a controller, but it’s a mechanism provided by Spring MVC to intercept requests before or after they reach the controller. It’s useful for logging, authorization, or modifying requests.
@RequestMapping
An annotation used to map HTTP requests to specific handler methods within a controller class. It allows defining URL patterns and HTTP methods that a controller method can handle.
RestControllerAdvice
An annotation used to define a global advice for REST controllers. It can handle exceptions, apply common processing, or perform actions before or after controller methods.