tinyurlserv provides interface to :
- Create tiny urls from long / actual URLs
- Retrieve long / actual URLs for given tiny URL
Screen shots can be found in doc folder of this repo.
User enters URL in /index.jsp, which then comes to service [Java backend] to be shortify. Once big URL gets converts into short URL, page tinyurl.jso renders tiny url value with link to navigate.
If user clicks on navigate link or enters short url in address bar, service reroutes user to long URL.
Service converts long URLs to short URLs using base 62 [A-Z, a-z, 0-9] codes. Service persists key value in DB and cache where tiny url is key and long url is value.
Same tiny url will be generated using base 62.
Application stores value in DB, so this can be retrieved anytime, there is no expiry. In case, it is required a separate scheduled job can be performed.
Before any encode / DB operation, service looks for value in ehcache. Currently, Ehcache stores values for 24 hours, which could be increased. Currently, I have inmplemented in memory cache but scalable alternative like memcached or cohrence can be used. In case cache call fails, service stores all tiny url and long url combination in in-memory H2 db.
Application is written using :
- Spring Boot
- JPA - Hibernate
- JSP
- Ehcache
- H2 DB
- Mockito & PowerMock - WIP
DB table contains map values to relate TinyUrls to shortUrl.
Application can be start by executing main method of TinyUrlApplication.java
- Ritvik Pandya - https://www.linkedin.com/in/ritvik-pandya-70251b15/