Skip to content

HW4

Overview

You will be creating a Web server with SparkJava!

Day Date Time
Release Wed Feb 26, 2020 11:00 PM
Due Wed Mar 4, 2020 11:00 AM

Task

Head to HW04 Starter Code and download the repository. The repository is public so you should not have any issues to access it.

Once downloaded, open the oose_hw4_starter folder as a Gradle project in IntelliJ.

The provided Java application is built on our classwork (Web application for CourseReVU app). There are several TODO placed in the code that indicates what you need to do.

Read the readings first, please!

It is strongly advisable that you read the readings for lecture 7 before starting this homework.

The provided starter code is (deliberately) different from what we had done in class. The goal is to implement a Web server using SparkJava.

Expected behavior of the app

When you run the application, it must load a homepage similar to the one in the image below. Note there is only a form for signing in.

After you have signed in, the homepage must change to the following view.

If user clicks on Courses, they will be redirected to courses page which looks like the image below. Note that each course is a link that opens up the reviews page for that course.

A user must be able to add a new course by filling out and submitting the form as shown in the images below.

The newly added course must be shown in the list as soon as the user hits submit.

When you click on a course, you will be redirected to the reviews for that course. The route (URL) must be something like localhost/courses/2/reviews where 2 is the course ID of the course user had clicked on.

A user must be able to add a new review by filling out and submitting the form as shown in the images below.

The newly added review must be shown in the list as soon as the user hits submit.

Looking back at the homepage:

If a user clicks on the "sign out" link, they must be signed out and presented with the sign-in view.

If a user has not signed in, and they want to get around the signing in by directly accessing the courses or reviews pages (e.g. by going to localhost/courses), they must be redirected to the homepage (so that they are not able to see anything until they sign in).

Tip

To implement the last feature, consult the SparkJava Docs; check out how you can use filters.

Submission

You must create a zip file containing the following files and folders (and all files and folders therein):

1
2
3
4
5
6
.
├── build.gradle
├── gradlew
├── gradlew.bat
├── settings.gradle
└── src

Note

Make sure there is no extra top-level directory that your src folder and (Gradle related) files are inside of.

Submit to Gradescope

  • In the course Dashboard, you will see an assignment: HW04.

  • Submit your work by uploading the zip file.

Because this is a group assignment, you must indicate all students who worked on it, in the submission page. The last submission by any group member is the only one we will grade.

Note

You can resubmit any time up until the deadline. Only your most recent submission will be graded.