org.restlet.Application.getContext()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(101)

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

Application.getContext介绍

暂无

代码示例

代码示例来源:origin: uber/chaperone

public AdminRestletResource() {
 _helixMirrorMakerManager = (HelixMirrorMakerManager) getApplication().getContext()
   .getAttributes().get(HelixMirrorMakerManager.class.toString());
}

代码示例来源:origin: uber/chaperone

public TopicManagementRestletResource() {
 getVariants().add(new Variant(MediaType.TEXT_PLAIN));
 getVariants().add(new Variant(MediaType.APPLICATION_JSON));
 setNegotiated(false);
 _helixMirrorMakerManager = (HelixMirrorMakerManager) getApplication().getContext()
   .getAttributes().get(HelixMirrorMakerManager.class.toString());
 _autoTopicWhitelistingManager = (AutoTopicWhitelistingManager) getApplication().getContext()
   .getAttributes().get(AutoTopicWhitelistingManager.class.toString());
 if (getApplication().getContext().getAttributes()
   .containsKey(KafkaBrokerTopicObserver.class.toString())) {
  _srcKafkaBrokerTopicObserver = (KafkaBrokerTopicObserver) getApplication().getContext()
    .getAttributes().get(KafkaBrokerTopicObserver.class.toString());
 } else {
  _srcKafkaBrokerTopicObserver = null;
 }
}

代码示例来源:origin: uber/chaperone

public ValidationRestletResource() {
 getVariants().add(new Variant(MediaType.TEXT_PLAIN));
 getVariants().add(new Variant(MediaType.APPLICATION_JSON));
 setNegotiated(false);
 _validationManager = (ValidationManager) getApplication().getContext()
   .getAttributes().get(ValidationManager.class.toString());
 if (getApplication().getContext().getAttributes()
   .containsKey(SourceKafkaClusterValidationManager.class.toString())) {
  _srcKafkaValidationManager =
    (SourceKafkaClusterValidationManager) getApplication().getContext()
      .getAttributes().get(SourceKafkaClusterValidationManager.class.toString());
 } else {
  _srcKafkaValidationManager = null;
 }
}

代码示例来源:origin: ontopia/ontopia

public static Context getCurrentApplicationContext() {
  Application application = Application.getCurrent();
  if (application == null) {
    return null;
  }
  return application.getContext();
}

代码示例来源:origin: uber/uReplicator

public TopicParitionOffsetRestletResource() {
 _helixMirrorMakerManager = (HelixMirrorMakerManager) getApplication().getContext()
   .getAttributes().get(HelixMirrorMakerManager.class.toString());
}

代码示例来源:origin: uber/uReplicator

public AdminRestletResource() {
 _helixMirrorMakerManager = (HelixMirrorMakerManager) getApplication().getContext()
   .getAttributes().get(HelixMirrorMakerManager.class.toString());
}

代码示例来源:origin: uber/uReplicator

public MirrorMakerManagerRestletResource() {
 _helixMirrorMakerManager = (HelixMirrorMakerManager) getApplication().getContext()
   .getAttributes().get(HelixMirrorMakerManager.class.toString());
}

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

/**
 * Sets the inbound root Restlet.
 * 
 * @param inboundRoot
 *            The inbound root Restlet.
 */
public synchronized void setInboundRoot(Restlet inboundRoot) {
  this.inboundRoot = inboundRoot;
  if ((inboundRoot != null) && (inboundRoot.getContext() == null)) {
    inboundRoot.setContext(getContext());
  }
}

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

/**
 * Called by OSGi DS to inject the router provider service
 * 
 * @param routerProvider
 *            the router provider service
 */
public void bindRouterProvider(RouterProvider routerProvider) {
  this.routerProvider = routerProvider;
  if (application != null)
    application.setInboundRoot(routerProvider
        .getInboundRoot(application.getContext()));
}

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

/**
 * Sets the outbound root Restlet.
 * 
 * @param outboundRoot
 *            The outbound root Restlet.
 */
public synchronized void setOutboundRoot(Restlet outboundRoot) {
  this.outboundRoot = outboundRoot;
  if ((outboundRoot != null) && (outboundRoot.getContext() == null)) {
    outboundRoot.setContext(getContext());
  }
}

代码示例来源:origin: uber/uReplicator

public TopicManagementRestletResource() {
 getVariants().add(new Variant(MediaType.TEXT_PLAIN));
 getVariants().add(new Variant(MediaType.APPLICATION_JSON));
 setNegotiated(false);
 _conf = (ManagerConf) getApplication().getContext().getAttributes().get(ManagerConf.class.toString());
 _helixMirrorMakerManager = (ControllerHelixManager) getApplication().getContext()
   .getAttributes().get(ControllerHelixManager.class.toString());
 SourceKafkaClusterValidationManager srcKafkaValidationManager = (SourceKafkaClusterValidationManager) getApplication()
   .getContext().getAttributes().get(SourceKafkaClusterValidationManager.class.toString());
 _clusterToObserverMap = srcKafkaValidationManager.getClusterToObserverMap();
}

