Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
bcf7e498
Unverified
Commit
bcf7e498
authored
Sep 25, 2018
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔥
删除 ping google 博客搜索服务
parent
540a2752
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
217 deletions
+8
-217
src/main/java/org/b3log/solo/SoloServletListener.java
src/main/java/org/b3log/solo/SoloServletListener.java
+8
-11
src/main/java/org/b3log/solo/event/ping/AddArticleGoogleBlogSearchPinger.java
...log/solo/event/ping/AddArticleGoogleBlogSearchPinger.java
+0
-104
src/main/java/org/b3log/solo/event/ping/UpdateArticleGoogleBlogSearchPinger.java
.../solo/event/ping/UpdateArticleGoogleBlogSearchPinger.java
+0
-102
No files found.
src/main/java/org/b3log/solo/SoloServletListener.java
View file @
bcf7e498
...
...
@@ -123,7 +123,7 @@ public final class SoloServletListener extends AbstractServletListener {
}
}
registerEvent
Processor
();
registerEvent
Handlers
();
final
PluginManager
pluginManager
=
beanManager
.
getReference
(
PluginManager
.
class
);
pluginManager
.
load
();
...
...
@@ -228,22 +228,19 @@ public final class SoloServletListener extends AbstractServletListener {
}
/**
* Register event
processo
rs.
* Register event
handle
rs.
*/
private
void
registerEvent
Processor
()
{
Stopwatchs
.
start
(
"Register Event
Processo
rs"
);
private
void
registerEvent
Handlers
()
{
Stopwatchs
.
start
(
"Register Event
Handle
rs"
);
LOGGER
.
debug
(
"Registering event
processo
rs...."
);
LOGGER
.
debug
(
"Registering event
handle
rs...."
);
try
{
final
EventManager
eventManager
=
beanManager
.
getReference
(
EventManager
.
class
);
// Comment
eventManager
.
registerListener
(
new
ArticleCommentReplyNotifier
());
eventManager
.
registerListener
(
new
PageCommentReplyNotifier
());
// Article
// eventManager.registerListener(new AddArticleGoogleBlogSearchPinger());
// eventManager.registerListener(new UpdateArticleGoogleBlogSearchPinger());
// Plugin
eventManager
.
registerListener
(
new
PluginRefresher
());
eventManager
.
registerListener
(
new
ViewLoadEventHandler
());
...
...
@@ -253,11 +250,11 @@ public final class SoloServletListener extends AbstractServletListener {
eventManager
.
registerListener
(
new
ArticleUpdater
());
eventManager
.
registerListener
(
new
CommentSender
());
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
"Register event
processo
rs error"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Register event
handle
rs error"
,
e
);
throw
new
IllegalStateException
(
e
);
}
LOGGER
.
debug
(
"Register
ing event processors....
"
);
LOGGER
.
debug
(
"Register
ed event handlers
"
);
Stopwatchs
.
end
();
}
...
...
src/main/java/org/b3log/solo/event/ping/AddArticleGoogleBlogSearchPinger.java
deleted
100644 → 0
View file @
540a2752
/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-2018, b3log.org & hacpai.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package
org
.
b3log
.
solo
.
event
.
ping
;
import
jodd.http.HttpRequest
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.event.AbstractEventListener
;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.ioc.LatkeBeanManager
;
import
org.b3log.latke.ioc.Lifecycle
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.util.Strings
;
import
org.b3log.solo.event.EventTypes
;
import
org.b3log.solo.model.Article
;
import
org.b3log.solo.model.Option
;
import
org.b3log.solo.service.PreferenceQueryService
;
import
org.json.JSONObject
;
import
java.net.URLEncoder
;
/**
* This listener is responsible for pinging <a href="http://blogsearch.google.com">Google Blog Search Service</a>
* asynchronously while adding an article.
*
* <li>
* <a href="http://www.google.com/help/blogsearch/pinging_API.html">
* About Google Blog Search Pinging Service API</a>
* </li>
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.6, Aug 2, 2018
* @see UpdateArticleGoogleBlogSearchPinger
* @since 0.3.1
*/
public
final
class
AddArticleGoogleBlogSearchPinger
extends
AbstractEventListener
<
JSONObject
>
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
AddArticleGoogleBlogSearchPinger
.
class
);
/**
* Gets the event type {@linkplain EventTypes#ADD_ARTICLE}.
*
* @return event type
*/
@Override
public
String
getEventType
()
{
return
EventTypes
.
ADD_ARTICLE
;
}
@Override
public
void
action
(
final
Event
<
JSONObject
>
event
)
{
final
JSONObject
eventData
=
event
.
getData
();
String
articleTitle
=
null
;
final
LatkeBeanManager
beanManager
=
Lifecycle
.
getBeanManager
();
final
PreferenceQueryService
preferenceQueryService
=
beanManager
.
getReference
(
PreferenceQueryService
.
class
);
try
{
final
JSONObject
article
=
eventData
.
getJSONObject
(
Article
.
ARTICLE
);
articleTitle
=
article
.
getString
(
Article
.
ARTICLE_TITLE
);
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
final
String
blogTitle
=
preference
.
getString
(
Option
.
ID_C_BLOG_TITLE
);
if
(
Latkes
.
getServePath
().
contains
(
"localhost"
)
||
Strings
.
isIPv4
(
Latkes
.
getServePath
()))
{
LOGGER
.
log
(
Level
.
TRACE
,
"Solo runs on local server, so should not ping "
+
"Google Blog Search Service for the article[title={0}]"
,
article
.
getString
(
Article
.
ARTICLE_TITLE
));
return
;
}
final
String
articlePermalink
=
Latkes
.
getServePath
()
+
article
.
getString
(
Article
.
ARTICLE_PERMALINK
);
final
String
spec
=
"http://blogsearch.google.com/ping?name="
+
URLEncoder
.
encode
(
blogTitle
,
"UTF-8"
)
+
"&url="
+
URLEncoder
.
encode
(
Latkes
.
getServePath
(),
"UTF-8"
)
+
"&changesURL="
+
URLEncoder
.
encode
(
articlePermalink
,
"UTF-8"
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Request Google Blog Search Service API[{0}] while adding an "
+
"article[title="
+
articleTitle
+
"]"
,
spec
);
HttpRequest
.
get
(
spec
).
sendAsync
();
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
"Ping Google Blog Search Service fail while adding an article[title="
+
articleTitle
+
"]"
,
e
);
}
}
}
src/main/java/org/b3log/solo/event/ping/UpdateArticleGoogleBlogSearchPinger.java
deleted
100644 → 0
View file @
540a2752
/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-2018, b3log.org & hacpai.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package
org
.
b3log
.
solo
.
event
.
ping
;
import
jodd.http.HttpRequest
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.event.AbstractEventListener
;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.ioc.LatkeBeanManager
;
import
org.b3log.latke.ioc.Lifecycle
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.util.Strings
;
import
org.b3log.solo.event.EventTypes
;
import
org.b3log.solo.model.Article
;
import
org.b3log.solo.model.Option
;
import
org.b3log.solo.service.PreferenceQueryService
;
import
org.json.JSONObject
;
import
java.net.URLEncoder
;
/**
* This listener is responsible for pinging <a href="http://blogsearch.google.com">Google Blog Search Service</a>
* asynchronously while updating an article.
*
* <li>
* <a href="http://www.google.com/help/blogsearch/pinging_API.html">
* About Google Blog Search Pinging Service API</a>
* </li>
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.6, Aug 2, 2018
* @see AddArticleGoogleBlogSearchPinger
* @since 0.3.1
*/
public
final
class
UpdateArticleGoogleBlogSearchPinger
extends
AbstractEventListener
<
JSONObject
>
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
UpdateArticleGoogleBlogSearchPinger
.
class
);
/**
* Gets the event type {@linkplain EventTypes#UPDATE_ARTICLE}.
*
* @return event type
*/
@Override
public
String
getEventType
()
{
return
EventTypes
.
UPDATE_ARTICLE
;
}
@Override
public
void
action
(
final
Event
<
JSONObject
>
event
)
{
final
JSONObject
eventData
=
event
.
getData
();
String
articleTitle
=
null
;
final
LatkeBeanManager
beanManager
=
Lifecycle
.
getBeanManager
();
final
PreferenceQueryService
preferenceQueryService
=
beanManager
.
getReference
(
PreferenceQueryService
.
class
);
try
{
final
JSONObject
article
=
eventData
.
getJSONObject
(
Article
.
ARTICLE
);
articleTitle
=
article
.
getString
(
Article
.
ARTICLE_TITLE
);
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
final
String
blogTitle
=
preference
.
getString
(
Option
.
ID_C_BLOG_TITLE
);
if
(
Latkes
.
getServePath
().
contains
(
"localhost"
)
||
Strings
.
isIPv4
(
Latkes
.
getServePath
()))
{
LOGGER
.
log
(
Level
.
TRACE
,
"Solo runs on local server, so should not ping "
+
"Google Blog Search Service for the article[title={0}]"
,
article
.
getString
(
Article
.
ARTICLE_TITLE
));
return
;
}
final
String
articlePermalink
=
Latkes
.
getServePath
()
+
article
.
getString
(
Article
.
ARTICLE_PERMALINK
);
final
String
spec
=
"http://blogsearch.google.com/ping?name="
+
URLEncoder
.
encode
(
blogTitle
,
"UTF-8"
)
+
"&url="
+
URLEncoder
.
encode
(
Latkes
.
getServePath
(),
"UTF-8"
)
+
"&changesURL="
+
URLEncoder
.
encode
(
articlePermalink
,
"UTF-8"
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Request Google Blog Search Service API[{0}] while updateing "
+
"an article[title="
+
articleTitle
+
"]"
,
spec
);
HttpRequest
.
get
(
spec
).
sendAsync
();
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
"Ping Google Blog Search Service fail while updating an "
+
"article[title="
+
articleTitle
+
"]"
,
e
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment