answersLogoWhite

0

How does Apache httpd work?

Updated: 10/3/2023
User Avatar

Wiki User

14y ago

Best Answer

Tomcat is a servlet container, and the following is how a servlet container works

The init, service, and destroy methods are the servlet's lifecycle methods. The init method is called once by the servlet container after the servlet class has been instantiated to indicate to the servlet that it being placed into service. The init method must complete successfully before the servlet can receive any requests. A servlet programmer can override this method to write initialization code that needs to run only once, such as loading a database driver, initializing values, and so on. In other cases, this method is normally left blank.

The service method is then called by the servlet container to allow the servlet to respond to a request. The servlet container passes a javax.servlet.ServletRequest object and a javax.servlet.ServletResponse object. The ServletRequest object contains the client's HTTP request information and the ServletResponse encapsulates the servlet's response. These two objects enable you to write custom code that determines how the servlet services the client request.

The servlet container calls the destroy method before removing a servlet instance from service. This normally happens when the servlet container is shut down or when the servlet container needs some free memory. This method is called only after all threads within the servlet's service method have exited or after a timeout period has passed. After the servlet container calls destroy, it will not call the service method again on this servlet. The destroy method gives the servlet an opportunity to clean up any resources that are being held (for example, memory, file handles, and threads) and make sure that any persistent state is synchronized with the servlet's current state in memory.

For Better Picture, Visit below article full of images to clear the concept :

http://shivasoft.in/blog/java/servlet/how-container-handles-the-servlet-request/

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

it will not work

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How does Apache httpd work?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is Apache's first open source project?

Apache httpd Project (Apache Http Web Server)


How do you find version of apache?

httpd -v or on Ubuntu apache2 -v


How do you find Apache version?

httpd -v or on Ubuntu apache2 -v


How does a web server determine whether a requested document includes PHP code?

Web server passes the requested document to PHP interpreter, which validates and processes PHP code in it, then the server reads the response from PHP interpreter and returns the resulting response to client.For an instance, Apache HTTPD uses instructions such as AddType, to know how to process various documents, basing on their extensions (the following example is common and may require changes depending on Apache HTTPD and PHP configuration):AddType application/x-httpd-php .php .p8p .txtThis directive instructs Apache HTTPD to let PHP process files which are suffixed with .php, .p8p or .txt, thus files such as index.php, Homepage.p8p and Settings.txt will be processed by PHP.


When was CERN httpd created?

CERN httpd was created on 1990-12-24.


Difference between apache and http server?

"Apache" is the name of a foundation that write open-source software. Apache HTTPD is a web server written in portable C (when people say "Apache", they usually mean Apache HTTPD.) It mostly serves static content by itself, but there are many add-on modules (some of which come with Apache itself) that let it modify the content and also serve dynamic content written in Perl, PHP, Python, Ruby, or other languages. Tomcat is primarily a servlet/JSP container. It's written in Java. It can serve static content, too, but its main purpose is to host servlets and JSPs. Although it's possible to get Tomcat to run Perl scripts and the like, you wouldn't use Tomcat unless most of your content was Java. "Apache" is the name of a foundation that write open-source software. Apache HTTPD is a web server written in portable C (when people say "Apache", they usually mean Apache HTTPD.) It mostly serves static content by itself, but there are many add-on modules (some of which come with Apache itself) that let it modify the content and also serve dynamic content written in Perl, PHP, Python, Ruby, or other languages. Tomcat is primarily a servlet/JSP container. It's written in Java. It can serve static content, too, but its main purpose is to host servlets and JSPs. Although it's possible to get Tomcat to run Perl scripts and the like, you wouldn't use Tomcat unless most of your content was Java.


How does Apache work?

it will not work


What line is added to the Apache configuration file to ensure that PHP extensions are recognized?

Adding the following lines to the Apache 2.x configuration file will associate .php files with PHP, given the PHP 5 module (DLL file) is also loaded through the configuration: <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch>


What is the full form of httpd?

Hyper Text Transfer Protocol Daemon


Which command starts the httpd daemon authomatically?

apachectl start will do the job !


How do you uninstall programs in Linux?

First, open terminal (bash prompt). You must be login as root user to run any one of the following command. Remove Software under Red Hat / RHEL / Fedora / CentOS Linux Use rpm or yum command to delete the software. To list the installed software type rpm -qa | less rpm -qa {software-name} yum list | less yum list {software-name} To get information about httpd package, enter: rpm -qa httpd yum list httpd To remove a software use rpm or yum command as follows rpm -e {software-name} yum remove {software-name} To delete a package called httpd, enter: rpm -e httpd yum remove httpd Delete / Uninstall Software Under Debian / Ubuntu Linux To list installed software type: dpkg --list dpkg --list | less dpkg --list | grep apache To delete the software, enter: sudo apt-get remove {package-name} sudo apt-get remove apache


What is meant by .phtml?

Some people choose to run their PHP files via the .phtml extension. Web servers, such as apache, allow us to define our own extensions. For apache, you'll have to load httpd.conf and find/edit a line in similar fashion to : AddType application/x-httpd-php .php .php3 .phtml .foo : It means that PHP will parse .php .php3 .phtml and .foo files on this server.