Package org.restlet

Examples of org.restlet.Context


        assertEquals("Server list MUST contain 1 item", 1, hosts.size());
        VirtualHost host = hosts.get(0);
        assertNotNull("The single Host MUST NOT be null", host);

        String msg = "[" + HOST + ":" + host.getHostPort() + "] ";
        Context ctx = host.getContext();

        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "1");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "2");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "3");
        checkNegativeParam(msg, ctx, CON_PARAM_NAME + "4");
View Full Code Here


        assertEquals("Server list MUST contain 1 item", 1, servers.size());
        Server server = servers.get(0);
        assertNotNull("The single Server MUST NOT be null", server);

        String msg = "[" + SERVER + "] ";
        Context ctx = server.getContext();

        checkPositiveParam(msg, ctx, CON_PARAM_NAME + "1", CON_PARAM_VALUE
                + "1");
        checkPositiveParam(msg, ctx, CON_PARAM_NAME + "2", CON_PARAM_VALUE
                + "2");
View Full Code Here

            if (this.templateName != null) {
                try {
                    getEngine().init();
                    this.template = getEngine().getTemplate(this.templateName);
                } catch (Exception e) {
                    final Context context = Context.getCurrent();

                    if (context != null) {
                        context.getLogger().log(Level.WARNING,
                                "Unable to get template", e);
                    }
                }
            }
        }
View Full Code Here

        try {
            // Load the template
            // Process the template
            getTemplate().merge(getContext(), writer);
        } catch (Exception e) {
            final Context context = Context.getCurrent();

            if (context != null) {
                context.getLogger().log(Level.WARNING,
                        "Unable to process the template", e);
            }

            e.printStackTrace();
View Full Code Here

   {
      config.stopServer();
   }

   public void testUsers() {
      Client client = new Client(new Context(),adminUserLoc.getSchemeProtocol()) {
         public void handle(Request request,Response response) {
            request.setChallengeResponse(new ChallengeResponse(ChallengeScheme.HTTP_BASIC,"admin","admin"));
            super.handle(request,response);
         }
      };
View Full Code Here

      // Make sure we start clean
      System.out.println("Using database directory: "+config.getDatabaseDirectory());
     
      config.startServer();
     
      Client client = new Client(new Context(),config.getServerLocation().getSchemeProtocol()) {
         public void handle(Request request,Response response) {
            request.setChallengeResponse(new ChallengeResponse(ChallengeScheme.HTTP_BASIC,"admin","admin"));
            super.handle(request,response);
         }
      };
View Full Code Here

      }
      serviceBase = baseURI==null ? URI.create(href) : baseURI.resolve(href);
      authURL = serviceBase.resolve("./auth?session=false").toString();
      sessionURL = serviceBase.resolve("./auth/").toString();
      Protocol protocol = Protocol.valueOf(serviceBase.getScheme());
      client = new Client(new Context(LOG),protocol);
      client.getContext().getAttributes().put("hostnameVerifier", org.apache.commons.ssl.HostnameVerifier.DEFAULT);
      parser = new XMLRepresentationParser();
      passwords = new TreeMap<String,String>();
      userCache = new Cache<String,User>(100,2*60*1000) {
         public User fetch(AuthCredentials cred,String alias)
View Full Code Here

      // Make sure we start clean
      log.info("Using database directory: "+config.getDatabaseDirectory());
     
      config.startServer();
     
      Client client = new Client(new Context(),config.getServerLocation().getSchemeProtocol());

      loop(log,client);

      loop(log,client);
     
View Full Code Here

      // Make sure we start clean
      log.info("Using database directory: "+config.getDatabaseDirectory());
     
      config.startServer();
     
      Client client = new Client(new Context(),config.getServerLocation().getSchemeProtocol());

      long start = System.currentTimeMillis();

      loop(log,client);
View Full Code Here

   }
  
   public void introspect(ServiceListener listener)
      throws IOException,XMLException
   {
      Client client = new Client(new Context(Logger.getLogger(IntrospectionClient.class.getName())),Protocol.valueOf(location.getScheme()));
      client.getContext().getAttributes().put("hostnameVerifier", org.apache.commons.ssl.HostnameVerifier.DEFAULT);
      Request request = new Request(Method.GET,location.toString());
      if (identity!=null) {
         request.setChallengeResponse(new ChallengeResponse(ChallengeScheme.HTTP_BASIC,identity.getName(),identity.getPassword()));
      }
View Full Code Here

TOP

Related Classes of org.restlet.Context

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.