Package org.geoserver.rest.format

Examples of org.geoserver.rest.format.DataFormat


     * then calling {@link #postMap(Map)}.
     * </p>
     */
    @Override
    public void handlePost() {
        DataFormat format = getFormatPostOrPut();
        Map map = (Map) format.toObject(getRequest().getEntity());
        try {
            postMap(map);
        }
        catch (Exception e) {
            throw new RestletException( "", Status.SERVER_ERROR_INTERNAL, e );
View Full Code Here


     * then calling {@link #putMap(Map)}.
     * </p>
     */
    @Override
    public void handlePut() {
        DataFormat format = getFormatPostOrPut();
        Map map = (Map) format.toObject(getRequest().getEntity());
        try {
            putMap(map);
        }
        catch (Exception e) {
            throw new RestletException( "", Status.SERVER_ERROR_INTERNAL, e );
View Full Code Here

     * set the default format is used, ie the first format returned from
     * {@link #createSupportedFormats(Request, Response)}
     * </p>
     */
    protected DataFormat getFormatGet() {
        DataFormat df = null;
       
        //check if the client specified an extension
        String ext = (String) getRequest().getAttributes().get( "format" );
        if ( ext == null ) {
            ext = (String) getRequest().getAttributes().get( "type" );
View Full Code Here

     */
    protected DataFormat getFormatPostOrPut() {
        MediaType type = getRequest().getEntity().getMediaType();
        if ( type != null ) {
            //DataFormat format = getFormats().get( type.toString() );
            DataFormat format = lookupFormat( type );
            /*
            if ( format == null ) {
                //check the sub type
                String sub = type.getSubType();
                if ( sub != null ) {
View Full Code Here

    /*
     * Helper method for looking up a format based on a media type.
     */
    DataFormat lookupFormat( MediaType mt ) {
        //exact match
        DataFormat fmt = getFormats().get( mt );
       
        if ( fmt == null ) {
            //check for the case of a media type being "contained"
            for ( MediaType mediaType : getFormats().keySet() ) {
                if ( mediaType.includes( mt ) || mt.includes( mediaType ) ) {
View Full Code Here

        if (getAttribute("file") != null) {
            response = lookupFile(dir);
        }

        DataFormat formatGet = getFormatGet();
        if (formatGet == null) {
            formatGet = new DirectoryJSONFormat(MediaType.APPLICATION_JSON);
        }

        getResponse().setEntity(formatGet.toRepresentation(response));
    }
View Full Code Here

                new ImportContextJSONFormat(MediaType.TEXT_HTML));
    }

    @Override
    public void handleGet() {
        DataFormat formatGet = getFormatGet();
        if (formatGet == null) {
            formatGet = new ImportContextJSONFormat(MediaType.APPLICATION_JSON);
        }
        Object lookupContext = lookupContext(true, false);
        if (lookupContext == null) {
            // this means a specific lookup failed
            getResponse().setStatus(Status.CLIENT_ERROR_NOT_FOUND);
        } else {
            getResponse().setEntity(formatGet.toRepresentation(lookupContext));
        }
    }
View Full Code Here

                        customParameters);
            }
           
           
            //poach the coverage store data format
            DataFormat df = new CoverageStoreResource(getContext(),request,response,catalog).createXMLFormat(request, response);
            response.setEntity(df.toRepresentation(info));
            response.setStatus(Status.SUCCESS_CREATED);
        }
        catch( Exception e ) {
            if(e instanceof RestletException) {
                throw (RestletException) e;
View Full Code Here

               
                //TODO: update the layers pointing at this coverage
            }
           
            //poach the coverage store data format
            DataFormat df = new CoverageStoreResource(getContext(),request,response,catalog).createXMLFormat(request, response);
            response.setEntity(df.toRepresentation(info));
            response.setStatus(Status.SUCCESS_CREATED);
        }
        catch( Exception e ) {
            throw new RestletException( "Error auto-configuring coverage", Status.SERVER_ERROR_INTERNAL, e );
        }
View Full Code Here

       
        LOGGER.fine( "GET style " + style );
        StyleInfo sinfo = catalog.getStyleByName( style );
       
        //check the format, if specified as sld, return the sld itself
        DataFormat format = getFormatGet();
        if ( format instanceof SLDFormat ) {
            try {
                return sinfo.getStyle();
            }
            catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.geoserver.rest.format.DataFormat

Copyright © 2018 www.massapicom. 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.