Git Product home page Git Product logo

documentdb-java-todo-app's Introduction

page_type languages products description urlFragment
sample
java
javascript
azure
The sample code in this Github repository demonstrates how to create a simple application using Java and Azure CosmosDB.
cosmos-java-todo-app

A Simple Todo List Application built w/ Java + Azure CosmosDB

The sample code in this Github repository demonstrates how to create a simple application using Java and Azure CosmosDB.

For a complete end-to-end walkthrough of creating the application, please visit the following Azure documentation page.

My ToDo List Java application

##Requirements Before you begin this application development tutorial, you must have the following:

If you're installing these tools for the first time, coreservlets.com provides a walk-through of the installation process in the Quick Start section of their Tutorial: Installing TomCat7 and Using it with Eclipse article.

##Running the Code Sample

All the samples in this tutorial are included in the cosmos-java-todoapp project on GitHub. To import the todo project into Eclipse, ensure you have the software and resources listed in the Requirements section, then do the following:

  1. Install Project Lombok. Lombok is used to generate constructors, getters, setters in the project. Once you have downloaded the lombok.jar file, double-click it to install it or install it from the command line.
  2. If Eclipse is open, close it and restart it to load Lombok.
  3. In Eclipse, on the File menu, click Import.
  4. In the Import window, click Git, click Projects from Git, and then click Next.
  5. On the Select Repository Source screen, click Clone URI.
  6. On the Source Git Repository screen, in the URI box, enter https://github.com/Azure-Samples/cosmos-java-todoapp.git, and then click Next.
  7. On the Branch Selection screen, ensure that master is selected, and then click Next.
  8. On the Local Destination screen, click Browse to select a folder where the repository can be copied, and then click Next.
  9. On the Select a wizard to use for importing projects screen, ensure that Import existing projects is selected, and then click Next.
  10. On the Import Projects screen, unselect the CosmosDB project, and then click Finish. The CosmosDB project contains the CosmosDB Java SDK, which we will add as a dependency instead.
  11. In Project Explorer, navigate to \src\com.microsoft.azure.cosmos.sample.dao\CosmosClientFactory.java and replace the HOST and MASTER_KEY values with the URI and PRIMARY KEY for your CosmosDB account, and then save the file. For more information, see Step 1. Create a CosmosDB database account.
  12. In Project Explorer, right click the azure-cosmos-java-sample, click Build Path, and then click Configure Build Path.
  13. On the Java Build Path screen, in the right pane, select the Libraries tab, and then click Add External JARs. Navigate to the location of the lombok.jar file, and click Open, and then click OK.
  14. Use step 12 to open the Properties window again, and then in the left pane click Targeted Runtimes.
  15. On the Targeted Runtimes screen, click New, select Apache Tomcat v7.0, and then click OK.
  16. Use step 12 to open the Properties window again, and then in the left pane click Project Facets.
  17. On the Project Facets screen, select Dynamic Web Module and Java, and then click OK.
  18. On the Servers tab at the bottom of the screen, right-click Tomcat v7.0 Server at localhost and then click Add and Remove.
  19. On the Add and Remove window, move azure-cosmos-java-sample to the Configured box, and then click Finish.
  20. In the Server tab, right-click Tomcat v7.0 Server at localhost, and then click Restart.
  21. In a browser, navigate to http://localhost:8080/azure-cosmos-java-sample/ and start adding to your task list. Note that if you changed your default port values, change 8080 to the value you selected.

documentdb-java-todo-app's People

Contributors

acomsmpbot avatar aliuy avatar anfeldma-ms avatar kushagrathapar avatar snehagunda avatar v-hearya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

documentdb-java-todo-app's Issues

Thread safe

Is there a reason for using non-thread safe singleton initialization?

SQL Injection

Stacktrace:

DocDbDao::getDocumentById
  DocDbDao::readTodoItem
    TodoItemController::getTodoItemById

The getDocumentById method uses string concatenation instead of parameterized queries using SqlQuerySpec.

Exploitable via the getTodoItemById API.

The getTodoCollection and getTodoDatabase also uses string concatenation but using constant values.
While this is not exploitable as-is, It sets a bad example in showing developers "how to use cosmos".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.