Package org.restlet.data

Examples of org.restlet.data.Request


   
    public void process(Exchange exchange) throws Exception {
        RestletEndpoint endpoint = (RestletEndpoint)getEndpoint();
       
        String resourceUri = buildUri(endpoint);
        Request request = new Request(endpoint.getRestletMethod(),
                resourceUri);
       
        RestletBinding binding = endpoint.getRestletBinding();
        binding.populateRestletRequestFromExchange(request, exchange);
       
        if (LOG.isDebugEnabled()) {
            LOG.debug("Client sends a request (method: " + request.getMethod()
                    + ", uri: " + resourceUri + ")");
        }
       
        Response response = client.handle(request);
        binding.populateExchangeFromRestletResponse(exchange, response);
View Full Code Here


        Status.CLIENT_ERROR_BAD_REQUEST);
  }
 
  public void testExceptionHandling(){
    Context con = new Context();
    Request req = new Request();
    Response resp = new Response(req);
   
    myResource.init(con, req, resp);
    myResource.handleGet();
   
View Full Code Here

  public void testGetContext() throws Exception{
    LayerAboutPage lap = new LayerAboutPage();
    lap.setCatalog((Catalog) GeoServerExtensions.bean("catalog"));
   
    Request request = new Request(new Method("GET"), "http://example.org/geoserver/rest/topp/states.html");
   
    SimpleHash context;
   
    //test if it fails the right way with bogus namespace
    boolean hadRestletException = false;
View Full Code Here

import junit.framework.TestCase;

public class ReflectiveHTMLFormatTest extends TestCase {

    public void test() throws Exception {
        Request request = new Request();
        request.setResourceRef( "http://localhost/rest/foo.html");
        request.getResourceRef().setBaseRef( "http://localhost/rest");
       
        ReflectiveHTMLFormat fmt = new ReflectiveHTMLFormat(Foo.class,request,null,null);
        Representation rep = fmt.toRepresentation(new Foo("one",2,3.0));
        rep.write(System.out);
    }
View Full Code Here

       
        xp = XMLUnit.newXpathEngine();
    }
   
    protected Request newRequestGET(String path) {
        Request request = new Request();
        request.setMethod( Method.GET );
        request.setResourceRef( "http://localhost/" + path );
        return request;
    }
View Full Code Here

        request.setResourceRef( "http://localhost/" + path );
        return request;
    }
   
    protected Request newRequestPOST(String path, String body, String contentType) {
        Request request = new Request();
        request.setMethod( Method.POST );
        request.setResourceRef( "http://localhost/" + path );
        request.setEntity(
            new InputRepresentation( new ByteArrayInputStream( body.getBytes() ), new MediaType( contentType ) )
        );
        return request;
    }
View Full Code Here

        );
        return request;
    }

    protected Request newRequestPUT(String path, String body, String contentType) {
        Request request = newRequestPOST(path,body,contentType);
        request.setMethod( Method.PUT );
        return request;
    }
View Full Code Here

import org.w3c.dom.Document;

public class MapResourceTest extends RestletTestSupport {

    public void testMapGET() throws Exception {
        Request request = newRequestGET( "foo.xml" );
        Response response = new Response(request);
       
        FooMapResource resource = new FooMapResource( null, request, response );
        resource.handleGet();
       
View Full Code Here

            "<org.geoserver.rest.Foo>" +
                "<prop1>one</prop1>" +
                "<prop2>2</prop2>" +
                "<prop3>3.0</prop3>" +
            "</org.geoserver.rest.Foo>";
        Request request = newRequestPOST("foo",xml,"text/xml");
        Response response = new Response(request);
       
        FooMapResource resource = new FooMapResource( null, request, response );
        resource.handlePost();
       
View Full Code Here

            "<root>" +
                "<prop1>one</prop1>" +
                "<prop2>2</prop2>" +
                "<prop3>3.0</prop3>" +
            "</root>";
        Request request = newRequestPOST("foo",xml,"text/xml");
        Response response = new Response(request);
       
        FooMapResource resource = new FooMapResource( null, request, response );
        resource.handlePut();
       
View Full Code Here

TOP

Related Classes of org.restlet.data.Request

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.