代码示例来源:origin: uber/uReplicator

public ValidationRestletResource() {
 getVariants().add(new Variant(MediaType.TEXT_PLAIN));
 getVariants().add(new Variant(MediaType.APPLICATION_JSON));
 setNegotiated(false);
 _validationManager = (ValidationManager) getApplication().getContext()
   .getAttributes().get(ValidationManager.class.toString());
 if (getApplication().getContext().getAttributes()
   .containsKey(SourceKafkaClusterValidationManager.class.toString())) {
  _srcKafkaValidationManager =
    (SourceKafkaClusterValidationManager) getApplication().getContext()
      .getAttributes().get(SourceKafkaClusterValidationManager.class.toString());
 } else {
  _srcKafkaValidationManager = null;
 }
}

代码示例来源:origin: uber/uReplicator

public TopicManagementRestletResource() {
 getVariants().add(new Variant(MediaType.TEXT_PLAIN));
 getVariants().add(new Variant(MediaType.APPLICATION_JSON));
 setNegotiated(false);
 _managerControllerHelix = (ManagerControllerHelix) getApplication().getContext()
   .getAttributes().get(ManagerControllerHelix.class.toString());
 _helixMirrorMakerManager = (HelixMirrorMakerManager) getApplication().getContext()
   .getAttributes().get(HelixMirrorMakerManager.class.toString());
 _autoTopicWhitelistingManager = (AutoTopicWhitelistingManager) getApplication().getContext()
   .getAttributes().get(AutoTopicWhitelistingManager.class.toString());
 if (getApplication().getContext().getAttributes()
   .containsKey(KafkaBrokerTopicObserver.class.toString())) {
  _srcKafkaBrokerTopicObserver = (KafkaBrokerTopicObserver) getApplication().getContext()
    .getAttributes().get(KafkaBrokerTopicObserver.class.toString());
 } else {
  _srcKafkaBrokerTopicObserver = null;
 }
}

代码示例来源:origin: uber/uReplicator

public AdminRestletResource() {
 getVariants().add(new Variant(MediaType.TEXT_PLAIN));
 getVariants().add(new Variant(MediaType.APPLICATION_JSON));
 setNegotiated(false);
 _helixMirrorMakerManager = (ControllerHelixManager) getApplication().getContext()
   .getAttributes().get(ControllerHelixManager.class.toString());
}

代码示例来源:origin: stackoverflow.com

Application app = getApplication();
if (app != null) {
  applicationContext = app.getContext();

代码示例来源:origin: locationtech/geowave

(ConcurrentHashMap<String, Future<?>>) this.getApplication().getContext().getAttributes().get(
    "asyncOperationStatuses");
if (opStatuses.get(id) != null) {

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server

@Override
protected Application createApplication(Context context)
{
  Application application = super.createApplication(context);
  /* Retrieve the application context in order to populate it with relevant variables. */
  Context applicationContext = application.getContext();
  /* Retrieve the component manager and make it available in the restlet application context. */
  ComponentManager componentManager =
    (ComponentManager) getServletContext().getAttribute("org.xwiki.component.manager.ComponentManager");
  applicationContext.getAttributes().put(Constants.XWIKI_COMPONENT_MANAGER, componentManager);
  /* Set the object factory for instantiating components. */
  if (application instanceof XWikiRestletJaxRsApplication) {
    XWikiRestletJaxRsApplication jaxrsApplication = (XWikiRestletJaxRsApplication) application;
    jaxrsApplication.setObjectFactory(new ComponentsObjectFactory(componentManager));
  } else {
    log("The Restlet application is not an instance of XWikiRestletJaxRsApplication. Please check your web.xml");
  }
  return application;
}

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

final Context applicationContext = application.getContext();

代码示例来源:origin: com.noelios.restlet/com.noelios.restlet.ext.servlet

final Context applicationContext = application.getContext();

代码示例来源:origin: ontopia/ontopia

@Override
  public Restlet createChain(Application application) {
    final Context context = application.getContext();
    
    // v1 has gzip compression
    
    // can be disabled by parameter
    application.getEncoderService().setEnabled(ContextUtils.getParameterAsBoolean(context, Constants.V1_COMPRESSION_PARAMETER, true));
    
    Filter encoder = application.getEncoderService().createInboundFilter(context);
    encoder.setName("Response encoder");
    encoder.setDescription("Allows Ontopia API call responses to be compressed");
    // under compression, router
    Router router = new Router(context);
    router.setName("v1 main router");
    encoder.setNext(router);
    
    router.attach("/topicmaps/{topicmap}", new TopicMapRouter(context));
    
    return encoder;
  }
};

相关文章