CS6320:  SW Engineering of Web Based Systems

 

Google App Engine --- Java App --- Files and more

 

AppID and URL on GAE (not running locally)

Right click on Project ->Run->Run As-> GAE Server

Every app gets a free domain name on appspot.com, based on the application ID:

app-id.appspot.com
Requests for URLs that use your domain name are routed to your app by the frontend.
http://app-id.appspot.com/url/path...


Setup AppID --register in GAE dashboard and update appengine-web.xml file

STEP 1: Create App using GAE admin console "Create App" --- below I show you the details for an App that I created for testing. Note it has id = buzz-it adn its url is http://buzz-it.appspot.com

app details

 

 

 

STEP 2: The app ID and version identifier of a Java app appear in the appengine-web.xml file.
The app ID is specified with the XML element <application>, and the version identifier
is specified with <version>. For example:

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


http://dev.latest.ae-book.appspot.com <<<< this is the dev version

 

 

another appengine-web.xml example:

GAE descriptor file

 

 

 

NOTE: you can have up to 10 versions for an app (check current documentation for changes on this)

  • You can delete previous versions using the Administration Console.
    Application IDs and version identifiers can contain numbers, lowercase letters, and
    hyphens.

 



 

IMPORTANT: unlike normal webapps you will be using a web.xml file for Google App Engine        

resulting file

The web.xml file (Web App deployment -- standard Java WebApp prior to annotations like @WebServlet)

<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
         http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<servlet>

     <servlet-name>GAE_GuestBook</servlet-name>
     <servlet-class>grewe.gae.guestbook.GAE_GuestBookServlet</servlet-class>
</servlet>

<servlet-mapping>
     <servlet-name>GAE_GuestBook</servlet-name>
     <url-pattern>/gae_guestbook</url-pattern>
</servlet-mapping>

<servlet>
     <servlet-name>GAE_GuestBookJSP</servlet-name>
     <jsp-file>guestbook.jsp</jsp-file>
</servlet>

<servlet-mapping>
     <servlet-name>GAE_GuestBookJSP</servlet-name>
     <url-pattern>/gae_guestbookJSP</url-pattern>
</servlet-mapping>

<welcome-file-list>
     <welcome-file>guestbook.jsp</welcome-file>
</welcome-file-list>
</web-app>

      

In the above I mapped the jsp to the /gae_guestbookJSP url and also it is the welcome file
this means you can invoke it as http://localhost:8888/gae_guestbookJSP OR http://localhost:8888/guestbook.jsp

Result of the above running --note that the JPS file comes up as it is
the welcome file in the web.xml file

jsp running

 

 

 

 

© Lynne Grewe