Package org.geoserver.rest

Source Code of org.geoserver.rest.ExceptionThrowingResource

/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org.  All rights reserved.
* This code is licensed under the GPL 2.0 license, availible at the root
* application directory.
*/
package org.geoserver.rest;

import org.restlet.data.Form;
import org.restlet.data.Status;
import org.restlet.resource.Resource;

public class ExceptionThrowingResource extends Resource {

    @Override
    public void handleGet() {
        Form f = getRequest().getResourceRef().getQueryAsForm();
        String message= f.getFirstValue("message");
        String code = f.getFirstValue("code");
       
        throw new RestletException( message != null ? message : "Unknown error"
                code != null ? new Status( Integer.parseInt(code)) : Status.SERVER_ERROR_INTERNAL );
    }
}
TOP

Related Classes of org.geoserver.rest.ExceptionThrowingResource

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.