elastic-grid
Rev 133 | Rev 143 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
/**
* Copyright (C) 2007-2008 Elastic Grid, LLC.
*
* This file is part of Elastic Grid.
*
* Elastic Grid is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or any later version.
*
* Elastic Grid 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Elastic Grid. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elasticgrid.rest;
import org.restlet.data.Protocol;
import org.restlet.ext.spring.SpringComponent;
import org.restlet.ext.wadl.WadlApplication;
import org.slf4j.bridge.SLF4JBridgeHandler;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class RestApplication extends WadlApplication implements InitializingBean {
public void afterPropertiesSet() throws Exception {
try {
// Create a new Component.
SpringComponent component = new SpringComponent();
// Add a new HTTP server listening on port 8182.
component.getServers().add(Protocol.HTTP, 8182);
// Attach the sample application.
component.getDefaultHost().attach(this);
// Start the component.
component.start();
} catch (Exception e) {
// Something is wrong.
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("/com/elasticgrid/rest/applicationContext.xml");
SLF4JBridgeHandler.install();
}
}