Code Monkey home page Code Monkey logo

rest-samples's Introduction

REST samples

This project tries provide simple and advanced examples on how to provide and consume rest services.

General ideas about this project:

  • Start simple
  • introduce concepts one by one
  • provide them well documented
  • provide something to try out
  • show how automatic testing can work here
  • target environment should be JBoss 7 for a start
  • we will use RESTEasy for the moment as it is bundled with JBoss 7

How to run this sample

Please install Apache Maven version 3.0.4 or later. Then you can start the project by using the following maven target:

mvn -DskipTests=true jboss-as:run

This will download all necessary artefacts to run this project, including JBoss 7. Afterwards you can access the project in your browser you your favourite REST client with the URL http://localhost:8080/rest-sample/

How to find out more about this project

This project contains a Maven site that is extended and updated as the project evolves.

You can look at the raw documents in src/site/apt/ - or you can run the site locally by issuing

mvn site:run

and pointing your browser at http://localhost:8090.

A recent version of the site is deployed to (http://rest-samples.ahus1.de/).

How to develop changes for these REST samples

Please use Eclipse Juno JEE for developing these. Recommended plugins are JBoss developer tools 4.0, m2e 1.2+ for Maven support.

You should download JBoss AS 7.1.1 from JBoss and extract it to a folder. You can then start the server locally and log in to the http://localhost:8080.

How to try out the REST elements

Use SoapUI to test the REST services

REST is supposed to be a universal interface that can be consumed by a lot of clients. To look at some ready to go test samples, please install SoapUI (version 4.5.1 is used in these samples).

There is a project called rest-samples-soapui-project.xml in the sub-folder src\test\resources

Hint: when looking at the responses, there are different views. SoapUI might trick you by showing you a XML view even if you received a JSON response or an empty response. Please watch out for this and make yourself familiar - especially with the Raw view.

Use your browser and a HTML5/jQuery app

Run the sample i.e. with maven like described above. Brose to http://localhost:8080/rest-samples.

How to run the test cases

There are some tests (SimpleArquillianTest.java) that spawn a container first, in this case JBoss 7.

At the moment you must have a local installation of JBoss available and the environment variable JBOSS_HOME needs to point to that folder. I will try to make it work without a local installation in the future.

Todos

  1. provide a pure JAVA client for a REST service
  2. Make the arquillian tests work without installing JBoss 7 locally first.

Use Java 32bit to use the HTML visual page editor https://issues.jboss.org/browse/JBIDE-2720

##License

Unless otherwise specified i.e. in a library file this is all MIT license - http://www.opensource.org/licenses/mit-license.php

rest-samples's People

Contributors

ahus1 avatar

Watchers

 avatar  avatar

Forkers

minhnhut0602

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.