Sem 6‎ > ‎ADV JAVA LAB‎ > ‎

Random info

posted Apr 28, 2013, 9:14 AM by Neil Mathew   [ updated Apr 28, 2013, 10:13 AM by Neil Mathew ]

Marshaling and serialization are loosely synonymous in the context of remote procedure call, but semantically different as a matter of intent.

In particular, marshaling is about getting parameters from here to there, while serialization is about copying structured data to or from a primitive form such as a byte stream. In this sense, serialization is one means to perform marshaling, usually implementing pass-by-value semantics.

Difference b/w Marshalling and Unmarshalling

1. Convert paramaters into byte stream (suitable format for transmission) / reverse of marhalling

2. Serialization / Deserialization

3. Skeleton marshalls the result / Stub unmarshalls the result

JDBC code for create tables:

Difference b/w CGI (Common Gateway Interface) 

1.CGI are usually executables that are native to the server’s operating system, though servlets can also be compiled to the native OS it can be compiled to Java bytecode which is then run on a JVM
2.CGI programs are platform dependent while servlets are platform independent
3.CGI programs run as separate processes on the computer while servlets run on the JVM
4.CGI can be more vulnerable to attacks than servlets (security)
5.CGI can directly process scripts while it needs to be translated and compiled to before it can be run as a servlet
6. CGI is more expensive than Servlets.

Servlets can link directly to the Web server. CGI cannot directly link to Web server.
Servlets can share data among each other. CGI does not provide sharing property.
Servlets can perform session tracking and caching of previous computations. CGI cannot perform session tracking and caching of previous computations.
Servlets are portable. CGI is not portable.
In Servlets, the Java Virtual Machine stays up, and each request is handled by a lightweight Java thread. In CGI, each request is handled by a heavyweight operating system process.

Uses of Servlets

  • Process or store data that was submitted from an HTML form

  • Provide dynamic content such as the results of a database query

  • Manage state information that does not exist in the stateless HTTP protocol, such as filling the articles into the shopping cart of the appropriate customer

  • A Servlet can handle multiple request concurrently and be used to develop high performance system.