Convert Netbeans project into a Maven Netbeans project

Assignment Help JAVA Programming
Reference no: EM131848713

Assignment - Using the code in the folder and continue this exercise.

Deploying Jackson with Maven

Step 1: Install Maven

1. Open Netbeans

2. Tools -> Plugins

a. If Maven is under Installed, make sure it is "Activated"

b. Else, find Maven in Available Plugins and click Install

Step 2: Convert your Netbeans project into a Maven Netbeans project

1. Create a new Maven Project (File->New Project->Maven->Java Application)

2. Copy your packages from your old project to the new project

Step 3: Add Jackson as a dependency to your Maven Netbeans project

1. Right click the Dependencies Folder

2. Search for Jackson (you may have to wait awhile as Maven loads its repos for the first time)

3. Choose jackson-annotations, jackson-core, and jackson-databind

4. Right click on your project and click build with dependencies

Step 4: Look up how to actually use Jackson!

1. Jackson's home-page

2. Main documentation page

3. Core JavaDoc page

4. If that doesn't have what you need, looking around on that github page or github.io is a good way to approach learning how to use a new project!

Exercise:

Exercise Part A: Copy the following content into a new file inside a new folder named "public" inside your NetBeans project. Name the file "index.html".

Now, add a new view to your project that loads any file with a given name from inside the "public" directory. Add a static method that checks if some file exists inside that directory. In your controller (which decides which view to serve), you already know how to serve "/ address" and "/list" URL locations. Right now, any other location results in a 404 error. Change this so that it checks, using the new view class, if a file could be served with the name given in the location. For example, if the location "/favicon.ico" is requested, we should check if we have a file "public/favicon.ico", and if so, we should create a view that serves this file. Write the view so it loads the file and serves it.

OK, Let's serve an image.

Now, let's try to do this with a "PNG" or "JPEG" image. Download an image - any image - from the web, store it in your public folder, and try to retrieve it. This may not work perfectly, or not in all browsers. Remember that the HTTP protocol demands we declare the type of data that is being sent: Content-type: text/html. Look up what to declare for PNG and change your code accordingly.

Also, remember that the way you load a text file is different from a binary file (images are binary files). You don't load those line by line. Look up how to load a binary file in Java and store it in a string. That may make your code better.

Exercise Part B: Part B will be a very simple extension / replacement of what you've already done. Ensure your webserver program has the following (some are carry-overs from previous exercises):

1. A method serializeAsJSON that, using the Jackson library, takes an AddressModel as an argument and returns an object from the Jackson library that encodes a JSON

2. A static method deserializeJSON that takes an object encoding a JSON and returns an AddressModel

3. A method serializeAsJSON that takes an AddressListModel as an argument and returns an object from the Jackson library

4. A static method deserializeJSON that takes an object from the Jackson library and returns an AddressListModel

5. A method saveJSONToFile that takes the object from the Jackson library used to encode the AddressListModel and a File object and then writes to a file for persistency

6. A method called readJSONFromFile that takes the File object and returns an AddressListModel

7. A view AddressListDataView that takes and displays the raw data of your own serialized output (i.e., the same thing that's in the text file)

8. A view AddressListJSONView that takes and displays the JSON data produced by Jackson (i.e., what you'll be writing to that text file)

9. A view AddressListTableView that takes an AddressModel and formats it into a table.

Attachment:- Assignment Files.rar

Reference no: EM131848713

Questions Cloud

Draft a position statement to a state legislator : In general, is the person identified in the order is under correctional supervision? Would that change your recommendations for improving the law?
Expect the demand to be more price elastic : Consider the following pairs of goods. For which of the two goods would you expect the demand to be more price elastic? Why?
Aggregate supply curve has its usual upward slope : Assume the tax multiplier is estimated to be 1.9 and the aggregate supply curve has its usual upward slope. Suppose the government lowers taxes by $150 million.
What role does a human service worker play in this process : How would the role of the human service worker change if the child is already involved in the juvenile justice system?
Convert Netbeans project into a Maven Netbeans project : Convert your Netbeans project into a Maven Netbeans project - Create a new Maven Project (File->New Project->Maven->Java Application)
Price elasticity of demand : 1. If the price elasticity of demand is equal to 1, then demand is unit elastic. T/ F
Discuss how intel changed ingredient-marketing history : Discuss how Intel changed ingredient-marketing history. What did it do so well in those initial marketing campaigns?
Data on and compute a consumer price index : Suppose you work for a national statistical agency and are asked to set up a program to collect data on and compute a consumer price index.
Identify two interventions that will help your patient : Identify two interventions that will help your patient with myasthenia gravis or Guillain-Barre syndrome reach the outcome for the nursing diagnosis.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd