Package org.restlet.data

Examples of org.restlet.data.Request


    return this.refreshTime;
  }

  public Collection<Status> getFriendsLatest20Updates() {
    String URL = BASE_URL+"statuses/friends_timeline.xml";
    Request request = new Request(Method.GET, URL);
    auth(request);   
    Response response = client.handle(request);
    try {
      //System.out.println(response.getStatus()+response.getEntity().getText());
      StatusList s = (StatusList) xstream.unmarshal(
View Full Code Here


    return null;
  }

  public void postStatusUpdate(org.eclipse.twipse.model.Status status) {
    String URL = BASE_URL+"statuses/update.xml?status="+status.getTextURLEncoded();
    Request request = new Request(Method.POST, URL);       
    //request.setEntity(status.getTextURLEncoded());
   
    auth(request);
    Response response = client.handle(request);
   
View Full Code Here

    return request;
  }
 

  public boolean isAuthenticated(){
    Request request = new Request(Method.GET, BASE_URL+"/account/verify_credentials");
    Response response = client.handle(request);
    try {
      return response.getEntity().getText().equalsIgnoreCase("Authorized");
    } catch (IOException e) {
      // TODO Auto-generated catch block
View Full Code Here

  }
  public Collection<Status> getFriendsUpdatesSinceLatestRefresh() {
    String URL = BASE_URL+"statuses/friends_timeline.xml";
   
   
    Request request = new Request(Method.GET, URL);       
    auth(request);
    Date date = new Date(new Date().getTime()-this.getRefreshTime()*1000);
    //System.out.println(date);
    request.getConditions().setModifiedSince(date);
   
    Response response = client.handle(request);
    try {
      if(response.getStatus().equals(org.restlet.data.Status.REDIRECTION_NOT_MODIFIED)){
        //System.out.println("No updates");
View Full Code Here

    }
    return null;
  }
  public boolean authenticate(String screenName, String password) {
    String URL = BASE_URL+"statuses/friends_timeline.xml";
    Request request = new Request(Method.GET, URL);
    auth(request);   
    Response response = client.handle(request);
    System.out.println(response.getStatus());
    return response.getStatus().equals(org.restlet.data.Status.SUCCESS_OK);
  }
View Full Code Here

    xstream.omitField(Status.class, "location");
    xstream.omitField(Status.class, "description");
   
   
    String URL = BASE_URL+"statuses/friends/"+getScreenName()+".xml";
    Request request = new Request(Method.GET, URL);
    auth(request);   
    Response response = client.handle(request);
    try {
      //System.out.println(response.getStatus()+response.getEntity().getText());
      UserStatusList s = (UserStatusList) xstream.unmarshal(
View Full Code Here

   
    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

    checkNotNull(url);
    checkNotNull(method);
    // represenation may be null
    // matchers may be null
    final Request request = new Request();
    request.setResourceRef(url.toString());
    request.setMethod(method);

    if (!Method.GET.equals(method) && !Method.DELETE.equals(method)) {
      request.setEntity(representation);
    }

    // change the MediaType if this is a GET, default to application/xml
    if (Method.GET.equals(method)) {
      if (representation != null) {
        request.getClientInfo().getAcceptedMediaTypes().add(
            new Preference<MediaType>(representation.getMediaType()));
      }
    }

    return sendMessage(request, matchers);
View Full Code Here

      RequestFacade.releaseResponse(response);
    }

    // now, we construct and repeat conditional gets
    final String fullUrl = RequestFacade.toNexusURL(servicePath).toString();
    Request req = null;
    Response res = null;
    for (int i = 0; i < 10; i++) {
      try {
        req = new Request(Method.GET, fullUrl);
        req.getConditions().setModifiedSince(lastModified);
        res = RequestFacade.sendMessage(req, null);
        // we are fine with 200 OK, 303 Not Modified or whatever, but not with any server side error or 404
        Assert.assertTrue(res.getStatus().getCode() != 404 && !res.getStatus().isError());
      }
      finally {
View Full Code Here

    );
    ldapServerLoginTestRequest.getData().setPassword(
        encodeBase64("JUNK")
    );

    Request request = this.buildRequest();
    Response response = new Response(request);
    PlexusResource pr = this.lookup(PlexusResource.class, "LdapServerLoginTestPlexusResource");

    try {
      pr.put(null, request, response, ldapServerLoginTestRequest);
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.