diff options
author | Vitaly Takmazov | 2018-04-26 09:39:49 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-04-26 09:39:49 +0300 |
commit | a7825dede977692c0418119159090290e4f6ac34 (patch) | |
tree | 259a07856fc75f1a3c91b4ca169fcbfa0edae551 /juick-www/src/main/java/com/juick/www | |
parent | 2d8655b5b61cab98f9f53703eb9f8fb8ecb68349 (diff) |
www: fix redirect after command
Diffstat (limited to 'juick-www/src/main/java/com/juick/www')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/configuration/EmbeddedAPIConfig.java | 2 | ||||
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/NewMessage.java | 12 |
2 files changed, 3 insertions, 11 deletions
diff --git a/juick-www/src/main/java/com/juick/www/configuration/EmbeddedAPIConfig.java b/juick-www/src/main/java/com/juick/www/configuration/EmbeddedAPIConfig.java index 6ceb140bd..0541ac259 100644 --- a/juick-www/src/main/java/com/juick/www/configuration/EmbeddedAPIConfig.java +++ b/juick-www/src/main/java/com/juick/www/configuration/EmbeddedAPIConfig.java @@ -14,6 +14,6 @@ public class EmbeddedAPIConfig { public ConfigurableApplicationContext apiContext() { return new SpringApplicationBuilder() .sources(PostConfig.class) - .run("--server.port=8081"); + .run("--server.port=8081", "--spring.jmx.enabled=false"); } } diff --git a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java index 83faf3a7f..1b3db61db 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java +++ b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java @@ -34,7 +34,6 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.http.converter.FormHttpMessageConverter; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.util.LinkedMultiValueMap; @@ -51,9 +50,6 @@ import javax.inject.Inject; import java.io.IOException; import java.net.URI; import java.net.URL; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; import java.util.stream.Collectors; /** @@ -219,7 +215,6 @@ public class NewMessage { @PostMapping("/post2") public String doPostMessage(@RequestParam(name = "body", required = false) String bodyParam, @RequestParam(required = false) String img, - @RequestParam(required = false) String referer, @RequestParam(required = false) MultipartFile attach) throws JsonProcessingException { com.juick.User visitor = UserUtils.getCurrentUser(); @@ -256,16 +251,13 @@ public class NewMessage { Message newMessage = result.getBody().getNewMessage().orElse(new Message()); if (newMessage.getMid() > 0) { logger.info("/post: {}", jsonMapper.writeValueAsString(result.getBody())); + return String.format("redirect:/%d", newMessage.getMid()); } else { logger.info("{} : {}", body, result.getBody().getText()); } - if (StringUtils.isBlank(referer) || referer.substring(0, 21).equals("http://juick.com/post") - || referer.substring(0, 22).equals("https://juick.com/post")) { - return String.format("redirect:/%d", newMessage.getMid()); - } } catch (HttpClientErrorException e) { logger.error("post error", e); } - return "redirect:" + referer; + return "redirect:/?show=my"; } } |