Skip to content
/ primes Public

A RESTful web service which returns the prime numbers up to and including the number in the request

License

Notifications You must be signed in to change notification settings

Tabby/primes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

primes

Build Status

A RESTful web service which returns the prime numbers up to and including the number in the request

Usage

Send a GET request to http(s)://host.name/primes/n, where n is a positive integer greater than 1 indicating the largest number to check for primality.

The response will usually be a JSON object with the form

{
    initial: 10,
    primes: [2, 3, 5, 7]
}

If the request contains an Accept header of application/xml then the response will be sent as XML instead, as in this example:

<PrimesResponse>
  <initial>10</initial>
  <primes>2</primes>
  <primes>3</primes>
  <primes>5</primes>
  <primes>7</primes>
</PrimesResponse>

Setup

To build and run, just use the following commands:

$ mvn clean package
$ java -jar /path/to/repository/primes-x.y.z.jar

The server listens on port 8080 by default but this can be changed by setting the server.port system variable to the desired port

About

A RESTful web service which returns the prime numbers up to and including the number in the request

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages