denimmazuki / urlshortener Goto Github PK
View Code? Open in Web Editor NEWA URL Shortener Service built with Java, Spring Boot, and Redis
A URL Shortener Service built with Java, Spring Boot, and Redis
why use redis?
Integrate Travis CI with your GitHub repo. Add a build status badge in README.
Problem: out
directory is checked in and contains files generated by IDE (i.e. build output).
Solution: Delete out
directory; ignore out
directory.
for some reason, URLConverterService
produces a malformed URL, like http:localhost...
expected: http://localhost...
(notice the double slash).
log
2019-03-07 05:15:45.914 INFO 20712 --- [nio-8080-exec-3] u.app.controller.URLController : Received url to shorten: twitter.com
2019-03-07 05:15:45.915 INFO 20712 --- [nio-8080-exec-3] u.app.service.URLConverterService : Shortening twitter.com
2019-03-07 05:15:45.916 INFO 20712 --- [nio-8080-exec-3] u.app.repository.URLRepository : Incrementing ID: 4
2019-03-07 05:15:45.917 INFO 20712 --- [nio-8080-exec-3] u.app.repository.URLRepository : Saving: twitter.com at url:4
2019-03-07 05:15:48.605 INFO 20712 --- [nio-8080-exec-3] u.app.controller.URLController : Shortened url to: http:localhost:8080/e
The issue is reproducible with twitter.com
as well as with https://twitter.com
.
I've discovered your repository after reading the article https://hackernoon.com/url-shortening-service-in-java-spring-boot-and-redis-d2a0f8848a1d
It would be nice to have a cross-link to HackerNoon for those who discover this repository by other means. What do you think?
Test URL: "http://maps.google.com?f=q&hl=en&q=340+hagey+blvd+waterloo+ontario"
Actual Result: 500 Internal Server Error
Expected Result: 200 OK
Reason: URLValidator
does not allow query parameters >_<
Log
2019-03-07 05:25:21.091 INFO 20712 --- [nio-8080-exec-7] u.app.controller.URLController : Received url to shorten: http://maps.google.com?f=q&hl=en&q=340+hagey+blvd+waterloo+ontario
2019-03-07 05:25:21.096 ERROR 20712 --- [nio-8080-exec-7] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.Exception: Please enter a valid URL] with root cause
java.lang.Exception: Please enter a valid URL
at urlshortener.app.controller.URLController.shortenUrl(URLController.java:38) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.