Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What exactly is the web-app version? What does it affect?

In a java web application, there is a file called web.xml and it has a versioning.

What exactly is this? What is it used for?

Here is the SO wiki for web.xml. But it does not really explain me much.

It allows you to define, declare and configure the Servlet API based implementations in your web application, such as servlets, filters and listeners.

Sample web.xml versioning:

<web-app xmlns="http://java.sun.com/xml/ns/javaee"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"          version="3.0"> 

Can someone explain this with simple examples perhaps?

like image 378
Koray Tugay Avatar asked Apr 13 '13 07:04

Koray Tugay


People also ask

What is web version of an app?

A web application (or web app) is application software that runs in a web browser, unlike software programs that run locally and natively on the operating system (OS) of the device. Web applications are delivered on the World Wide Web to users with an active network connection.

What is web application web apps and its benefits?

A Web application (Web app) is an application program that is stored on a remote server and delivered over the Internet through a browser interface. Web services are Web apps by definition and many, although not all, websites contain Web apps.

What do web apps do?

In computer system, a web application is a client-side and server-side software application in which the client runs or request in a web browser. Common web applications include email, online retail sales, online auctions, wikis, instant messaging services and more.


1 Answers

Web.xml is a central place where you define the configuration of your Web application. For instance you can specify there:

  • servlet mapping, i.e. which URL path refers to which Java class (e.g. when user types http://something.com/Koray you can point that request to KorayServlet.java class where you keep the implementation of the servlet)
  • authorization parameters, e.g. that user Tugay has access to http://something.com/Koray/pictures, but not to http://something.com/Koray/documents
  • all other security settings, e.g. when someone tries to open http://something.com/Restricted, you redirect him to https://something.com/Restricted, i.e. it has to use SSL
  • welcome page of your Web site (e.g. when user types http://something.com/Koray you redirect him to http://something.com/Koray/index.html)

I would also suggest researching Servlet 3.0 specification, where many of these parameters can be set through annotations.

Versioning

Versioning refers to XML schema version that syntax of your web.xml file must obey. More important, it also indicates the version of Servlet specification that your application implements. An example how Servlet 3.0-compliant web.xml should begin:

<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> 

Most IDEs will automatically generate that part of web.xml. If you are going to change it manually for some reason, be careful to match the versions of web-app and xsd.

For concrete examples of web.xml, see:

  • web.xml Versioning
  • The deployment descriptor: web.xml
  • Sample Web XML application files
like image 170
Miljen Mikic Avatar answered Sep 28 '22 10:09

Miljen Mikic