CS6320:  SW Engineering of Web Based Systems

 

Google App Engine: Eclipse Plugin

 

1) Create Project (File->New Project->Google App Engine StandardProject OR File->New->Other->Google Cloud Platform->Google App Engine Standard Java Project)

 

 

The result will be the following pop-up window


You need to give

  • Project Name

  • Package (come up with a good naming structure for yourself...I use grewe.applicationDomain.projectname or whatever)

  • place it where you want

 

The result will be a directory structure like the following

Note: we have created a project called "MyFirstGAEApplication"

  • package = grewe.ilab.com

  • src has the created servlet = HelloWorld.java

  • war/WEB-INF/web.xml and apengine-web.xml = the xml configuration files



 

 

web.xml file that was autogenerated- can edit in design or source

 

<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

Notice that the URL mappings have already been set up and instead of being in the web.xml file are associated with the Project under

 

When create a new servlet it will ask you for mappings and set this in the project...for example:

 

1) New Servlet

AFTER naming it



NOW we setup in NEXT window the mappings

NOW you have the mappings setup (and ofcourse the beginning java file)



appengine-web.xml file that was autogenerated

basically this says we are runing an application using java8. This is where you can also control behaviors
like static files and sessions (see your book and later materials)

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">

<threadsafe>true</threadsafe>
<sessions-enabled>false</sessions-enabled>
<runtime>java8</runtime>

</appengine-web-app>


OpenCVBackendJavaServlet.java auotogenerated file

 

package grewe.ilab.vision;
import java.io.IOException;
import javax.servlet.http.*;
@SuppressWarnings("serial")
     public class OpenCVBackendJavaServlet extends HttpServlet {
         public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         resp.setContentType("text/plain");
         resp.getWriter().println("Hello, world");
     }
 }
           

 

 

 

 

2) Edit Code in Project, create new classes,etc. as desired

 

 

3) Run the Project locally (right_click project folder->Run as ->can also do Debug As)


Will start the webapp locally at either http://localhost:8080 or http://localhost:8888

 

 

 

© Lynne Grewe