Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Jetty WTP Plugin/Jetty WTP Dynamic Web Project"
(New page: {{Jetty}}) |
|||
Line 1: | Line 1: | ||
− | {{Jetty}} | + | {{Jetty}} |
+ | |||
+ | === Dynamic Web Project === | ||
+ | |||
+ | == Step 1 == | ||
+ | |||
+ | To create a Dynamic WTP Project, go at File/New/Other... and select Web/Dynamic Web Project node : | ||
+ | |||
+ | [[Image:Jetty-wtp-project1.jpg]] | ||
+ | |||
+ | == Step 2 == | ||
+ | |||
+ | [[Image:Jetty-wtp-project2.jpg]] | ||
+ | |||
+ | == Step 3 == | ||
+ | |||
+ | Click on Finish button, The WTP Dynamic Web Project is created and you can use JAR from the Jetty install with the Jetty v7.0 library which was created : | ||
+ | |||
+ | [[Image:Jetty-wtp-project3.jpg]] | ||
+ | |||
+ | == Step 4 == | ||
+ | |||
+ | Create WebContent/index.htm like this : | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||
+ | <html> | ||
+ | <head> | ||
+ | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | ||
+ | <title>My first WEB Application</title> | ||
+ | </head> | ||
+ | <body> | ||
+ | My first WEB Application. | ||
+ | </body> | ||
+ | </html> | ||
+ | </source> | ||
+ | |||
+ | [[Image:Jetty-wtp-project4.jpg]] | ||
+ | |||
+ | <br> Drag and drop the project mywebapp to the launch Jetty v7.0 Server at localhost-config : | ||
+ | |||
+ | [[Image:Jetty-wtp-project5.jpg]] | ||
+ | |||
+ | <br> You can start/stop the Jetty server : | ||
+ | |||
+ | [[Image:Jetty-wtp-project6.jpg]] | ||
+ | |||
+ | You can start the Jetty server, you will see in the console some Jetty logs : | ||
+ | |||
+ | [[Image:Jetty-wtp-project7.jpg]] | ||
+ | |||
+ | <pre> | ||
+ | 2010-10-01 08:34:09.390:INFO::jetty-7.1.6.v20100715 | ||
+ | 2010-10-01 08:34:09.421:INFO::Deployment monitor D:\_Projets\Personal\runtime-EclipseApplication-Jetty-Demo\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\contexts at interval 5 | ||
+ | 2010-10-01 08:34:09.421:INFO::Deployable added: D:\_Projets\Personal\runtime-EclipseApplication-Jetty-Demo\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\contexts\mywebapp.xml | ||
+ | 2010-10-01 08:34:09.734:INFO::Deployment monitor D:\_Projets\Personal\runtime-EclipseApplication-Jetty-Demo\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps at interval 5 | ||
+ | 2010-10-01 08:34:09.765:INFO::Started SelectChannelConnector@0.0.0.0:8080 | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | |||
+ | You can notice that | ||
+ | * Jetty deploy mywebapp by using file mywebapp.xml (which configure org.eclipse.jetty.webapp.WebAppContext and it is generated with the WTP Jetty Adaptor). | ||
+ | * mywebapp.xml is stored in YOUR_WORKSPACE/.metadata\.plugins\org.eclipse.wst.server.core\tmp0\contextsfolder (your metdata). When you modify the file YOUR_WORKSPACE /mywebapp/index.htm (from your Eclipse project), the WTP Adaptor publish it to the OUR_WORKSPACE/.metadata\.plugins\org.eclipse.wst.server.core\tmp0/wtpwebapps\mywebapp folder. | ||
+ | * Port used is 8080. If you wish modify the port, please read How modify port? | ||
+ | |||
+ | |||
+ | Go at http://localhost:8080/mywebapp/ | ||
+ | |||
+ | [[Image:Jetty-wtp-project8.jpg]] | ||
+ | |||
+ | You will see the index.htm content. You can create a Servlet and debug it (I have testes it works). |
Revision as of 13:38, 17 November 2010
Dynamic Web Project
Step 1
To create a Dynamic WTP Project, go at File/New/Other... and select Web/Dynamic Web Project node :
Step 2
Step 3
Click on Finish button, The WTP Dynamic Web Project is created and you can use JAR from the Jetty install with the Jetty v7.0 library which was created :
Step 4
Create WebContent/index.htm like this :
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>My first WEB Application</title> </head> <body> My first WEB Application. </body> </html>
Drag and drop the project mywebapp to the launch Jetty v7.0 Server at localhost-config :
You can start/stop the Jetty server :
You can start the Jetty server, you will see in the console some Jetty logs :
2010-10-01 08:34:09.390:INFO::jetty-7.1.6.v20100715 2010-10-01 08:34:09.421:INFO::Deployment monitor D:\_Projets\Personal\runtime-EclipseApplication-Jetty-Demo\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\contexts at interval 5 2010-10-01 08:34:09.421:INFO::Deployable added: D:\_Projets\Personal\runtime-EclipseApplication-Jetty-Demo\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\contexts\mywebapp.xml 2010-10-01 08:34:09.734:INFO::Deployment monitor D:\_Projets\Personal\runtime-EclipseApplication-Jetty-Demo\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps at interval 5 2010-10-01 08:34:09.765:INFO::Started SelectChannelConnector@0.0.0.0:8080
You can notice that
- Jetty deploy mywebapp by using file mywebapp.xml (which configure org.eclipse.jetty.webapp.WebAppContext and it is generated with the WTP Jetty Adaptor).
- mywebapp.xml is stored in YOUR_WORKSPACE/.metadata\.plugins\org.eclipse.wst.server.core\tmp0\contextsfolder (your metdata). When you modify the file YOUR_WORKSPACE /mywebapp/index.htm (from your Eclipse project), the WTP Adaptor publish it to the OUR_WORKSPACE/.metadata\.plugins\org.eclipse.wst.server.core\tmp0/wtpwebapps\mywebapp folder.
- Port used is 8080. If you wish modify the port, please read How modify port?
Go at http://localhost:8080/mywebapp/
You will see the index.htm content. You can create a Servlet and debug it (I have testes it works).