commit
ebc83338b5
|
@ -7,6 +7,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.baeldung.persistence.service.RedditTokenService;
|
import org.baeldung.persistence.service.RedditTokenService;
|
||||||
import org.baeldung.reddit.classifier.RedditClassifier;
|
import org.baeldung.reddit.classifier.RedditClassifier;
|
||||||
|
import org.baeldung.reddit.util.MyFeatures;
|
||||||
import org.baeldung.reddit.util.UserAgentInterceptor;
|
import org.baeldung.reddit.util.UserAgentInterceptor;
|
||||||
import org.baeldung.web.schedule.ScheduledTasks;
|
import org.baeldung.web.schedule.ScheduledTasks;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -87,9 +88,11 @@ public class WebConfig extends WebMvcConfigurerAdapter {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public RedditClassifier redditClassifier() throws IOException {
|
public RedditClassifier redditClassifier() throws IOException {
|
||||||
final Resource file = new ClassPathResource("data.csv");
|
|
||||||
final RedditClassifier redditClassifier = new RedditClassifier();
|
final RedditClassifier redditClassifier = new RedditClassifier();
|
||||||
redditClassifier.trainClassifier(file.getFile().getAbsolutePath());
|
if (MyFeatures.PREDICTION_FEATURE.isActive()) {
|
||||||
|
final Resource file = new ClassPathResource("data.csv");
|
||||||
|
redditClassifier.trainClassifier(file.getFile().getAbsolutePath());
|
||||||
|
}
|
||||||
return redditClassifier;
|
return redditClassifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,26 +21,8 @@ border-color: #ddd;
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar navbar-default">
|
<jsp:include page="header.jsp" />
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="navbar-header">
|
|
||||||
<a class="navbar-brand" href="<c:url value="/home.html" />">Schedule to Reddit</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="navbar-text navbar-right">Logged in as
|
|
||||||
<b><sec:authentication property="principal.username" /></b>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
<li><a href="<c:url value="/posts" />">My Scheduled Posts</a></li>
|
|
||||||
<li><a href="<c:url value="/post" />">Post to Reddit</a></li>
|
|
||||||
<li><a href="<c:url value="/postSchedule" />">Schedule Post to Reddit</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div><!-- /.navbar-collapse -->
|
|
||||||
</div><!-- /.container-fluid -->
|
|
||||||
</nav>
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Edit Scheduled Post</h1>
|
<h1>Edit Scheduled Post</h1>
|
||||||
<form action="<c:url value="/updatePost/${post.getId()}" />" method="post" role="form" data-toggle="validator">
|
<form action="<c:url value="/updatePost/${post.getId()}" />" method="post" role="form" data-toggle="validator">
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||||
|
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
|
||||||
|
|
||||||
|
<nav class="navbar navbar-default">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<a class="navbar-brand" href="<c:url value="/home.html" />">Schedule to Reddit</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="navbar-text navbar-right">Logged in as
|
||||||
|
<b><sec:authentication property="principal.username" /></b>
|
||||||
|
<a href="<c:url value="/logout" />">Logout</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li><a href="<c:url value="/posts" />">My Scheduled Posts</a></li>
|
||||||
|
<li><a href="<c:url value="/post" />">Post to Reddit</a></li>
|
||||||
|
<li><a href="<c:url value="/postSchedule" />">Schedule Post to Reddit</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div><!-- /.navbar-collapse -->
|
||||||
|
</div><!-- /.container-fluid -->
|
||||||
|
</nav>
|
|
@ -8,27 +8,8 @@
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar navbar-default">
|
<jsp:include page="header.jsp" />
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="navbar-header">
|
|
||||||
<a class="navbar-brand" href="#">Schedule to Reddit</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="navbar-text navbar-right">Logged in as
|
|
||||||
<b><sec:authentication property="principal.username" /></b>
|
|
||||||
<a href="logout">Logout</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
<li><a href="posts">My Scheduled Posts</a></li>
|
|
||||||
<li><a href="post">Post to Reddit</a></li>
|
|
||||||
<li><a href="postSchedule">Schedule Post to Reddit</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div><!-- /.navbar-collapse -->
|
|
||||||
</div><!-- /.container-fluid -->
|
|
||||||
</nav>
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Welcome, <small><sec:authentication property="principal.username" /></small></h1>
|
<h1>Welcome, <small><sec:authentication property="principal.username" /></small></h1>
|
||||||
<br>
|
<br>
|
||||||
|
|
|
@ -10,26 +10,8 @@
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar navbar-default">
|
<jsp:include page="header.jsp" />
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="navbar-header">
|
|
||||||
<a class="navbar-brand" href="home.html">Schedule to Reddit</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="navbar-text navbar-right">Logged in as
|
|
||||||
<b><sec:authentication property="principal.username" /></b>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
<li class="active"><a href="posts">My Scheduled Posts</a></li>
|
|
||||||
<li><a href="post">Post to Reddit</a></li>
|
|
||||||
<li><a href="postSchedule">Schedule Post to Reddit</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div><!-- /.navbar-collapse -->
|
|
||||||
</div><!-- /.container-fluid -->
|
|
||||||
</nav>
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>My Scheduled Posts</h1>
|
<h1>My Scheduled Posts</h1>
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
|
|
|
@ -23,26 +23,8 @@ border-color: #ddd;
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar navbar-default">
|
<jsp:include page="header.jsp" />
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="navbar-header">
|
|
||||||
<a class="navbar-brand" href="home.html">Schedule to Reddit</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="navbar-text navbar-right">Logged in as
|
|
||||||
<b><sec:authentication property="principal.username" /></b>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
<li><a href="posts">My Scheduled Posts</a></li>
|
|
||||||
<li><a href="post">Post to Reddit</a></li>
|
|
||||||
<li class="active"><a href="postSchedule">Schedule Post to Reddit</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div><!-- /.navbar-collapse -->
|
|
||||||
</div><!-- /.container-fluid -->
|
|
||||||
</nav>
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Schedule Post to Reddit</h1>
|
<h1>Schedule Post to Reddit</h1>
|
||||||
<form action="schedule" method="post" role="form" data-toggle="validator">
|
<form action="schedule" method="post" role="form" data-toggle="validator">
|
||||||
|
|
|
@ -21,26 +21,8 @@ border-color: #ddd;
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar navbar-default">
|
<jsp:include page="header.jsp" />
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="navbar-header">
|
|
||||||
<a class="navbar-brand" href="home.html">Schedule to Reddit</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="navbar-text navbar-right">Logged in as
|
|
||||||
<b><sec:authentication property="principal.username" /></b>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
<li><a href="posts">My Scheduled Posts</a></li>
|
|
||||||
<li class="active"><a href="post">Post to Reddit</a></li>
|
|
||||||
<li><a href="postSchedule">Schedule Post to Reddit</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div><!-- /.navbar-collapse -->
|
|
||||||
</div><!-- /.container-fluid -->
|
|
||||||
</nav>
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Post to Reddit</h1>
|
<h1>Post to Reddit</h1>
|
||||||
<form action="submit" method="post" role="form" data-toggle="validator">
|
<form action="submit" method="post" role="form" data-toggle="validator">
|
||||||
|
|
|
@ -9,26 +9,7 @@
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar navbar-default">
|
<jsp:include page="header.jsp" />
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="navbar-header">
|
|
||||||
<a class="navbar-brand" href="home.html">Schedule to Reddit</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="navbar-text navbar-right">Logged in as
|
|
||||||
<b><sec:authentication property="principal.username" /></b>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
<li><a href="posts">My Scheduled Posts</a></li>
|
|
||||||
<li><a href="post">Post to Reddit</a></li>
|
|
||||||
<li><a href="postSchedule">Schedule Post to Reddit</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div><!-- /.navbar-collapse -->
|
|
||||||
</div><!-- /.container-fluid -->
|
|
||||||
</nav>
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>${msg}</h1>
|
<h1>${msg}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue