Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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

Java, Programming

  • Category:- Java
  • Reference No.:- M92677072
  • Price:- $80

Guranteed 48 Hours Delivery, In Price:- $80

Have any Question?


Related Questions in Java

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

Can someone kindly help me to consider whether java

Can someone kindly help me to consider whether Java provides the facility of operator overloading? If it does, may you kindly describe how overloading operators can be accomplished? If not, may you kindly describe why yo ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Assignment - method in our madnessthe emphasis for this

Assignment - "Method in our Madness" The emphasis for this assignment is methods with parameters. In preparation for this assignment, create a folder called Assign_3 for the DrJava projects for the assignment. A Cityscap ...

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As