Hello Bob,

you should give the StringRepresentation the right MediaType:

@Override
   public Representation getRepresentation( Variant variant ){
        Representation result = null;
       if( variant.getMediaType().equals(MediaType.APPLICATION_XML ) ) {
          result = new StringRepresentation( ".....", 
MediaType.valueOf("application/vnd.google-earth.kml+xml"));
           return result;
       }
   }


best regards
  Stephan

Bob Harrod schrieb:
I'm trying to do something that seems very easy, but I cannot find any
documentation on how to do this with Restlet.  I've created a few resources and
I want to change the content-type header to KML...  I'm not sure why this is so
difficult.  Any help would be greatly appreciated!

Essentially:


    public KMLResource( Context context, Request request, Response response ){
        super( context, request, response );
        response.setHeader( "Content-Type",
"application/vnd.google-earth.kml+xml" );

    }

    @Override
    public Representation getRepresentation( Variant variant ){

        Representation result = null;

        if( variant.getMediaType().equals(MediaType.APPLICATION_XML ) ) {

           result = new StringRepresentation( "....." );
           return result;
        }
    }

Reply via email to