org.restlet.resource.Directory.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.restlet.resource.Directory.<init>()方法的一些代码示例,展示了Directory.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Directory.<init>()方法的具体详情如下:
包路径:org.restlet.resource.Directory
类名称:Directory
方法名:<init>

Directory.<init>介绍

[英]Constructor.
[中]构造器。

代码示例

代码示例来源:origin: org.restlet.jse/org.restlet.example

@Override
  public Restlet createInboundRoot() {
    return new Directory(getContext(), ROOT_URI);
  }
};

代码示例来源:origin: org.restlet.jse/org.restlet.example

@Override
  public Restlet createInboundRoot() {
    getConnectorService().getClientProtocols().add(Protocol.CLAP);
    getConnectorService().getServerProtocols().add(Protocol.HTTP);
    final Directory directory = new Directory(getContext(),
        "clap://class");
    directory.setListingAllowed(true);
    directory.setDeeplyAccessible(true);
    return directory;
  }
};

代码示例来源:origin: org.restlet.jse/org.restlet.example

@Override
  public Restlet createInboundRoot() {
    Router router = new Router(getContext());

    // Serve static files (images, etc.)
    String rootUri = "file:///" + System.getProperty("user.home");
    Directory directory = new Directory(getContext(), rootUri);
    directory.setListingAllowed(true);
    router.attach("/home", directory);

    // Attach the hello web service
    router.attach("/hello", HelloServerResource.class);

    return router;
  }
}

代码示例来源:origin: org.umlg/runtime-restlet

slickgrid = new Directory(getContext(), "war:///javascript/");
  css = new Directory(getContext(), "war:///css");
} else if (restlet) {
  File current = new File(".");
  if (UmlgProperties.INSTANCE.isLoadUiResourcesFromFile()) {
    slickgrid = new Directory(getContext(), "file:///" + current.getAbsolutePath() + "/runtime/runtime-ui/src/main/webapp/javascript");
  } else {
    slickgrid = new Directory(getContext(), "clap:///javascript/");
    css = new Directory(getContext(), "file:///" + current.getAbsolutePath() + "/runtime/runtime-ui/src/main/webapp/css");
  } else {
    css = new Directory(getContext(), "clap:///css");

代码示例来源:origin: org.restlet.jse/org.restlet.example

@Override
public Restlet createInboundRoot() {
  // Create a simple password verifier
  MapVerifier verifier = new MapVerifier();
  verifier.getLocalSecrets().put("scott", "tiger".toCharArray());
  DigestAuthenticator guard = new DigestAuthenticator(getContext(),
      "TestRealm", "mySecretServerKey");
  MapVerifier mapVerifier = new MapVerifier();
  mapVerifier.getLocalSecrets().put("scott", "tiger".toCharArray());
  guard.setWrappedVerifier(mapVerifier);
  // Create a Directory able to return a deep hierarchy of files
  Directory directory = new Directory(getContext(), "file:///tmp");
  directory.setListingAllowed(true);
  guard.setNext(directory);
  return guard;
}

代码示例来源:origin: org.restlet.osgi/org.restlet.ext.osgi

/**
 * Creates the Restlet Directory instance using the rootUri, indexName,
 * deeplyAccessible, modifiable, and negotiatingContent service properties
 * 
 * @param context
 *            the Restlet application context
 * @return the configured Restlet Directory
 */
protected Directory createDirectory(Context context) {
  Directory directory = new Directory(context, rootUri);
  directory.setIndexName(indexName);
  directory.setDeeplyAccessible(deeplyAccessible);
  directory.setModifiable(modifiable);
  directory.setNegotiatingContent(negotiatingContent);
  return directory;
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

@Override
public Restlet createInboundRoot() {
  // Create a simple password verifier
  MapVerifier verifier = new MapVerifier();
  verifier.getLocalSecrets().put("scott", "tiger".toCharArray());
  // Create a Guard
  ChallengeAuthenticator authenticator = new ChallengeAuthenticator(
      getContext(), ChallengeScheme.HTTP_BASIC, "Tutorial");
  authenticator.setVerifier(verifier);
  // Create a Directory able to return a deep hierarchy of files
  Directory directory = new Directory(getContext(), ROOT_URI);
  directory.setListingAllowed(true);
  authenticator.setNext(directory);
  return authenticator;
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

@Override
public Restlet createInboundRoot() {
  // Create a simple password verifier
  MapVerifier verifier = new MapVerifier();
  verifier.getLocalSecrets().put("scott", "tiger".toCharArray());
  // Create a guard
  ChallengeAuthenticator guard = new ChallengeAuthenticator(getContext(),
      ChallengeScheme.HTTP_BASIC, "Tutorial");
  guard.setVerifier(verifier);
  // Create a Directory able to return a deep hierarchy of files
  Directory directory = new Directory(getContext(), "file:///tmp");
  directory.setListingAllowed(true);
  guard.setNext(directory);
  return guard;
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

@Override
public Restlet createInboundRoot() {
  final Router router = new Router(getContext());
  // Redirect by defaul to the lst of users.
  router.attachDefault(new Redirector(getContext(), "/users",
      Redirector.MODE_CLIENT_PERMANENT));
  final Directory imgDirectory = new Directory(getContext(),
      LocalReference.createFileReference(webRootPath + "/images"));
  // Add a route for the image resources
  router.attach("/images", imgDirectory);
  final Directory cssDirectory = new Directory(getContext(),
      LocalReference
          .createFileReference(webRootPath + "/stylesheets"));
  // Add a route for the CSS resources
  router.attach("/stylesheets", cssDirectory);
  // Add a route for a Users resource
  router.attach("/users", UsersResource.class);
  // Add a route for a User resource
  router.attach("/users/{userId}", UserResource.class);
  // Add a route for a Contacts resource
  router.attach("/users/{userId}/contacts", ContactsResource.class);
  // Add a route for a Contact resource
  router.attach("/users/{userId}/contacts/{contactId}",
      ContactResource.class);
  return router;
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

Directory directory = new Directory(getContext(), ROOT_URI);
guard.setNext(directory);

代码示例来源:origin: org.restlet.jse/org.restlet.example

Directory directory = new Directory(getContext(), rootUri);
directory.setListingAllowed(true);
router.attach("/static", directory);

代码示例来源:origin: org.restlet.jse/org.restlet.example

final Directory resources = new Directory(getContext(), "clap://system/resources");

相关文章