Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ProcessRequest Method

Tags:

java

servlets

When do ProcessRequest method called?

I am having a hard time why ,what and how the process request is called? why it is called and how it was called by the servlet container.

like image 210
Lego_blocks Avatar asked Jul 14 '14 15:07

Lego_blocks


People also ask

Is servlets start a new process for each request?

Servlets, as written in Java, are platform-independent. Removes the overhead of creating a new process for each request as Servlet doesn't run in a separate process. There is only a single instance that handles all requests concurrently.

Are servlets platform-independent?

Servlets provide a component-based, platform-independent method for building Web-based applications, without the performance limitations of CGI programs. And unlike proprietary server extension mechanisms (such as the Netscape Server API or Apache modules), servlets are server- and platform-independent.

What is Servlet in advance Java?

A servlet is a Java programming language class that is used to extend the capabilities of servers that host applications accessed by means of a request-response programming model. Although servlets can respond to any type of request, they are commonly used to extend the applications hosted by web servers.


1 Answers

The servlet has two important methods for handling the client's request:

1. doPost: in general handles requests coming from forms with post method.

2. doGet: handled requests coming from get method.

Now, ProcessRequest method, is any other method that you can use into your code which is not bound (overridden) to anything.

It is called from the above methods to not complicate the code in them thus the requests are handled in it.

so you can use ProcessRequest to handle your request if and only if it's called from one of the methods above.

like image 188
GingerHead Avatar answered Oct 04 '22 17:10

GingerHead