Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
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
Openfire
Commits
92450df2
Commit
92450df2
authored
Jun 22, 2017
by
Guus der Kinderen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow icons to be served for extracted but not loaded plugins.
parent
fee25623
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
15 deletions
+24
-15
PluginIconServlet.java
...rg/jivesoftware/openfire/container/PluginIconServlet.java
+9
-14
PluginManager.java
...va/org/jivesoftware/openfire/container/PluginManager.java
+15
-1
No files found.
src/java/org/jivesoftware/openfire/container/PluginIconServlet.java
View file @
92450df2
...
...
@@ -29,6 +29,7 @@ import java.io.FileInputStream;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.net.URL
;
/**
* Servlet is used for retrieval of plugin icons.
...
...
@@ -44,28 +45,22 @@ public class PluginIconServlet extends HttpServlet {
@Override
public
void
doGet
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
{
String
plugin
Name
=
ParamUtils
.
getParameter
(
request
,
"plugin"
);
String
canonical
Name
=
ParamUtils
.
getParameter
(
request
,
"plugin"
);
PluginManager
pluginManager
=
XMPPServer
.
getInstance
().
getPluginManager
();
Plugin
plugin
=
pluginManager
.
getPlugin
(
pluginName
);
if
(
plugin
!=
null
)
{
// Try looking for PNG file first then default to GIF.
File
icon
=
new
File
(
pluginManager
.
getPluginDirectory
(
plugin
),
"logo_small.png"
);
boolean
isPng
=
true
;
if
(!
icon
.
exists
())
{
icon
=
new
File
(
pluginManager
.
getPluginDirectory
(
plugin
),
"logo_small.gif"
);
isPng
=
false
;
}
if
(
icon
.
exists
())
{
PluginMetadata
metadata
=
pluginManager
.
getMetadata
(
canonicalName
);
if
(
metadata
!=
null
)
{
final
URL
icon
=
metadata
.
getIcon
();
if
(
icon
!=
null
)
{
// Clear any empty lines added by the JSP declaration. This is required to show
// the image in resin!
response
.
reset
();
if
(
isPng
)
{
if
(
icon
.
toExternalForm
().
toLowerCase
().
endsWith
(
".png"
)
)
{
response
.
setContentType
(
"image/png"
);
}
else
{
else
if
(
icon
.
toExternalForm
().
toLowerCase
().
endsWith
(
".png"
))
{
response
.
setContentType
(
"image/gif"
);
}
try
(
InputStream
in
=
new
FileInputStream
(
icon
))
{
try
(
InputStream
in
=
icon
.
openStream
(
))
{
try
(
OutputStream
ost
=
response
.
getOutputStream
())
{
byte
[]
buf
=
new
byte
[
1024
];
int
len
;
...
...
src/java/org/jivesoftware/openfire/container/PluginManager.java
View file @
92450df2
...
...
@@ -280,7 +280,7 @@ public class PluginManager
/**
* Returns metadata for all extracted plugins, mapped by their canonical name.
*
* The collection is alphabetic
i
ally sorted, by plugin name.
* The collection is alphabetically sorted, by plugin name.
*
* Note that an <em>installed</em> plugin is not per definition an <em>extracted</em> plugin, and an extracted
* plugin is not per definition a <em>loaded</em> plugin. A plugin that's extracted might, for instance, fail to
...
...
@@ -293,6 +293,20 @@ public class PluginManager
return
Collections
.
unmodifiableMap
(
this
.
pluginMetadata
);
}
/**
* Returns metadata for an extracted plugin, or null when the plugin is extracted nor loaded.
*
* Note that an <em>installed</em> plugin is not per definition an <em>extracted</em> plugin, and an extracted
* plugin is not per definition a <em>loaded</em> plugin. A plugin that's extracted might, for instance, fail to
* load, due to restrictions imposed by its <tt>minServerVersion</tt> definition.
*
* @return A collection of metadata (possibly empty, never null).
*/
public
PluginMetadata
getMetadata
(
String
canonicalName
)
{
return
this
.
pluginMetadata
.
get
(
canonicalName
);
}
/**
* Returns a Collection of all loaded plugins.
*
...
...
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