Skip to content
Easily customizable url shortener
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper
src
.gitignore
.travis.yml
Procfile
README.md
build.gradle
gradlew
gradlew.bat
jacoco.xml
settings.gradle
system.properties

README.md

Jshorten

Customizable url shortener that can run anywhere

Build Status Quality Gate Status codecov

Description

Jshorten is an url shortener made purely in Java 11. This project is supposed to be an easily-extendable url shortener to make the job as fast as You need it. It needs unit testing.

Frameworks and libraries

  • SparkJava - lightweight web framework
  • Thymeleaf - frontend template engine
  • org.json - json library
  • org.slf4j - logging library
  • Gradle - build tool

Running the app

Requirements:

  • Java 11
  • Gradle

In order to start app simply clone it, enter the directory of cloned project and execute in terminal:

gradle jar
java -jar build/libs/UrlShortener-1.0-SNAPSHOT.jar 

The app is ready to be deployed to Heroku. It uses either environment variable PORT (as Heroku requires) whenever possible, otherwise default Spark port: 4567

Customization

In order to create your own version of this project you have to create class which would extend Url abstract class. You can use default implementation UrlPojo. Server class uses default implementations or objects passed using methods as repository(arg), service(arg), ....

Class Default implementation Arguments
Url UrlPojo String url, OffsetDateTime expirationTime
UrlRepository InMemoryUrlRepository DuplicateHandler
DuplicateHandler DefaultDuplicateHandlerImpl X
UrlFactory DefaultUrlFactory ShortingAlgorithm algorithm, UrlCreator creator
UrlService DefaultUrlServiceImpl UrlRepository repository, UrlFactory factory, UrlValidator validator
UrlValidator DefaultUrlValidator X

The default version (available here).

You can’t perform that action at this time.