We have used the Digital Toys Inc. web application for explaining the examples in this book. We describe setting up this web application in this chapter.
Running Digital Toys Web Application
Clone the GitHub repository1 or download it as a .zip from the URL.
After extracting the .zip in some location on your machine and listing the files in the extracted folder, you will find these files.
jetty-runner.jar
dt-1.0.war
startDt.sh
startDt.bat
Use .bat if you are using Windows environment, otherwise use .sh.
Note
Make sure that you have JDK 8.0 installed on your machine. The Digital Toys Inc. web application has been complied using JDK 8.0 .
Start the Web Application
Enter the following command in the Windows command prompt.
C:>startDt.bat
C:>java -jar jetty-runner.jar dt-1.0.war
2017-05-15 10:53:10.005:INFO::main: Logging initialized @872ms
2017-05-15 10:53:10.045:INFO:oejr.Runner:main: Runner
2017-05-15 10:53:10.584:INFO:oejs.Server:main: jetty-9.3.7.v20160115
2017-05-15 10:53:52.719:INFO:/:main: No Spring WebApplicationInitializer types detected on classpath
SESSION_IN_URL not specified.
2017-05-15 10:53:57.182:INFO:/:main: Initializing Spring root WebApplicationContext
SESSION_IN_URL not specified.
Populating states
State: [Alabama, AL] -- Alabama and AL
State: [Alaska, AK] -- Alaska and AK
State: [Arizona, AZ] -- Arizona and AZ
State: [Arkansas, AR] -- Arkansas and AR
State: [California, CA] -- California and CA
State: [Colorado, CO] -- Colorado and CO
State: [Connecticut, CT] -- Connecticut and CT
State: [Delaware, DE] -- Delaware and DE
State: [Florida, FL] -- Florida and FL
State: [Georgia, GA] -- Georgia and GA
State: [Hawaii, HI] -- Hawaii and HI
State: [Idaho, ID] -- Idaho and ID
State: [Illinois, IL] -- Illinois and IL
State: [Indiana, IN] -- Indiana and IN
State: [Iowa, IA] -- Iowa and IA
State: [Kansas, KS] -- Kansas and KS
State: [Kentucky, KY] -- Kentucky and KY
State: [Louisiana, LA] -- Louisiana and LA
State: [Maine, ME] -- Maine and ME
State: [Maryland, MD] -- Maryland and MD
State: [Massachusetts, MA] -- Massachusetts and MA
State: [Michigan, MI] -- Michigan and MI
State: [Minnesota, MN] -- Minnesota and MN
State: [Mississippi, MS] -- Mississippi and MS
State: [Missouri, MO] -- Missouri and MO
State: [Montana, MT] -- Montana and MT
State: [Nebraska, NE] -- Nebraska and NE
State: [Nevada, NV] -- Nevada and NV
State: [New Hampshire, NH] -- New Hampshire and NH
State: [New Jersey, NJ] -- New Jersey and NJ
State: [New Mexico, NM] -- New Mexico and NM
State: [New York, NY] -- New York and NY
State: [North Carolina, NC] -- North Carolina and NC
State: [North Dakota, ND] -- North Dakota and ND
State: [Ohio, OH] -- Ohio and OH
State: [Oklahoma, OK] -- Oklahoma and OK
State: [Oregon, OR] -- Oregon and OR
State: [Pennsylvania, PA] -- Pennsylvania and PA
State: [Rhode Island, RI] -- Rhode Island and RI
State: [South Carolina, SC] -- South Carolina and SC
State: [South Dakota, SD] -- South Dakota and SD
State: [Tennessee, TN] -- Tennessee and TN
State: [Texas, TX] -- Texas and TX
State: [Utah, UT] -- Utah and UT
State: [Vermont, VT] -- Vermont and VT
State: [Virginia, VA] -- Virginia and VA
State: [Washington, WA] -- Washington and WA
State: [West Virginia, WV] -- West Virginia and WV
State: [Wisconsin, WI] -- Wisconsin and WI
State: [Wyoming, WY] -- Wyoming and WY
Populating products
2017-05-15 10:54:32.277:INFO:/:main: Initializing Spring FrameworkServlet 'grails'
2017-05-15 10:54:33.567:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@707f7052{/,file:///C:/Users/jjain/AppData/Local/Temp/je
tty-0.0.0.0-8080-dt-1.0.war-_-any-2712378741143744577.dir/webapp/,AVAILABLE}{..}
2017-05-15 10:54:33.751:INFO:oejs.ServerConnector:main: Started ServerConnector@3a2a56f6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2017-05-15 10:54:33.759:INFO:oejs.Server:main: Started @84653ms
If you want to start the Digital Toys Inc. web application on a different port, enter this command in the CMD prompt:
C:>java -jar jetty-runner.jar --port 7070 dt-1.0.war
2017-05-21 17:14:10.317:INFO::main: Logging initialized @387ms
2017-05-21 17:14:10.347:INFO:oejr.Runner:main: Runner
2017-05-21 17:14:10.657:INFO:oejs.Server:main: jetty-9.3.7.v20160115
2017-05-21 17:14:27.002:INFO:/:main: No Spring WebApplicationInitializer types detected on classpath
SESSION_IN_URL not specified.
2017-05-21 17:14:28.094:INFO:/:main: Initializing Spring root WebApplicationContext
SESSION_IN_URL not specified.
Populating products
2017-05-21 17:14:44.414:INFO:/:main: Initializing Spring FrameworkServlet 'grails'
2017-05-21 17:14:45.304:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@707f7052{/,file:///C:/Users/jjain/A
ppData/Local/Temp/jetty-0.0.0.0-7070-dt-1.0.war-_-any-5504021582514241800.dir/webapp/,AVAILABLE}{..}
2017-05-21 17:14:45.344:INFO:oejs.ServerConnector:main: Started ServerConnector@6d035815{HTTP/1.1,[http/1.1]}{0.0.0.0:70 70}
2017-05-21 17:14:45.344:INFO:oejs.Server:main: Started @35417ms
Found 108 products
Open the browser and launch http://localhost:8080/dt. A home page will be shown as the landing page of the Digital Toys Inc. web application (see Figure 14-1).
Figure 14-1. Digital Toys landing page
Start with URL Rewriting Enabled
Enter the following command in the CMD prompt :
C:>set SESSION_IN_URL=true
C:>startDt.bat
C:>java -jar jetty-runner.jar dt-1.0.war
2017-05-15 11:15:53.013:INFO::main: Logging initialized @518ms
2017-05-15 11:15:53.036:INFO:oejr.Runner:main: Runner
2017-05-15 11:15:53.358:INFO:oejs.Server:main: jetty-9.3.7.v20160115
2017-05-15 11:16:16.901:INFO:/:main: No Spring WebApplicationInitializer types detected on classpath
SESSION_IN_URL specified in environment - enabling session in URL if cookies are not enabled.
2017-05-15 11:16:19.121:INFO:/:main: Initializing Spring root WebApplicationContext
SESSION_IN_URL specified in environment - enabling session in URL if cookies are not enabled.
Populating products
2017-05-15 11:16:51.178:INFO:/:main: Initializing Spring FrameworkServlet 'grails'
2017-05-15 11:16:52.225:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@707f7052{/,file:///C:/Users/jjain/AppData/Local/Temp/je
tty-0.0.0.0-8080-dt-1.0.war-_-any-4592381167383482346.dir/webapp/,AVAILABLE}{..}
2017-05-15 11:16:52.266:INFO:oejs.ServerConnector:main: Started ServerConnector@552fffc8{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2017-05-15 11:16:52.268:INFO:oejs.Server:main: Started @59776ms
Tip
Rev This is required for running the preprocessors test plan.
Clean Up
After jetty-runner has started, it will create two files.
Open the CMD prompt and execute the following command:
C:>dir prodDb*
Volume in drive C has no label.
Volume Serial Number is DA32-01EE
Directory of C:
05/15/2017 11:17 AM 124,928 prodDb.h2.db
05/15/2017 11:16 AM 24,033 prodDb.trace.db
2 File(s) 148,961 bytes
0 Dir(s) 7,259,287,552 bytes free
C:>
These files save data. They are useful for deleting files before starting with a fresh chapter .