aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-08-08 16:56:10 +0300
committerGravatar Vitaly Takmazov2016-08-08 16:56:10 +0300
commitf8da0413163ccf941afd91217de2f767422362a4 (patch)
treed254ff9fb3395effe3d53725b2ba37480cf4c8f6 /juick-www/src/main/java/com
parente26da7a0a73793cf595e579b73d647ede2d21d5c (diff)
juick-www: using xmpp port from config
Diffstat (limited to 'juick-www/src/main/java/com')
-rw-r--r--juick-www/src/main/java/com/juick/www/Main.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/juick-www/src/main/java/com/juick/www/Main.java b/juick-www/src/main/java/com/juick/www/Main.java
index 63194fbd..c249995f 100644
--- a/juick-www/src/main/java/com/juick/www/Main.java
+++ b/juick-www/src/main/java/com/juick/www/Main.java
@@ -24,6 +24,7 @@ import com.juick.xmpp.StreamComponent;
import net.jodah.failsafe.Execution;
import net.jodah.failsafe.RetryPolicy;
import org.apache.commons.dbcp2.BasicDataSource;
+import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.xmlpull.v1.XmlPullParserException;
import ru.sape.Sape;
@@ -89,7 +90,8 @@ public class Main extends HttpServlet implements Stream.StreamListener {
sql = new JdbcTemplate(dataSource);
sqlSearch = new JdbcTemplate(dataSourceSearch);
- setupXmppComponent(new JID(conf.getProperty("www_xmpp_jid", "www.juick.local")), conf.getProperty("xmpp_password"));
+ setupXmppComponent(new JID(conf.getProperty("www_xmpp_jid", "www.juick.local")),
+ conf.getProperty("xmpp_password"), NumberUtils.toInt(conf.getProperty("xmpp_port", ""), 5347));
twitterAuth = new TwitterAuth(conf.getProperty("twitter_consumer_key"),
conf.getProperty("twitter_consumer_secret"));
pagesNewMessage = new NewMessage(conf.getProperty("upload_tmp_dir", "/var/www/juick.com/i/tmp/"),
@@ -105,7 +107,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
}
}
- public void setupXmppComponent(final JID componentJid, final String password) {
+ public void setupXmppComponent(final JID componentJid, final String password, final int port) {
@SuppressWarnings("unchecked") RetryPolicy retryPolicy = new RetryPolicy()
.withBackoff(1, 30, TimeUnit.SECONDS)
.withJitter(0.1)
@@ -114,7 +116,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
executorService.submit(() -> {
while (!execution.isComplete()) {
try {
- Socket socket = new Socket("localhost", 5347);
+ Socket socket = new Socket("localhost", port);
xmpp = new StreamComponent(componentJid, socket.getInputStream(), socket.getOutputStream(), password);
xmpp.addListener(Main.this);
xmpp.startParsing();