This repository has been archived by the owner on Jul 29, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prep for react-router v4 merge, general improvements
- Change Java top-level package. - More comment documentation - Fix error component - Test that Nashorn can load the bundle when building
- Loading branch information
1 parent
c7dcea3
commit f6041cd
Showing
28 changed files
with
192 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,7 @@ indent_size = 4 | |
[*.java] | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[*.xml] | ||
indent_style = tab | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/* Stub for use with Flow */ | ||
/* Stub for use with Flow. Any imports of *.less files will be | ||
* redirected here, essentially making them a no-op. */ | ||
module.export = {}; |
2 changes: 1 addition & 1 deletion
2
...n/java/uk/co/blackpepper/Application.java → ...om/pugnascotia/reactdemo/Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
...lackpepper/account/AccountController.java → .../reactdemo/account/AccountController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 9 additions & 2 deletions
11
.../blackpepper/account/AccountResource.java → ...ia/reactdemo/account/AccountResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...a/uk/co/blackpepper/comments/Comment.java → ...gnascotia/reactdemo/comments/Comment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/com/pugnascotia/reactdemo/comments/CommentController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.pugnascotia.reactdemo.comments; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
import org.springframework.stereotype.Controller; | ||
import org.springframework.ui.Model; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
|
||
import static com.pugnascotia.reactdemo.utils.State.populateModel; | ||
import static org.springframework.web.bind.annotation.RequestMethod.GET; | ||
|
||
/** | ||
* Handles requests for the "add a comment" page. This is handled | ||
* by our UI stack without any additional context. | ||
*/ | ||
|
||
@Controller | ||
public class CommentController { | ||
|
||
@RequestMapping(value = "/add", method = GET) | ||
public String index(Model model, HttpServletRequest request) { | ||
populateModel(model, request); | ||
return "index"; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ackpepper/comments/CommentRepository.java → ...reactdemo/comments/CommentRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 14 additions & 8 deletions
22
...blackpepper/comments/CommentResource.java → ...a/reactdemo/comments/CommentResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,43 @@ | ||
package uk.co.blackpepper.comments; | ||
package com.pugnascotia.reactdemo.comments; | ||
|
||
import java.util.List; | ||
import javax.inject.Inject; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import com.pugnascotia.reactdemo.utils.Functions; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import uk.co.blackpepper.utils.Functions; | ||
|
||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; | ||
import static org.springframework.web.bind.annotation.RequestMethod.GET; | ||
import static org.springframework.web.bind.annotation.RequestMethod.POST; | ||
|
||
/** | ||
* Handles creating new comments and fetching all comments via AJAX. | ||
*/ | ||
|
||
@RestController | ||
@RequestMapping(value = "/api", produces = APPLICATION_JSON_VALUE) | ||
@Slf4j | ||
public class CommentResource { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(CommentResource.class); | ||
private final CommentRepository repository; | ||
|
||
@Inject | ||
private CommentRepository repository; | ||
public CommentResource(CommentRepository repository) { | ||
this.repository = repository; | ||
} | ||
|
||
@RequestMapping(path = "/comments", method = POST) | ||
public Comment add(@RequestBody Comment comment) { | ||
LOG.info("{}", comment); | ||
log.info("{}", comment); | ||
return repository.save(comment); | ||
} | ||
|
||
@RequestMapping(path = "/comments", method = GET) | ||
public List<Comment> comments() { | ||
// You shouldn't do this in a real app - you should page the data. | ||
// You shouldn't do this in a real app - you should page the data! | ||
return Functions.map(repository.findAll(), c -> c); | ||
} | ||
} |
5 changes: 2 additions & 3 deletions
5
...r/comments/InMemoryCommentRepository.java → ...o/comments/InMemoryCommentRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...jax/AjaxAuthenticationFailureHandler.java → ...jax/AjaxAuthenticationFailureHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.