Package org.restlet

Examples of org.restlet.Restlet


      throws Exception
   {
      Storage storage = storageFactory.getStorage(info.getDB());
      AtomApplication app = new AtomApplication(childContext,info.getAuthService(),info.getDB(),storage,allowQueries);

      Restlet adminApp = admins.get(info.getName());
      if (adminApp==null) {
         getLogger().warning("There is no admin restlet for "+info.getName());
      }

      Router router = new Router(childContext);
View Full Code Here


         if (alias==null) {
            alias = info.getName();
         }
         String key = group+"."+alias;
         getLogger().info("Adding static APP key "+key);
         Restlet app = makeApp(info,host.allowQueries(),host.allowEditClient(),key);
         apps.put(key,app);
      }
      vhost.attach("/{group}/{alias}",new Restlet() {
         public void handle(Request request, Response response) {
            try {
               String rgroup = request.getAttributes().get("group").toString();
               String ralias = request.getAttributes().get("alias").toString();
               String rkey = rgroup+"."+ralias;
               Restlet restlet = apps.get(rkey);
               if (restlet==null) {
                  for (DBInfo info : autodbList.values()) {
                     if (checkNames && !host.getDatabases().contains(info.getName())) {
                        continue;
                     }
                     String group = info.getGroup();
                     String alias = info.getAlias();
                     if (group==null) {
                        continue;
                     }
                     if (alias==null) {
                        alias = info.getName();
                     }
                     String key = group+"."+alias;
                     Restlet app = makeApp(info,host.allowQueries(),host.allowEditClient(),key);
                     getLogger().info("Adding dynamic APP key "+key);
                     apps.put(key,app);
                     restlet = app;
                  }
               }
View Full Code Here

                  // the database was removed
                  DBInfo dbinfo = autodbList.remove(name);
                  dbinfo.getDB().stop();
                  Storage storage = storageFactory.getStorage(dbinfo.getDB());
                  storage.stop();
                  Restlet admin = admins.remove(name);
                  if (admin!=null) {
                     for (Router router : adminRouters) {
                        router.detach(admin);
                     }
                  }
View Full Code Here

   {
      super(context);
   }
  
   public Restlet createRoot() {
      return new Restlet(getContext()) {
         public void handle(Request request,Response response) {
            StringBuilder builder = new StringBuilder();
            builder.append("Resource : "+request.getResourceRef()+"\n");
            builder.append("Base     : "+request.getResourceRef().getBaseRef()+"\n");
            builder.append("Remaining: "+request.getResourceRef().getRemainingPart()+"\n\n");
View Full Code Here

   {
      super(context);
   }
  
   public Restlet createRoot() {
      return new Restlet(getContext()) {
         public void handle(Request request,Response response) {
            File f = new File("/tmp/"+request.getResourceRef().getRemainingPart());
            response.setEntity(new FileRepresentation(f,MediaType.TEXT_PLAIN));
            response.setStatus(Status.SUCCESS_OK);
         }
View Full Code Here

   public void setResource(String name) {
      this.resourceName = null;
   }
  
   public Restlet createRoot() {
      return new Restlet(getContext()) {
         boolean isFineLog = getLogger().isLoggable(Level.FINE);
         public void handle(final Request request,Response response) {
            if (!request.getMethod().equals(Method.GET)) {
               response.setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
               return;
View Full Code Here

      this.username = username;
      this.password = password;
   }
  
   public Restlet createRoot() {
      return new Restlet(getContext()) {
         boolean isFineLog = getLogger().isLoggable(Level.FINE);
         public void handle(Request request,Response response)
         {
            String path = request.getResourceRef().getRemainingPart();
            if (path==null) {
View Full Code Here

               addAutoConfiguration(iface, link);
            }
         }

      }
      this.getDefaultHost().attach(new Restlet() {

         public void handle(Request request, Response response) {
            response.setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
         }
      });
View Full Code Here

   public Application getAdministration() {
      return new Application(context.createChildContext()) {
         public Restlet createRoot() {
            getContext().getAttributes().put(XMLDBResource.DBNAME_NAME, dbName);
            Router router = new Router(getContext());
            Restlet reindexer = new Restlet(getContext()) {
               public void handle(Request request,Response response) {
                  if (request.getMethod()!=Method.GET) {
                     response.setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
                     return;
                  }
View Full Code Here

        router.attach("/servers/{server}/domains/{domain}/mbeans/{mbean}/operations", OperationsResource.class);
        router.attach("/servers/{server}/domains/{domain}/mbeans/{mbean}/operations/{operation}", OperationResource.class);       
       
        // Very ugly way to provide the index.html in a reliable way... I did not figure how to do
        // it properly.
        router.attach("/", new Restlet() {

            @Override
            public void handle(Request request, Response response)
            {
                response.setEntity(new StreamRepresentation(MediaType.TEXT_HTML) {
View Full Code Here

TOP

Related Classes of org.restlet.Restlet

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.