package com.sixsq.slipstream.stats;

/*
 * +=================================================================+
 * SlipStream Server (WAR)
 * =====
 * Copyright (C) 2013 SixSq Sarl (sixsq.com)
 * =====
 * 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.
 * -=================================================================-
 */

import java.util.Arrays;
import java.util.List;

import org.restlet.data.MediaType;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.Get;

import com.sixsq.slipstream.exceptions.AbortException;
import com.sixsq.slipstream.exceptions.ConfigurationException;
import com.sixsq.slipstream.exceptions.SlipStreamClientException;
import com.sixsq.slipstream.persistence.User;
import com.sixsq.slipstream.resource.BaseResource;
import com.sixsq.slipstream.util.SerializationUtil;

public class StatsResource extends BaseResource {

	@Get("xml")
	public Representation toXml() {

		String metadata = SerializationUtil.toXmlString(compute());
		return new StringRepresentation(metadata, MediaType.APPLICATION_XML);

	}

	private Measurements compute() {

		Measurements measurements = new Measurements();

		List<User> users = getUser().isSuper() ? User.list() : Arrays
				.asList(getUser());

		for (User user : users) {

			try {
				measurements.populate(user);
			} catch (SlipStreamClientException e) {
				throwClientConflicError(e.getMessage());
			} catch (ConfigurationException e) {
				throwServerError(e);
			} catch (AbortException e) {
				throwServerError(e);
			}

		}
		return measurements;
	}

	@Override
	protected String getPageRepresentation() {
		return "runs";
	}

}

package com.sixsq.slipstream.stats;

/*
 * +=================================================================+
 * SlipStream Server (WAR)
 * =====
 * Copyright (C) 2013 SixSq Sarl (sixsq.com)
 * =====
 * 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.
 * -=================================================================-
 */

import java.util.Arrays;
import java.util.List;

import org.restlet.data.MediaType;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.Get;

import com.sixsq.slipstream.exceptions.AbortException;
import com.sixsq.slipstream.exceptions.ConfigurationException;
import com.sixsq.slipstream.exceptions.SlipStreamClientException;
import com.sixsq.slipstream.exceptions.ValidationException;
import com.sixsq.slipstream.persistence.User;
import com.sixsq.slipstream.resource.BaseResource;
import com.sixsq.slipstream.util.HtmlUtil;
import com.sixsq.slipstream.util.SerializationUtil;

public class StatsResource extends BaseResource {

	@Get("html")
	public Representation toHtml() throws ConfigurationException,
			ValidationException {

		String metadata = SerializationUtil.toXmlString(compute());
		return new StringRepresentation(HtmlUtil.toHtml(metadata,
				getPageRepresentation(), getTransformationType(), getUser()),
				MediaType.TEXT_HTML);

	}

	@Get("xml")
	public Representation toXml() {

		String metadata = SerializationUtil.toXmlString(compute());
		return new StringRepresentation(metadata, MediaType.APPLICATION_XML);

	}

	private Measurements compute() {

		Measurements measurements = new Measurements();

		List<User> users = getUser().isSuper() ? User.list() : Arrays
				.asList(getUser());

		for (User user : users) {

			try {
				measurements.populate(user);
			} catch (SlipStreamClientException e) {
				throwClientConflicError(e.getMessage());
			} catch (ConfigurationException e) {
				throwServerError(e);
			} catch (AbortException e) {
				throwServerError(e);
			}

		}
		return measurements;
	}

	@Override
	protected String getPageRepresentation() {
		return "runs";
	}

}

Remove support for html content-type