This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

web-inf vs meta-inf  RSS feed

Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to j2ee....
What is the difference between web-inf and meta-inf?
what is the difference between cookies and session? [
Posts: 20766
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Selvakumar. I'm not sure that this is the best place to ask a question like that. You tend to get answers faster and of better quality when you ask them in a forum that's specific to the topic you're interested in.

However, here you are:

It's not "web-inf" and "meta-inf". Although you can often mis-capitalize filenames in Windows, you can't do that on a Unix system. And there are cases even in Windows where it won't work right. So you need to always properly capitalize. I don't like case-sensitive stuff myself, but that's the way they designed it.

Anyway, WEB-INF is the folder just under the root of a WAR that holds information that you don't want to be accessible to a client via a URL request. Specifically, it holds the web.xml, classes, and lib directories, but you can put anything you want to hide from the client there.

META-INF is what discriminates a JAR file from a plain ZIP file. It holds the manifest file and may hold other deployment information as needed.

Since a WAR is a JAR, a WAR will have a META-INF, but obviously a non-web JAR doesn't have any use for WEB-INF.

I'll leave the cookie/session question for someone else.
Posts: 5856
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll take a whack at sessions and cookies.

HTTP is a stateless protocol. What this means is that every time the user makes a request, such as by typing in a URL in the browser's address bar or by clicking a link or button, it is treated by the server as a new request completely unrelated to any prior requests. For static content this is acceptable. For something like an online store this is not acceptable because you often need to make multiple requests to select items and pay for them.

A session is a logical entity meant to identify the start and end of a series of interactions with the application. The application will track the user's usage from the start of the session to the end of the session. How and when to start a session is up to the application. For example, and online store migth start a session when you log in and end the session when you log out or after you complete and order.

There are two common mechanisms used to simulate state, and thus track a session, within the stateless HTTP protocol. One is to provide a session id number and embed that into, for example, a hidden field of the web page. Then when the user clicks a link or button this session id is returned to the application which uses this information to locate the session data for the user. Another mechanism is to provide a "cookie" which is stored by the browser. The browser then returns the cookie to the application on each request.

In addition, a cookie can be stored on the user's PC. That is how application such as the Java Ranch forum can keep you logged in even if you shut down your PC. The cookie stores your account information and Java Ranch uses that to identify you.

I don't see a general web application forum, so I am guessing that this topic might be better for the servlets forum (it was a toss-up between that and jsp), so I am moving it.
[ November 21, 2008: Message edited by: Peter Johnson ]
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perfect explanations.
Thanks a ton guys.
I had never found such detailed explanation on this topic.

They weren't very bright, but they were very, very big. Ad contrast:
how do I do my own kindle-like thing - without amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!