Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MySpringWeb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
장 무현
MySpringWeb
Commits
7345d888
Commit
7345d888
authored
3 weeks ago
by
장 무현
Browse files
Options
Downloads
Patches
Plain Diff
musicSearch
parent
f0ff2e22
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/com/ajou/procoding/myweb/controller/MyWebController.java
+15
-3
15 additions, 3 deletions
.../com/ajou/procoding/myweb/controller/MyWebController.java
with
15 additions
and
3 deletions
src/main/java/com/ajou/procoding/myweb/controller/MyWebController.java
+
15
−
3
View file @
7345d888
...
...
@@ -16,13 +16,25 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public
class
MyWebController
{
@GetMapping
(
value
=
"/musicSearch/{term}"
)
public
String
musicSearchByPath
(
@PathVariable
String
term
)
{
return
""
;
public
MusicList
musicSearchByPath
(
@PathVariable
String
term
)
{
RestTemplate
restTemplate
=
new
RestTemplate
();
String
url
=
String
.
format
(
"https://itunes.apple.com/search?term=%s&entity=album"
,
term
);
try
{
String
response
=
restTemplate
.
getForObject
(
url
,
String
.
class
);
ObjectMapper
mapper
=
new
ObjectMapper
();
MusicList
list
=
mapper
.
readValue
(
response
,
MusicList
.
class
);
System
.
out
.
println
(
list
.
getResultCount
());
return
list
;
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
toString
());
return
null
;
}
}
@GetMapping
(
value
=
"/musicSearch"
)
public
MusicList
musicSearchByParam
(
@RequestParam
String
term
)
{
RestTemplate
restTemplate
=
new
RestTemplate
();
public
MusicList
musicSearchByParam
(
@RequestParam
String
term
)
{
RestTemplate
restTemplate
=
new
RestTemplate
();
String
url
=
String
.
format
(
"https://itunes.apple.com/search?term=%s&entity=album"
,
term
);
try
{
String
response
=
restTemplate
.
getForObject
(
url
,
String
.
class
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment