https://github.com/warfox/prime-rest-java
RESTful API for prime numbers
https://github.com/warfox/prime-rest-java
codecov gradle java-8 prime prime-numbers wercker
Last synced: 2 months ago
JSON representation
RESTful API for prime numbers
- Host: GitHub
- URL: https://github.com/warfox/prime-rest-java
- Owner: WarFox
- License: mit
- Created: 2017-03-17T16:07:11.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-21T22:22:34.000Z (about 8 years ago)
- Last Synced: 2025-01-05T13:31:04.512Z (4 months ago)
- Topics: codecov, gradle, java-8, prime, prime-numbers, wercker
- Language: Java
- Homepage: https://prime-numbers-api.herokuapp.com/
- Size: 98.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# RESTful Prime Numbers
[](https://app.wercker.com/project/byKey/b0a50c914a0d1575a3f63ef1869b32e7)
[](https://codecov.io/gh/WarFox/prime-rest-java)## Deployed to
https://prime-rest-java.herokuapp.com/
## Test with reports
```
./gradlew clean test jacocoTestReport
```Code coverage will be available at `build/reports/jacoco/test/html/index.html`.
Now we have `99%` code coverage.## IntegrationTests
```
./gradlew clean integrationTest
```## Build
```
./gradlew build
```Build is available at `build/libs/prime-rest-0.0.1-SNAPSHOT.jar`
## Run
```
java -jar build/libs/prime-rest-0.0.1-SNAPSHOT.jar
```## Wercker commands
* Dev
```
wercker dev --publish 8080
```
Above command will run the application in a docker container setup by wercker* Build
```
wercker build
```## Content Negotiation
- PathExtension - *.xml and *.json
- Url parameter - mediaType=xml and mediaType=json
- Accept header
- application/xml
- application/json## Http Caching
- Prime numbers are can be cached at http level
- Cache-Control max-age set to high value (1 year)
- ETag filter enabled to check if document in modified## Performance Optimization
- Memoization technique applied for performance optimization
- Known primes are collected in memory to avoid recalculation of primality
- Even numbers are skipped from primality check, as 2 is the only even prime number## Limitations
- At the moment this can only give list of prime numbers till 2147483647,
which is max limit of int type