Websphere Lib
Websphere Lib
#websphere
-liberty
Table of Contents
About 1
Remarks 2
Examples 2
Examples 4
Credits 6
About
You can share this PDF with anyone you feel could benefit from it, downloaded the latest version
from: websphere-liberty
It is an unofficial and free websphere-liberty ebook created for educational purposes. All the
content is extracted from Stack Overflow Documentation, which is written by many hardworking
individuals at Stack Overflow. It is neither affiliated with Stack Overflow nor official websphere-
liberty.
The content is released under Creative Commons BY-SA, and the list of contributors to each
chapter are provided in the credits section at the end of this book. Images may be copyright of
their respective owners unless otherwise specified. All trademarks and registered trademarks are
the property of their respective company owners.
Use the content presented in this book at your own risk; it is not guaranteed to be correct nor
accurate, please send your feedback and corrections to [email protected]
https://riptutorial.com/ 1
Chapter 1: Getting started with websphere-
liberty
Remarks
This section provides an overview of what websphere-liberty is, and why a developer might want
to use it.
It should also mention any large subjects within websphere-liberty, and link out to the related
topics. Since the Documentation for websphere-liberty is new, you may need to create initial
versions of those related topics.
Examples
Installation and Setup
Download:
To set up WebSphere Liberty, download the latest zip from WASdev.net.
Layout:
Once you have the zip, extract it to any location on your file system. The basic layout of a Liberty
install is the following:
wlp/ # WLP_INSTALL_DIR
bin/ # location of scripts such as 'server'
dev/ # developer resources (APIs, SPIs, and tools)
etc/ # global customizations (server.env or jvm.options)
lib/ # platform runtime environment
usr/ # user directory
servers/ # servers directory
server_name # directory containing all information for a given server
server.xml # (required) primary server configuration file
apps/ # server applications folder
dropins/ # server dropin applications folder
logs/ # server log files
Action Command
https://riptutorial.com/ 2
Action Command
https://riptutorial.com/ 3
Chapter 2: Deploying applications to Liberty
Examples
Deploying a simple application on the command line
package web.example;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/*")
public class HelloServlet extends HttpServlet
{
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.getWriter().println("Hello world!");
}
}
helloapp.war
+- META-INF\
+- WEB-INF\
+- web\example\HelloServlet.class
4. Configure your server.xml to know the application and enable the Servlet 3.1 technology:
<server>
<featureManager>
<feature>servlet-3.1</feature>
</featureManager>
<application location="helloapp.war"/>
</server>
https://riptutorial.com/ 4
5. Start the server:
6. Check the console.log to verify that the application started, and what URL to find it at:
Hello world!
https://riptutorial.com/ 5
Credits
S.
Chapters Contributors
No
Deploying
2 applications to Andy Guibert, Azquelt
Liberty
https://riptutorial.com/ 6