Commit b2d5616f authored by richmidwinter's avatar richmidwinter Committed by daryl herzmann

OF-1250: Old DWR causes CSRF, XSS in Admin Console (#861)

* OF-1250: Removing DWR from monitoring plugin.

* OF-1250: Updating version of DWR in core.

* Renaming ressource as resource where in English.

* OF-1250: Updating version of DWR dependency in core.

* Missing ressource spelling.
parent 0c516d06
...@@ -466,9 +466,9 @@ ...@@ -466,9 +466,9 @@
<version>${slf4j.version}</version> <version>${slf4j.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>dwr</groupId> <groupId>org.directwebremoting</groupId>
<artifactId>dwr</artifactId> <artifactId>dwr</artifactId>
<version>1.1.3</version> <version>3.0.2-RELEASE</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>bsf</groupId> <groupId>bsf</groupId>
......
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>dwr</groupId> <groupId>com.sun.jersey</groupId>
<artifactId>dwr</artifactId> <artifactId>jersey-servlet</artifactId>
<version>1.1.3</version> <version>1.18.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jrobin</groupId> <groupId>org.jrobin</groupId>
...@@ -53,5 +53,4 @@ ...@@ -53,5 +53,4 @@
<version>1.2</version> <version>1.2</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project>
</project>
\ No newline at end of file
package org.jivesoftware.openfire.exceptions;
import javax.xml.bind.annotation.XmlRootElement;
/**
* The Class ErrorResponse.
*/
@XmlRootElement(name = "error")
public class ErrorResponse {
/** The resource. */
private String resource;
/** The message. */
private String message;
/** The exception. */
private String exception;
/** The exception stack. */
private String exceptionStack;
/**
* Gets the resource.
*
* @return the resource
*/
public String getResource() {
return resource;
}
/**
* Sets the resource.
*
* @param resource
* the new resource
*/
public void setResource(String resource) {
this.resource = resource;
}
/**
* Gets the message.
*
* @return the message
*/
public String getMessage() {
return message;
}
/**
* Sets the message.
*
* @param message
* the new message
*/
public void setMessage(String message) {
this.message = message;
}
/**
* Gets the exception.
*
* @return the exception
*/
public String getException() {
return exception;
}
/**
* Sets the exception.
*
* @param exception
* the new exception
*/
public void setException(String exception) {
this.exception = exception;
}
/**
* Gets the exception stack.
*
* @return the exception stack
*/
public String getExceptionStack() {
return exceptionStack;
}
/**
* Sets the exception stack.
*
* @param exceptionStack
* the new exception stack
*/
public void setExceptionStack(String exceptionStack) {
this.exceptionStack = exceptionStack;
}
}
\ No newline at end of file
package org.jivesoftware.openfire.exceptions;
/**
* The Class ExceptionType.
*/
public final class ExceptionType {
/** The Constant SHARED_GROUP_EXCEPTION. */
public static final String SHARED_GROUP_EXCEPTION = "SharedGroupException";
/** The Constant PROPERTY_NOT_FOUND. */
public static final String PROPERTY_NOT_FOUND = "PropertyNotFoundException";
/** The Constant USER_ALREADY_EXISTS_EXCEPTION. */
public static final String USER_ALREADY_EXISTS_EXCEPTION = "UserAlreadyExistsException";
/** The Constant USER_NOT_FOUND_EXCEPTION. */
public static final String USER_NOT_FOUND_EXCEPTION = "UserNotFoundException";
/** The Constant GROUP_ALREADY_EXISTS. */
public static final String GROUP_ALREADY_EXISTS = "GroupAlreadyExistsException";
/** The Constant GROUP_NOT_FOUND. */
public static final String GROUP_NOT_FOUND = "GroupNotFoundException";
/**
* Instantiates a new exception type.
*/
private ExceptionType() {
}
}
package org.jivesoftware.openfire.exceptions;
import javax.ws.rs.core.Response.Status;
/**
* The Class MUCServiceException.
*/
public class ServiceException extends Exception {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 4351720088030656859L;
/** The resource. */
private String resource;
/** The exception. */
private String exception;
/** The status. */
private Status status;
/**
* Instantiates a new mUC service exception.
*
* @param msg
* the msg
* @param resource
* the resource
* @param exception
* the exception
* @param status
* the status
*/
public ServiceException(String msg, String resource, String exception, Status status) {
super(msg);
this.resource = resource;
this.exception = exception;
this.status = status;
}
/**
* Instantiates a new service exception.
*
* @param msg
* the msg
* @param resource
* the resource
* @param exception
* the exception
* @param status
* the status
* @param cause
* the cause
*/
public ServiceException(String msg, String resource, String exception, Status status, Throwable cause) {
super(msg, cause);
this.resource = resource;
this.exception = exception;
this.status = status;
}
/**
* Gets the resource.
*
* @return the resource
*/
public String getResource() {
return resource;
}
/**
* Sets the resource.
*
* @param resource
* the new resource
*/
public void setResource(String resource) {
this.resource = resource;
}
/**
* Gets the exception.
*
* @return the exception
*/
public String getException() {
return exception;
}
/**
* Sets the exception.
*
* @param exception
* the new exception
*/
public void setException(String exception) {
this.exception = exception;
}
/**
* Gets the status.
*
* @return the status
*/
public Status getStatus() {
return status;
}
/**
* Sets the status.
*
* @param status
* the new status
*/
public void setStatus(Status status) {
this.status = status;
}
}
\ No newline at end of file
package org.jivesoftware.openfire.plugin;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import org.jivesoftware.openfire.plugin.service.MonitoringAPI;
import com.sun.jersey.api.core.PackagesResourceConfig;
import com.sun.jersey.spi.container.servlet.ServletContainer;
/**
* The Class JerseyWrapper.
*/
public class JerseyWrapper extends ServletContainer {
private static final long serialVersionUID = 4807992231163442643L;
/** The Constant RESOURCE_CONFIG_CLASS_KEY. */
private static final String RESOURCE_CONFIG_CLASS_KEY = "com.sun.jersey.config.property.resourceConfigClass";
/** The Constant RESOURCE_CONFIG_CLASS. */
private static final String RESOURCE_CONFIG_CLASS = "com.sun.jersey.api.core.PackagesResourceConfig";
/** The config. */
private static Map<String, Object> config;
/** The prc. */
private static PackagesResourceConfig prc;
static {
config = new HashMap<String, Object>();
config.put(RESOURCE_CONFIG_CLASS_KEY, RESOURCE_CONFIG_CLASS);
config.put("com.sun.jersey.api.json.POJOMappingFeature", true);
prc = new PackagesResourceConfig(JerseyWrapper.class.getPackage().getName());
prc.setPropertiesAndFeatures(config);
prc.getClasses().add(MonitoringAPI.class);
prc.getClasses().add(RESTExceptionMapper.class);
}
/**
* Instantiates a new jersey wrapper.
*/
public JerseyWrapper() {
super(prc);
}
@Override
public void init(ServletConfig servletConfig) throws ServletException {
super.init(servletConfig);
}
@Override
public void destroy() {
super.destroy();
}
}
package org.jivesoftware.openfire.plugin;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import org.jivesoftware.openfire.exceptions.ErrorResponse;
import org.jivesoftware.openfire.exceptions.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class RESTExceptionMapper.
*/
@Provider
public class RESTExceptionMapper implements ExceptionMapper<ServiceException> {
/** The log. */
private static Logger LOG = LoggerFactory.getLogger(RESTExceptionMapper.class);
/**
* Instantiates a new REST exception mapper.
*/
public RESTExceptionMapper() {
}
/*
* (non-Javadoc)
*
* @see javax.ws.rs.ext.ExceptionMapper#toResponse(java.lang.Throwable)
*/
public Response toResponse(ServiceException exception) {
ErrorResponse errorResponse = new ErrorResponse();
errorResponse.setResource(exception.getResource());
errorResponse.setMessage(exception.getMessage());
errorResponse.setException(exception.getException());
LOG.error(
exception.getException() + ": " + exception.getMessage() + " with resource "
+ exception.getResource(), exception.getException());
return Response.status(exception.getStatus()).entity(errorResponse).type(MediaType.APPLICATION_XML).build();
}
}
package org.jivesoftware.openfire.plugin.service;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.jivesoftware.openfire.archive.ConversationUtils;
import org.jivesoftware.openfire.reporting.stats.StatsAction;
@Path("monitoring/api")
@Produces(MediaType.APPLICATION_JSON)
public class MonitoringAPI {
private StatsAction statsAction = new StatsAction();
private ConversationUtils conversationUtils = new ConversationUtils();
@GET
@Path("/stats/latest")
public Response getLatest(@QueryParam("count") int count,
@QueryParam("mostRecentConversationID") long mostRecentConversationID) {
return Response.ok(statsAction.getNLatestConversations(
count, mostRecentConversationID)).build();
}
@GET
@Path("/stats/updated")
public Response getUpdated(@QueryParam("timePeriod") String timePeriod) {
return Response.ok(statsAction.getUpdatedStats(timePeriod)).build();
}
@GET
@Path("/conversations/{conversationId}")
public Response getInfo(@PathParam("conversationId") long conversationID) {
return Response.ok(conversationUtils.getConversationInfo(conversationID, true)).build();
}
@GET
@Path("/conversations")
public Response getConversations() {
return Response.ok(conversationUtils.getConversations(true)).build();
}
@GET
@Path("/buildprogress")
public Response getBuildProgress() {
return Response.ok(conversationUtils.getBuildProgress()).build();
}
}
/*
* Copyright (C) 2008 Jive Software. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.openfire.reporting;
import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.jivesoftware.openfire.archive.MonitoringConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import uk.ltd.getahead.dwr.Configuration;
import uk.ltd.getahead.dwr.DWRServlet;
import uk.ltd.getahead.dwr.impl.DefaultInterfaceProcessor;
/**
* Use the EnterpriseDWR servlet to register your own DWR mappings to Enteprise.
*/
public class MonitoringDWR extends DWRServlet {
private static final Logger Log = LoggerFactory.getLogger(MonitoringDWR.class);
private Document document;
@Override
public void configure(ServletConfig servletConfig, Configuration configuration) throws ServletException {
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dbf.newDocumentBuilder();
document = builder.newDocument();
Element root = document.createElement("dwr");
document.appendChild(root);
Element allowElement = document.createElement("allow");
// Build stats bean
Element createElement = buildCreator("Stats", org.jivesoftware.openfire.reporting.stats.StatsAction.class.getName());
Element convertConversationElement = document.createElement("convert");
convertConversationElement.setAttribute("converter", "bean");
convertConversationElement.setAttribute("match", org.jivesoftware.openfire.archive.ConversationInfo.class.getName());
// Build conversation Element.
Element conversationElement = buildCreator("conversations", org.jivesoftware.openfire.archive.ConversationUtils.class.getName());
allowElement.appendChild(createElement);
allowElement.appendChild(convertConversationElement);
allowElement.appendChild(conversationElement);
root.appendChild(allowElement);
}
catch (ParserConfigurationException e) {
Log.error("error creating DWR configuration: " + e);
}
configuration.addConfig(document);
// Specify the path for the Stat.js file
Object bean = container.getBean("interface");
if (bean instanceof DefaultInterfaceProcessor) {
DefaultInterfaceProcessor processor = (DefaultInterfaceProcessor)bean;
processor.setOverridePath("/plugins/"+MonitoringConstants.NAME+"/dwr");
}
}
/**
* Builds a create element within the DWR servlet.
* @param javascriptID the javascript variable name to use.
* @param qualifiedClassName the fully qualified class name.
* @return the Element.
*/
private Element buildCreator(String javascriptID, String qualifiedClassName) {
Element element = document.createElement("create");
element.setAttribute("creator", "new");
element.setAttribute("javascript", javascriptID);
Element parameter = document.createElement("param");
parameter.setAttribute("name", "class");
parameter.setAttribute("value", qualifiedClassName);
element.appendChild(parameter);
return element;
}
@Override
protected void doPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
throws IOException, ServletException {
super.doPost(new MyServletRequestWrapper(httpServletRequest), httpServletResponse);
}
/**
* Custom HTTP request wrapper that overrides the path to use
*/
private static class MyServletRequestWrapper extends HttpServletRequestWrapper {
public MyServletRequestWrapper(HttpServletRequest httpServletRequest) {
super(httpServletRequest);
}
@Override
public String getPathInfo() {
String pathInfo = super.getPathInfo();
return pathInfo.replaceAll("/"+MonitoringConstants.NAME+"/dwr", "");
}
}
}
...@@ -5,24 +5,15 @@ ...@@ -5,24 +5,15 @@
version="3.1"> version="3.1">
<!-- Servlets --> <!-- Servlets -->
<servlet> <servlet>
<servlet-name>GraphServlet</servlet-name> <servlet-name>JerseyWrapper</servlet-name>
<servlet-class>org.jivesoftware.openfire.reporting.graph.GraphServlet</servlet-class> <servlet-class>org.jivesoftware.openfire.plugin.JerseyWrapper</servlet-class>
</servlet> </servlet>
<servlet> <servlet>
<description>Direct Web Remoter Servlet</description> <servlet-name>GraphServlet</servlet-name>
<display-name>DWR Servlet</display-name> <servlet-class>org.jivesoftware.openfire.reporting.graph.GraphServlet</servlet-class>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.jivesoftware.openfire.reporting.MonitoringDWR</servlet-class>
<init-param>
<param-name>logLevel</param-name>
<param-value>FATAL</param-value>
</init-param>
<init-param>
<param-name>skipDefaultConfig</param-name>
<param-value>true</param-value>
</init-param>
</servlet> </servlet>
<servlet> <servlet>
<servlet-name>ConversationServlet</servlet-name> <servlet-name>ConversationServlet</servlet-name>
<servlet-class>org.jivesoftware.openfire.archive.ConversationPDFServlet</servlet-class> <servlet-class>org.jivesoftware.openfire.archive.ConversationPDFServlet</servlet-class>
...@@ -37,11 +28,9 @@ ...@@ -37,11 +28,9 @@
<servlet-name>ConversationServlet</servlet-name> <servlet-name>ConversationServlet</servlet-name>
<url-pattern>/conversation</url-pattern> <url-pattern>/conversation</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet-mapping> <servlet-mapping>
<servlet-name>dwr-invoker</servlet-name> <servlet-name>JerseyWrapper</servlet-name>
<url-pattern>/dwr/*</url-pattern> <url-pattern>/api/*</url-pattern>
</servlet-mapping> </servlet-mapping>
</web-app> </web-app>
...@@ -153,9 +153,6 @@ ...@@ -153,9 +153,6 @@
<meta name="pageID" content="archive-search"/> <meta name="pageID" content="archive-search"/>
<script src="/js/prototype.js" type="text/javascript"></script> <script src="/js/prototype.js" type="text/javascript"></script>
<script src="/js/scriptaculous.js" type="text/javascript"></script> <script src="/js/scriptaculous.js" type="text/javascript"></script>
<script src="dwr/engine.js" type="text/javascript"></script>
<script src="dwr/util.js" type="text/javascript"></script>
<script src="dwr/interface/conversations.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript" src="scripts/tooltips/domLib.js"></script> <script type="text/javascript" language="javascript" src="scripts/tooltips/domLib.js"></script>
<script type="text/javascript" language="javascript" src="scripts/tooltips/domTT.js"></script> <script type="text/javascript" language="javascript" src="scripts/tooltips/domTT.js"></script>
...@@ -380,7 +377,13 @@ ...@@ -380,7 +377,13 @@
function showConversation(conv) { function showConversation(conv) {
selectedConversation = conv; selectedConversation = conv;
conversations.getConversationInfo(showConv, conv, true);
new Ajax.Request('/plugins/monitoring/api/conversations/' +conv, {
method: 'get',
onSuccess: function(transport) {
showConv(transport.responseText.evalJSON());
}
});
} }
function showConv(results) { function showConv(results) {
...@@ -424,6 +427,8 @@ ...@@ -424,6 +427,8 @@
ele.style.backgroundColor = "#ffffff"; ele.style.backgroundColor = "#ffffff";
} }
} }
//# sourceURL=archive-search.jsp
</script> </script>
<script type="text/javascript" src="/js/behaviour.js"></script> <script type="text/javascript" src="/js/behaviour.js"></script>
<script type="text/javascript"> <script type="text/javascript">
......
...@@ -27,14 +27,16 @@ ...@@ -27,14 +27,16 @@
<head> <head>
<title><fmt:message key="archive.settings.title"/></title> <title><fmt:message key="archive.settings.title"/></title>
<meta name="pageID" content="archiving-settings"/> <meta name="pageID" content="archiving-settings"/>
<script src="dwr/engine.js" type="text/javascript"></script>
<script src="dwr/util.js" type="text/javascript"></script>
<script src="dwr/interface/conversations.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="style/style.css"> <link rel="stylesheet" type="text/css" href="style/style.css">
<script type="text/javascript"> <script type="text/javascript">
// Calls a getBuildProgress // Calls a getBuildProgress
function getBuildProgress() { function getBuildProgress() {
conversations.getBuildProgress(showBuildProgress); new Ajax.Request('/plugins/monitoring/api/buildprogress', {
method: 'get',
onSuccess: function(transport) {
showBuildProgress(transport.responseText.evalJSON());
}
});
} }
function showBuildProgress(progress) { function showBuildProgress(progress) {
...@@ -52,6 +54,8 @@ ...@@ -52,6 +54,8 @@
// Effect.Fade('rebuildElement'); // Effect.Fade('rebuildElement');
} }
} }
//# sourceURL=archiving-settings.jsp
</script> </script>
<style type="text/css"> <style type="text/css">
.small-label { .small-label {
......
...@@ -30,9 +30,6 @@ ...@@ -30,9 +30,6 @@
<meta name="pageID" content="active-conversations"/> <meta name="pageID" content="active-conversations"/>
<script src="/js/prototype.js" type="text/javascript"></script> <script src="/js/prototype.js" type="text/javascript"></script>
<script src="/js/scriptaculous.js" type="text/javascript"></script> <script src="/js/scriptaculous.js" type="text/javascript"></script>
<script src="/plugins/monitoring/dwr/engine.js" type="text/javascript" ></script>
<script src="/plugins/monitoring/dwr/util.js" type="text/javascript" ></script>
<script src="/plugins/monitoring/dwr/interface/conversations.js" type="text/javascript"></script>
</head> </head>
<body> <body>
...@@ -40,20 +37,15 @@ ...@@ -40,20 +37,15 @@
@import "style/style.css"; @import "style/style.css";
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
DWREngine.setErrorHandler(handleError);
window.onerror = handleError;
function handleError() {
// swallow errors: probably caused by the server being down
}
var peConversations = new PeriodicalExecuter(conversationUpdater, 10); var peConversations = new PeriodicalExecuter(conversationUpdater, 10);
function conversationUpdater() { function conversationUpdater() {
try { new Ajax.Request('/plugins/monitoring/api/conversations', {
conversations.getConversations(updateConversations, true); method: 'get',
} catch(err) { onSuccess: function(transport) {
// swallow errors updateConversations(transport.responseText.evalJSON());
} }
});
} }
function updateConversations(data) { function updateConversations(data) {
...@@ -126,6 +118,7 @@ function updateConversations(data) { ...@@ -126,6 +118,7 @@ function updateConversations(data) {
$('activeConversations').innerHTML = counter; $('activeConversations').innerHTML = counter;
} }
//# sourceURL=conversations.jsp
</script> </script>
<!-- <a href="#" onclick="conversationUpdater(); return false;">click me</a> --> <!-- <a href="#" onclick="conversationUpdater(); return false;">click me</a> -->
......
...@@ -38,9 +38,6 @@ ...@@ -38,9 +38,6 @@
<meta name="pageID" content="statistics"/> <meta name="pageID" content="statistics"/>
<script src="/js/prototype.js" type="text/javascript"></script> <script src="/js/prototype.js" type="text/javascript"></script>
<script src="/js/scriptaculous.js" type="text/javascript"></script> <script src="/js/scriptaculous.js" type="text/javascript"></script>
<script src="dwr/engine.js" type="text/javascript" ></script>
<script src="dwr/util.js" type="text/javascript" ></script>
<script src="dwr/interface/Stats.js" type="text/javascript"></script>
<style type="text/css"> <style type="text/css">
.stats-description { .stats-description {
...@@ -148,37 +145,32 @@ PeriodicalExecuter.prototype.registerCallback = function() { ...@@ -148,37 +145,32 @@ PeriodicalExecuter.prototype.registerCallback = function() {
PeriodicalExecuter.prototype.stop = function() { PeriodicalExecuter.prototype.stop = function() {
clearInterval(this.intervalID); clearInterval(this.intervalID);
} }
DWREngine.setErrorHandler(handleError);
window.onerror = handleError;
function handleError() {
// swallow errors: probably caused by the server being down
}
var peStats = new PeriodicalExecuter(statsUpdater, 30); var peStats = new PeriodicalExecuter(statsUpdater, 30);
var currentTimePeriod = '<%= timePeriod %>'; var currentTimePeriod = '<%= timePeriod %>';
function statsUpdater() { function statsUpdater() {
try { new Ajax.Request('/plugins/monitoring/api/stats/updated?timePeriod=' +currentTimePeriod, {
Stats.getUpdatedStats(currentTimePeriod, updateStats); method: 'get',
} catch(err) { onSuccess: function(transport) {
// swallow errors updateStats(transport.responseText.evalJSON());
} }
});
} }
function changeTimePeriod(period) { function changeTimePeriod(period) {
if (currentTimePeriod != period) { if (currentTimePeriod != period) {
$(currentTimePeriod).className = ''; $(currentTimePeriod).className = '';
$(period).className = 'timeControl'; $(period).className = 'timeControl';
currentTimePeriod = period; currentTimePeriod = period;
createCookie("<%= COOKIE_TIMEPERIOD %>",currentTimePeriod,1000); createCookie("<%= COOKIE_TIMEPERIOD %>",currentTimePeriod,1000);
Stats.getUpdatedStats(currentTimePeriod, updateStats);
statsUpdater();
} }
} }
function updateStats(stats) { function updateStats(stats) {
for (var stat in stats) { for (var stat in stats) {
updateTable(stat, stats[stat]); updateTable(stat, stats[stat]);
...@@ -224,7 +216,12 @@ function startupConversations() { ...@@ -224,7 +216,12 @@ function startupConversations() {
} }
function conversationUpdater() { function conversationUpdater() {
Stats.getNLatestConversations(6, lastConversationID, updateConversations); new Ajax.Request('/plugins/monitoring/api/stats/latest?count=6&mostRecentConversationID=' +lastConversationID, {
method: 'get',
onSuccess: function() {
updateConversations(transport.responseText.evalJSON());
}
});
} }
function updateConversations(data) { function updateConversations(data) {
...@@ -378,7 +375,7 @@ function createCookie(name,value,days) { ...@@ -378,7 +375,7 @@ function createCookie(name,value,days) {
document.cookie = name+"="+value+expires+"; path=/"; document.cookie = name+"="+value+expires+"; path=/";
} }
//# sourceURL=stats-dashboard.jsp
</script> </script>
<div id="instructions"> <div id="instructions">
......
...@@ -5,17 +5,17 @@ import javax.xml.bind.annotation.XmlRootElement; ...@@ -5,17 +5,17 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "error") @XmlRootElement(name = "error")
public class ErrorResponse { public class ErrorResponse {
private String ressource; private String resource;
private String message; private String message;
private String exception; private String exception;
private String exceptionStack; private String exceptionStack;
public String getRessource() { public String getResource() {
return ressource; return resource;
} }
public void setRessource(String ressource) { public void setResource(String resource) {
this.ressource = ressource; this.resource = resource;
} }
public String getMessage() { public String getMessage() {
......
...@@ -8,8 +8,8 @@ public class MUCServiceException extends Exception { ...@@ -8,8 +8,8 @@ public class MUCServiceException extends Exception {
/** The Constant serialVersionUID. */ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 4351720088030656859L; private static final long serialVersionUID = 4351720088030656859L;
/** The ressource. */ /** The resource. */
private String ressource; private String resource;
/** The exception. */ /** The exception. */
private String exception; private String exception;
...@@ -19,14 +19,14 @@ public class MUCServiceException extends Exception { ...@@ -19,14 +19,14 @@ public class MUCServiceException extends Exception {
* *
* @param msg * @param msg
* the msg * the msg
* @param ressource * @param resource
* the ressource * the resource
* @param exception * @param exception
* the exception * the exception
*/ */
public MUCServiceException(String msg, String ressource, String exception) { public MUCServiceException(String msg, String resource, String exception) {
super(msg); super(msg);
this.ressource = ressource; this.resource = resource;
this.exception = exception; this.exception = exception;
} }
...@@ -43,22 +43,22 @@ public class MUCServiceException extends Exception { ...@@ -43,22 +43,22 @@ public class MUCServiceException extends Exception {
} }
/** /**
* Gets the ressource. * Gets the resource.
* *
* @return the ressource * @return the resource
*/ */
public String getRessource() { public String getResource() {
return ressource; return resource;
} }
/** /**
* Sets the ressource. * Sets the resource.
* *
* @param ressource * @param resource
* the new ressource * the new resource
*/ */
public void setRessource(String ressource) { public void setResource(String resource) {
this.ressource = ressource; this.resource = resource;
} }
/** /**
......
...@@ -27,7 +27,7 @@ public class RESTExceptionMapper implements ExceptionMapper<MUCServiceException> ...@@ -27,7 +27,7 @@ public class RESTExceptionMapper implements ExceptionMapper<MUCServiceException>
*/ */
public Response toResponse(MUCServiceException exception) { public Response toResponse(MUCServiceException exception) {
ErrorResponse errorResponse = new ErrorResponse(); ErrorResponse errorResponse = new ErrorResponse();
errorResponse.setRessource(exception.getRessource()); errorResponse.setResource(exception.getResource());
errorResponse.setMessage(exception.getMessage()); errorResponse.setMessage(exception.getMessage());
errorResponse.setException(exception.getException()); errorResponse.setException(exception.getException());
return Response.status(Response.Status.NOT_FOUND).entity(errorResponse).type(MediaType.APPLICATION_XML).build(); return Response.status(Response.Status.NOT_FOUND).entity(errorResponse).type(MediaType.APPLICATION_XML).build();
......
...@@ -1901,7 +1901,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co ...@@ -1901,7 +1901,7 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<tbody><tr> <tbody><tr>
<td>sessionId</td> <td>sessionId</td>
<td>No</td> <td>No</td>
<td>Full JID of a user e.g. (testUser@testserver.de/SomeRessource)</td> <td>Full JID of a user e.g. (testUser@testserver.de/SomeResource)</td>
</tr> </tr>
<tr> <tr>
<td>username</td> <td>username</td>
...@@ -1909,9 +1909,9 @@ If you want to create a resource with JSON data format, please add “<strong>Co ...@@ -1909,9 +1909,9 @@ If you want to create a resource with JSON data format, please add “<strong>Co
<td>The username associated with this session. Can be also “Anonymous”.</td> <td>The username associated with this session. Can be also “Anonymous”.</td>
</tr> </tr>
<tr> <tr>
<td>ressource</td> <td>resource</td>
<td>Yes</td> <td>Yes</td>
<td>Ressource name</td> <td>Resource name</td>
</tr> </tr>
<tr> <tr>
<td>node</td> <td>node</td>
......
...@@ -105,7 +105,7 @@ public class SessionController { ...@@ -105,7 +105,7 @@ public class SessionController {
session.setUsername("Anonymous"); session.setUsername("Anonymous");
} }
session.setRessource(clientSession.getAddress().getResource()); session.setResource(clientSession.getAddress().getResource());
if (clientSession instanceof LocalClientSession) { if (clientSession instanceof LocalClientSession) {
session.setNode("Local"); session.setNode("Local");
......
...@@ -7,13 +7,13 @@ import javax.xml.bind.annotation.XmlRootElement; ...@@ -7,13 +7,13 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@XmlRootElement(name = "session") @XmlRootElement(name = "session")
@XmlType(propOrder = { "sessionId", "username", "ressource", "node", "sessionStatus", "presenceStatus", "presenceMessage", "priority", @XmlType(propOrder = { "sessionId", "username", "resource", "node", "sessionStatus", "presenceStatus", "presenceMessage", "priority",
"hostAddress", "hostName", "creationDate", "lastActionDate", "secure" }) "hostAddress", "hostName", "creationDate", "lastActionDate", "secure" })
public class SessionEntity { public class SessionEntity {
private String sessionId; private String sessionId;
private String username; private String username;
private String ressource; private String resource;
private String node; private String node;
private String sessionStatus; private String sessionStatus;
private String presenceStatus; private String presenceStatus;
...@@ -49,12 +49,12 @@ public class SessionEntity { ...@@ -49,12 +49,12 @@ public class SessionEntity {
} }
@XmlElement @XmlElement
public String getRessource() { public String getResource() {
return ressource; return resource;
} }
public void setRessource(String ressource) { public void setResource(String resource) {
this.ressource = ressource; this.resource = resource;
} }
@XmlElement @XmlElement
......
...@@ -8,8 +8,8 @@ import javax.xml.bind.annotation.XmlRootElement; ...@@ -8,8 +8,8 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "error") @XmlRootElement(name = "error")
public class ErrorResponse { public class ErrorResponse {
/** The ressource. */ /** The resource. */
private String ressource; private String resource;
/** The message. */ /** The message. */
private String message; private String message;
...@@ -21,22 +21,22 @@ public class ErrorResponse { ...@@ -21,22 +21,22 @@ public class ErrorResponse {
private String exceptionStack; private String exceptionStack;
/** /**
* Gets the ressource. * Gets the resource.
* *
* @return the ressource * @return the resource
*/ */
public String getRessource() { public String getResource() {
return ressource; return resource;
} }
/** /**
* Sets the ressource. * Sets the resource.
* *
* @param ressource * @param resource
* the new ressource * the new resource
*/ */
public void setRessource(String ressource) { public void setResource(String resource) {
this.ressource = ressource; this.resource = resource;
} }
/** /**
......
...@@ -40,12 +40,12 @@ public class RESTExceptionMapper implements ExceptionMapper<ServiceException> { ...@@ -40,12 +40,12 @@ public class RESTExceptionMapper implements ExceptionMapper<ServiceException> {
*/ */
public Response toResponse(ServiceException exception) { public Response toResponse(ServiceException exception) {
ErrorResponse errorResponse = new ErrorResponse(); ErrorResponse errorResponse = new ErrorResponse();
errorResponse.setRessource(exception.getRessource()); errorResponse.setResource(exception.getResource());
errorResponse.setMessage(exception.getMessage()); errorResponse.setMessage(exception.getMessage());
errorResponse.setException(exception.getException()); errorResponse.setException(exception.getException());
LOG.error( LOG.error(
exception.getException() + ": " + exception.getMessage() + " with ressource " exception.getException() + ": " + exception.getMessage() + " with resource "
+ exception.getRessource(), exception.getException()); + exception.getResource(), exception.getException());
ResponseBuilder responseBuilder = Response.status(exception.getStatus()).entity(errorResponse); ResponseBuilder responseBuilder = Response.status(exception.getStatus()).entity(errorResponse);
List<MediaType> accepts = headers.getAcceptableMediaTypes(); List<MediaType> accepts = headers.getAcceptableMediaTypes();
......
...@@ -10,8 +10,8 @@ public class ServiceException extends Exception { ...@@ -10,8 +10,8 @@ public class ServiceException extends Exception {
/** The Constant serialVersionUID. */ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 4351720088030656859L; private static final long serialVersionUID = 4351720088030656859L;
/** The ressource. */ /** The resource. */
private String ressource; private String resource;
/** The exception. */ /** The exception. */
private String exception; private String exception;
...@@ -23,13 +23,13 @@ public class ServiceException extends Exception { ...@@ -23,13 +23,13 @@ public class ServiceException extends Exception {
* Instantiates a new service exception. * Instantiates a new service exception.
* *
* @param msg the msg * @param msg the msg
* @param ressource the ressource * @param resource the resource
* @param exception the exception * @param exception the exception
* @param status the status * @param status the status
*/ */
public ServiceException(String msg, String ressource, String exception, Status status) { public ServiceException(String msg, String resource, String exception, Status status) {
super(msg); super(msg);
this.ressource = ressource; this.resource = resource;
this.exception = exception; this.exception = exception;
this.status = status; this.status = status;
} }
...@@ -38,35 +38,35 @@ public class ServiceException extends Exception { ...@@ -38,35 +38,35 @@ public class ServiceException extends Exception {
* Instantiates a new service exception. * Instantiates a new service exception.
* *
* @param msg the msg * @param msg the msg
* @param ressource the ressource * @param resource the resource
* @param exception the exception * @param exception the exception
* @param status the status * @param status the status
* @param cause the cause * @param cause the cause
*/ */
public ServiceException(String msg, String ressource, String exception, Status status, Throwable cause) { public ServiceException(String msg, String resource, String exception, Status status, Throwable cause) {
super(msg, cause); super(msg, cause);
this.ressource = ressource; this.resource = resource;
this.exception = exception; this.exception = exception;
this.status = status; this.status = status;
} }
/** /**
* Gets the ressource. * Gets the resource.
* *
* @return the ressource * @return the resource
*/ */
public String getRessource() { public String getResource() {
return ressource; return resource;
} }
/** /**
* Sets the ressource. * Sets the resource.
* *
* @param ressource * @param resource
* the new ressource * the new resource
*/ */
public void setRessource(String ressource) { public void setResource(String resource) {
this.ressource = ressource; this.resource = resource;
} }
/** /**
......
...@@ -8,8 +8,8 @@ import javax.xml.bind.annotation.XmlRootElement; ...@@ -8,8 +8,8 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "error") @XmlRootElement(name = "error")
public class ErrorResponse { public class ErrorResponse {
/** The ressource. */ /** The resource. */
private String ressource; private String resource;
/** The message. */ /** The message. */
private String message; private String message;
...@@ -21,22 +21,22 @@ public class ErrorResponse { ...@@ -21,22 +21,22 @@ public class ErrorResponse {
private String exceptionStack; private String exceptionStack;
/** /**
* Gets the ressource. * Gets the resource.
* *
* @return the ressource * @return the resource
*/ */
public String getRessource() { public String getResource() {
return ressource; return resource;
} }
/** /**
* Sets the ressource. * Sets the resource.
* *
* @param ressource * @param resource
* the new ressource * the new resource
*/ */
public void setRessource(String ressource) { public void setResource(String resource) {
this.ressource = ressource; this.resource = resource;
} }
/** /**
......
...@@ -10,8 +10,8 @@ public class ServiceException extends Exception { ...@@ -10,8 +10,8 @@ public class ServiceException extends Exception {
/** The Constant serialVersionUID. */ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 4351720088030656859L; private static final long serialVersionUID = 4351720088030656859L;
/** The ressource. */ /** The resource. */
private String ressource; private String resource;
/** The exception. */ /** The exception. */
private String exception; private String exception;
...@@ -24,16 +24,16 @@ public class ServiceException extends Exception { ...@@ -24,16 +24,16 @@ public class ServiceException extends Exception {
* *
* @param msg * @param msg
* the msg * the msg
* @param ressource * @param resource
* the ressource * the resource
* @param exception * @param exception
* the exception * the exception
* @param status * @param status
* the status * the status
*/ */
public ServiceException(String msg, String ressource, String exception, Status status) { public ServiceException(String msg, String resource, String exception, Status status) {
super(msg); super(msg);
this.ressource = ressource; this.resource = resource;
this.exception = exception; this.exception = exception;
this.status = status; this.status = status;
} }
...@@ -43,8 +43,8 @@ public class ServiceException extends Exception { ...@@ -43,8 +43,8 @@ public class ServiceException extends Exception {
* *
* @param msg * @param msg
* the msg * the msg
* @param ressource * @param resource
* the ressource * the resource
* @param exception * @param exception
* the exception * the exception
* @param status * @param status
...@@ -52,30 +52,30 @@ public class ServiceException extends Exception { ...@@ -52,30 +52,30 @@ public class ServiceException extends Exception {
* @param cause * @param cause
* the cause * the cause
*/ */
public ServiceException(String msg, String ressource, String exception, Status status, Throwable cause) { public ServiceException(String msg, String resource, String exception, Status status, Throwable cause) {
super(msg, cause); super(msg, cause);
this.ressource = ressource; this.resource = resource;
this.exception = exception; this.exception = exception;
this.status = status; this.status = status;
} }
/** /**
* Gets the ressource. * Gets the resource.
* *
* @return the ressource * @return the resource
*/ */
public String getRessource() { public String getResource() {
return ressource; return resource;
} }
/** /**
* Sets the ressource. * Sets the resource.
* *
* @param ressource * @param resource
* the new ressource * the new resource
*/ */
public void setRessource(String ressource) { public void setResource(String resource) {
this.ressource = ressource; this.resource = resource;
} }
/** /**
......
...@@ -32,12 +32,12 @@ public class RESTExceptionMapper implements ExceptionMapper<ServiceException> { ...@@ -32,12 +32,12 @@ public class RESTExceptionMapper implements ExceptionMapper<ServiceException> {
*/ */
public Response toResponse(ServiceException exception) { public Response toResponse(ServiceException exception) {
ErrorResponse errorResponse = new ErrorResponse(); ErrorResponse errorResponse = new ErrorResponse();
errorResponse.setRessource(exception.getRessource()); errorResponse.setResource(exception.getResource());
errorResponse.setMessage(exception.getMessage()); errorResponse.setMessage(exception.getMessage());
errorResponse.setException(exception.getException()); errorResponse.setException(exception.getException());
LOG.error( LOG.error(
exception.getException() + ": " + exception.getMessage() + " with ressource " exception.getException() + ": " + exception.getMessage() + " with resource "
+ exception.getRessource(), exception.getException()); + exception.getResource(), exception.getException());
return Response.status(exception.getStatus()).entity(errorResponse).type(MediaType.APPLICATION_XML).build(); return Response.status(exception.getStatus()).entity(errorResponse).type(MediaType.APPLICATION_XML).build();
} }
......
<!DOCTYPE dwr PUBLIC <!DOCTYPE dwr PUBLIC
"-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN" "-//GetAhead Limited//DTD Direct Web Remoting 3.0//EN"
"http://www.getahead.ltd.uk/dwr/dwr10.dtd"> "http://directwebremoting.org/schema/dwr30.dtd">
<dwr> <dwr>
<allow> <allow>
......
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
<servlet> <servlet>
<servlet-name>dwr-invoker</servlet-name> <servlet-name>dwr-invoker</servlet-name>
<servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class> <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
</servlet> </servlet>
<servlet> <servlet>
......
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
} }
function startDownload(url, id) { function startDownload(url, id) {
downloader.installPlugin(downloadComplete, url, id); downloader.installPlugin(url, id, downloadComplete);
} }
function downloadComplete(status) { function downloadComplete(status) {
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
} }
DWREngine.setErrorHandler(handleError); dwr.engine.setErrorHandler(handleError);
function handleError(error) { function handleError(error) {
} }
......
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
<script src="dwr/interface/downloader.js" type="text/javascript"></script> <script src="dwr/interface/downloader.js" type="text/javascript"></script>
<script type="text/javascript" > <script type="text/javascript" >
DWREngine.setErrorHandler(handleError); dwr.engine.setErrorHandler(handleError);
function handleError(error) { function handleError(error) {
} }
......
...@@ -139,8 +139,8 @@ ...@@ -139,8 +139,8 @@
<version>1.3.2</version> <version>1.3.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>dwr</groupId> <groupId>org.directwebremoting</groupId>
<artifactId>dwr</artifactId> <artifactId>dwr</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment