-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3ea2153
Showing
109 changed files
with
2,291 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<project default="compile"> | ||
<path id="libs"> | ||
<fileset dir="lib"> | ||
<include name="*.jar" /> | ||
</fileset> | ||
</path> | ||
<target name="compile"> | ||
<mkdir dir="target"/> | ||
<javac srcdir="src" destdir="target"> | ||
<classpath refid="libs" /> | ||
</javac> | ||
</target> | ||
<target name="run"> | ||
<java classname="uk.ac.bris.cs.databases.web.Server"> | ||
<classpath> | ||
<fileset dir="lib"> | ||
<include name="*.jar" /> | ||
</fileset> | ||
<pathelement path="target" /> | ||
</classpath> | ||
</java> | ||
</target> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Please download and install the following libraries into this folder. | ||
|
||
https://repo1.maven.org/maven2/org/freemarker/freemarker/2.3.23/freemarker-2.3.23.jar | ||
|
||
https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.8.7/jackson-databind-2.8.7.jar | ||
|
||
https://repo1.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/1.5.8/mariadb-java-client-1.5.8.jar | ||
|
||
https://repo1.maven.org/maven2/org/nanohttpd/nanohttpd/2.3.0/nanohttpd-2.3.0.jar | ||
|
||
https://repo1.maven.org/maven2/org/nanohttpd/nanohttpd-nanolets/2.3.0/nanohttpd-nanolets-2.3.0.jar | ||
|
||
https://repo1.maven.org/maven2/net/java/dev/jna/jna/4.3.0/jna-4.3.0.jar | ||
|
||
https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/4.3.0/jna-platform-4.3.0.jar | ||
|
||
--- | ||
|
||
Coursework 2 involves developing the data access layer of a web-based forum application. You can do this either on a lab machine or on your own laptop. | ||
|
||
Please follow the instructions in the PDF file, which are repeated here: | ||
|
||
Download cw2-student.zip and unzip it; this creates a folder cw2-student/. | ||
Go to cw2-student/lib/ and open README.txt; download the libraries indicated into the cw2-student/lib/ folder. | ||
In the cw2-student/ folder, run ant compile. Start the DB VM database as usual (vagrant up, ensure you can log in with mysql) and run ant run from the cw2-student/ folder. | ||
Browse to http://localhost:8000 and you should see "Hello world!" | ||
You are required to submit all files in a single zip on the Blackboard course site. | ||
If you need to re-submit a file, you must resubmit your full zip again, updated appropriately. | ||
|
||
For CS2 support, please use the Unit Forums (Discussion Boards) on BlackBoard, or book an appointment. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
body { | ||
background-color: #eee8d5; /* base2 */ | ||
font-family: sans-serif; | ||
} | ||
|
||
div.menu { | ||
margin-bottom: 1ex; | ||
padding: 1ex; | ||
background-color: #859900; | ||
color: #002b36; | ||
} | ||
|
||
div.menuitem a { | ||
color: #002b36; | ||
} | ||
|
||
h1 { | ||
color: #cb4b16; | ||
} | ||
|
||
div.section { | ||
display: block; | ||
background-color: #fdf6e3; /* base3 */ | ||
color: #2aa198; | ||
padding-top: 0.5ex; | ||
padding-bottom: 0.5ex; | ||
margin: 1ex; | ||
} | ||
|
||
div.section h2 { | ||
padding-left: 1ex; | ||
color: #dc322f; | ||
} | ||
|
||
div.section p { | ||
padding-left: 2ex; | ||
padding-right: 2ex; | ||
} | ||
|
||
div.section a { | ||
color: #6c71c4; | ||
} | ||
|
||
div.outer { | ||
background-color: #073642; /* base02 */ | ||
} | ||
|
||
div.subsection { | ||
margin: 1ex; | ||
padding: 0.25ex; | ||
display: block; | ||
background-color: #fdf6e3; /* base3 */ | ||
color: #859900; | ||
/* border: 1px solid #268bd2; */ | ||
} | ||
|
||
pre { | ||
margin: 1ex; | ||
padding: 1ex; | ||
color: #d33682; | ||
} | ||
|
||
|
||
div.alt { | ||
background-color: #859900; | ||
color: #002b36; | ||
} | ||
|
||
div.alt a { | ||
color: #002b36; | ||
} | ||
|
||
span.key { | ||
width: 12em; | ||
color: #859900; | ||
float: left; | ||
} | ||
|
||
span.login { | ||
float: right; | ||
} | ||
|
||
span.like { | ||
float: right; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<#include "header.html"> | ||
|
||
<h1>Forum: ${data.title}</h1> | ||
|
||
<#list data.topics as t> | ||
<div class="section"> | ||
<p><b><a href="/topic/${t.topicId}">${t.title}</a></b> | ||
</p> | ||
</div> | ||
</#list> | ||
|
||
<div class="section alt"> | ||
<#if session??> | ||
<p><a href="/newtopic/${data.id}">Create new topic</a></p> | ||
<#else> | ||
<p><a href="/people">Log in</a> to create new topics.</p> | ||
</#if> | ||
</div> | ||
|
||
<#include "footer.html"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<#include "header.html"> | ||
|
||
<h1>Forums</h1> | ||
|
||
<#list data.data as forum> | ||
<div class="section"> | ||
<p><b><a href="/forum/${forum.id}">${forum.title}</a></b></p> | ||
</div> | ||
</#list> | ||
|
||
<div class="section alt"> | ||
<p><a href="/newforum">Create new forum</a></p> | ||
</div> | ||
|
||
<#include "footer.html"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<#include "header.html"> | ||
|
||
<h1>Create new forum</h1> | ||
|
||
<div class="section"> | ||
<form method="POST" action="/createforum" enctype="multipart/form-data"> | ||
|
||
<p>Forum name:</p> | ||
<p><input type="text" name="title" size="80" /></p> | ||
|
||
<p><input type="submit" Value="Create"/></p> | ||
</form> | ||
</div> | ||
|
||
<#include "footer.html"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<#include "header.html"> | ||
|
||
<h1>Create new person</h1> | ||
|
||
<div class="section"> | ||
<form method="POST" action="/createperson" enctype="multipart/form-data"> | ||
|
||
<p><span class="key">Name:</span> | ||
<input type="text" name="name" size="40" /></p> | ||
|
||
<p><span class="key">Username:</span> | ||
<input type="text" name="username" size="40" /></p> | ||
|
||
<p><span class="key">Student id:</span> | ||
<input type="text" name="stuid" size="40" /></p> | ||
|
||
<p><span class="key"> </span><input type="submit" Value="Create"/></p> | ||
</form> | ||
</div> | ||
|
||
<#include "footer.html"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<#include "header.html"> | ||
|
||
<h1>Create new post</h1> | ||
|
||
<div class="section"> | ||
<form method="post" action="/createpost"> | ||
|
||
<p><textarea rows="10" cols="80" name="text"></textarea></p> | ||
|
||
<input type="hidden" name="topic" value="${data.topic}" /> | ||
<p><input type="submit" Value="Post"/></p> | ||
</form> | ||
</div> | ||
|
||
<#include "footer.html"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<#include "header.html"> | ||
|
||
<h1>Create new topic</h1> | ||
|
||
<div class="section"> | ||
<form method="post" action="/createtopic"> | ||
<p>Title: </p> | ||
<p><input type="text" name="title" size="80" /></p> | ||
<p>Contents: </p> | ||
<p><textarea rows="10" cols="80" name="text"></textarea></p> | ||
|
||
<input type="hidden" name="forum" value="${data.forum}" /> | ||
<p><input type="submit" Value="Post"/></p> | ||
</form> | ||
</div> | ||
|
||
<#include "footer.html"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<#include "header.html"> | ||
|
||
<h1>List of people</h1> | ||
|
||
<div class="section"> | ||
<#list data.data as p> | ||
<p><span class="key"><a href="/person/${p.key}">${p.value} [${p.key}]</a></span></p> | ||
<p><a href="/login/${p.key}">(log in as ${p.value})</a></p> | ||
</#list> | ||
<p><a href="/login">(log out)</a></p> | ||
</div> | ||
|
||
<div class="section alt"> | ||
<p><a href="/newperson">add person</a></p> | ||
</div> | ||
|
||
<#include "footer.html"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<#include "header.html"> | ||
|
||
<h1>Person: ${data.name}</h1> | ||
|
||
<div class="section"> | ||
<h2>Information</h2> | ||
<div class="grid"> | ||
<div class="col-2"></div> | ||
<div class="col-4">Name</div> | ||
<div class="col-4">${data.name}</div> | ||
<div class="col-2"></div> | ||
</div> | ||
<div class="grid"> | ||
<div class="col-2"></div> | ||
<div class="col-4">Username</div> | ||
<div class="col-4">${data.username}</div> | ||
<div class="col-2"></div> | ||
</div> | ||
<div class="grid"> | ||
<div class="col-2"></div> | ||
<div class="col-4">Student id</div> | ||
<div class="col-4">${data.studentId}</div> | ||
<div class="col-2"></div> | ||
</div> | ||
|
||
</div> | ||
|
||
<#include "footer.html"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<#include "header.html"> | ||
|
||
<h1>Success</h1> | ||
|
||
<div class="section"> | ||
<p>${data.value}</p> | ||
</div> | ||
|
||
<div class="section alt"> | ||
<a href="/forums">Back to main page</a> | ||
</div> | ||
|
||
|
||
<#include "footer.html"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<#include "header.html"> | ||
|
||
<h1>Topic: ${data.title?html}</h1> | ||
|
||
<#list data.posts as p> | ||
<div class="section"> | ||
<p>Post #${p.postNumber} by ${p.author} at ${p.postedAt} | ||
<#if session??> | ||
</#if> | ||
</p> | ||
<pre> | ||
${p.text?html} | ||
</pre> | ||
</div> | ||
</#list> | ||
|
||
<div class="section alt"> | ||
<p> | ||
<#if session??> | ||
<a href="/newpost/${data.topicId}">Reply</a> | ||
<#else> | ||
<a href="/people">Log in</a> to reply. | ||
</#if> | ||
</p> | ||
</div> | ||
|
||
<#include "footer.html"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
</body> | ||
<html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href = "/styles.css"/> | ||
<link rel="stylesheet" href = "/gridlex.css"/> | ||
</head> | ||
<body> | ||
<div class="menu"> | ||
<a href="/forums">Main Page</a> | ||
| ||
<a href="/people">List of people</a> | ||
<span class="login"> | ||
<#if session??> | ||
You are logged in as ${session}. | ||
<#else> | ||
You are not logged in. | ||
</#if> | ||
</span> | ||
</div> | ||
|
Oops, something went wrong.