We can put our file say one.txt in txt folder available in tomcat->webapp folder. Now we can access this file in browser using url as below:
http://localhost:8080/txt/one.txt
I am new in glassfish server. Can anybody please tell me how to do same thing in glssfish server as in tomcat server?
GlassFish has very similar functionality.
There is a default application that serves static content from a domain's docroot defined with Glassfish.
You can do the following to see how it works.
Let's assume that you have installed GlassFish 3.1.2 into a directory named /foo (or C:\FOO) by unzipping one of the distros.
You will be able to create a directory /foo/glassfish3/glassfish/domains/domain1/docroot/txt and put the file one.txt into that directory.
Start domain1 using the command asadmin start-domain domain1
You will then be able to access one.txt via the url http://localhost:8080/txt/one.txt.
By definition a ROOT application is the application that is available under the root url (e.g. http://locahost:8080/) of the server.
The only thing you have to do is to define an application that should be deployed under the root context. How to do this within glassfish can be found here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With