Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gerrit Alexander Simon Evers
Verteilte Systeme Projekt
Commits
332b11da
Commit
332b11da
authored
Feb 08, 2021
by
Andre Blanke
Browse files
Return shortened URL with upbshrt.xyz domain instead of localhost
parent
7d20a42b
Changes
3
Hide whitespace changes
Inline
Side-by-side
shortener/src/main/kotlin/xyz/upbshrt/shortener/controller/IndexController.kt
View file @
332b11da
...
...
@@ -6,6 +6,11 @@ import org.springframework.web.bind.annotation.GetMapping
@Controller
class
IndexController
{
/*
* Suppress the SpringMVCViewInspection warning because index.html only exists after Maven's generateResources
* phase and the invocation of ng build using the frontend-maven-plugin.
*/
@GetMapping
(
"/"
)
@Suppress
(
"SpringMVCViewInspection"
)
fun
index
()
=
"index.html"
}
shortener/src/main/kotlin/xyz/upbshrt/shortener/controller/UrlShorteningController.kt
View file @
332b11da
...
...
@@ -26,11 +26,6 @@ class UrlShorteningController @Autowired constructor(private val repository: Url
private
fun
handleMalformedId
(
id
:
String
):
Nothing
=
throw
ResponseStatusException
(
HttpStatus
.
BAD_REQUEST
,
"'$id' is not a valid id for linking to a URL."
)
@GetMapping
(
"/ping"
)
fun
ping
():
String
{
return
"pong"
;
}
/*
* We use a URI instead of a URL here because Java has the ability to open InputStreams from URLs using
* URL.openStream. Because that ability exists, URLStreamHandlers are used for certain protocols and the
...
...
shortener/src/main/kotlin/xyz/upbshrt/shortener/entity/UrlMapping.kt
View file @
332b11da
...
...
@@ -26,7 +26,7 @@ class UrlMapping(id: Int?, url: String) {
private
set
override
fun
toString
():
String
=
"http://
localhost:8080
/${id?.toString(ID_RADIX)}"
"http://
upbshrt.xyz
/${id?.toString(ID_RADIX)}"
companion
object
{
const
val
ID_RADIX
:
Int
=
36
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment