• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Resource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.tapestry5.ioc.Resource的典型用法代码示例。如果您正苦于以下问题:Java Resource类的具体用法?Java Resource怎么用?Java Resource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Resource类属于org.apache.tapestry5.ioc包,在下文中一共展示了Resource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setupJSModules

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
@Contribute(ModuleManager.class)
public static void setupJSModules(final MappedConfiguration<String, JavaScriptModuleConfiguration> configuration,
    @Path("classpath:de/eddyson/tapestry/react/select/react-select.js") final Resource reactSelect,
    @Path("classpath:de/eddyson/tapestry/react/select/react-select.min.js") final Resource reactSelectMin,
    @Path("classpath:de/eddyson/tapestry/react/select/react-input-autosize.js") final Resource reactInputautoSize,
    @Path("classpath:de/eddyson/tapestry/react/select/react-input-autosize.min.js") final Resource reactInputautoSizeMin,
    @Path("classpath:de/eddyson/tapestry/react/select/classnames.js") final Resource classnames,
    @Symbol(ReactSelectSymbols.CONTRIBUTE_CLASSNAMES_MODULE) final boolean contributeClassnamesModule,
    @Symbol(ReactSelectSymbols.CONTRIBUTE_REACT_INPUT_AUTOSIZE_MODULE) final boolean contributeInputAutosizeModule,
    @Symbol(SymbolConstants.PRODUCTION_MODE) final boolean productionMode) throws IOException {
  if (contributeClassnamesModule) {
    configuration.add("classnames", new JavaScriptModuleConfiguration(classnames));
  }
  if (contributeInputAutosizeModule) {
    configuration.add("react-input-autosize",
        new JavaScriptModuleConfiguration(productionMode ? reactInputautoSizeMin : reactInputautoSize));
  }
  configuration.add("react-select", new JavaScriptModuleConfiguration(productionMode ? reactSelectMin : reactSelect));
}
 
开发者ID:eddyson-de,项目名称:tapestry-react-select,代码行数:20,代码来源:ReactSelectModule.java


示例2: Angular2JavascriptStack

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
public Angular2JavascriptStack(@Symbol(SymbolConstants.PRODUCTION_MODE)
                               final boolean productionMode,
                               @Path("webjars:es6-shim:es6-shim.js") final Resource es6_shim, 
                               @Path("webjars:zone.js:$version/dist/zone.js") final Resource zoneJs,
                               @Path("webjars:reflect-metadata:$version/Reflect.js") final Resource reflectMetadata,
                               @Path("webjars:systemjs:dist/system.src.js") final Resource systemjs, 
                               @Path("webjars:rxjs:bundles/Rx.js") final Resource rx,
                               @Path("webjars:angular__core:$version/bundles/core.umd.js") final Resource angular2,	
                               final AssetSource assetSource)
{
    this.productionMode = productionMode;
    
    this.es6_shim = es6_shim; 
    this.zoneJs = zoneJs;
    this.reflectMetadata = reflectMetadata;
    this.systemjs = systemjs;
    this.rx = rx;
    this.angular2 = angular2;
    
    this.assetSource = assetSource;
  
}
 
开发者ID:ffacon,项目名称:tapestry5-angular2,代码行数:23,代码来源:Angular2JavascriptStack.java


示例3: after

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
@AfterRender
void after(MarkupWriter writer){
 Resource res;
 Asset asset;
 if(!isListEmpty())
 {
	 for (String script : scriptList){
		 try{
		 res=moduleManager.findResourceForModule(script);
		 asset=assetSource.getUnlocalizedAsset(res.toString());
		 String url = asset.toClientURL();
		 writer.element("script", "type", "text/javascript", "src", url);
		 writer.end();}
		 catch(Exception ex)
		 {
			  logger.error("Script not found:"+ ex.getMessage());
		 }
	 }
 }
 
}
 
开发者ID:ffacon,项目名称:tapestry5-angular2,代码行数:22,代码来源:A2Dependencies.java


示例4: setupJSModules

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
@Contribute(ModuleManager.class)
public static void setupJSModules(final MappedConfiguration<String, JavaScriptModuleConfiguration> configuration,
    @Path("webjars:es6-shim:es6-shim.js") final Resource es6_shim, 
    @Path("webjars:zone.js:$version/dist/zone.js") final Resource zoneJs,
    @Path("webjars:reflect-metadata:$version/Reflect.js") final Resource reflectMetadata,
    @Path("webjars:systemjs:dist/system.src.js") final Resource systemjs, 
    @Path("webjars:rxjs:bundles/Rx.js") final Resource rx,
    @Path("webjars:angular__core:$version/bundles/core.umd.js") final Resource angular2,
    @Path("webjars:angular__router:$version/bundles/router.umd.js") final Resource router,
    @Path("webjars:angular__http:$version/bundles/http.umd.js") final Resource http,
    @Path("webjars:angular__platform-browser-dynamic:$version/bundles/platform-browser-dynamic.umd.js") final Resource platformBrowserDynamicTesting,
    @Path("webjars:typescript:lib/tsc.js") final Resource tsc,
    @Symbol(SymbolConstants.PRODUCTION_MODE) final boolean productionMode) {

  configuration.add("es6-shim", new JavaScriptModuleConfiguration(es6_shim));
  configuration.add(A2Script.ZONE_JS.text, new JavaScriptModuleConfiguration(zoneJs));
  configuration.add(A2Script.REFLECT_METADATA.text, new JavaScriptModuleConfiguration(reflectMetadata));
  configuration.add(A2Script.SYSTEM.text, new JavaScriptModuleConfiguration(systemjs));
  configuration.add(A2Script.RX.text, new JavaScriptModuleConfiguration(rx));
  configuration.add(A2Script.A2_ANGULAR.text, new JavaScriptModuleConfiguration(angular2));
  configuration.add(A2Script.A2_ROUTER.text, new JavaScriptModuleConfiguration(router));
  configuration.add(A2Script.A2_HTTP.text, new JavaScriptModuleConfiguration(http));
  configuration.add(A2Script.A2_PLATFORM_BROWSER_DYNAMIC.text, new JavaScriptModuleConfiguration(platformBrowserDynamicTesting));
  configuration.add("tsc", new JavaScriptModuleConfiguration(tsc));
  
  
}
 
开发者ID:ffacon,项目名称:tapestry5-angular2,代码行数:28,代码来源:Angular2Module.java


示例5: TSCompiler

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
public TSCompiler(final OperationTracker tracker,
    @Path("webjars:typescript:lib/typescript.js") final Resource typescript) {
 this.typescript = typescript;
 this.tracker = tracker;  
    this.useColoredOutput = Boolean.TRUE;
    this.executorPool = new RhinoExecutorPool(tracker, Arrays.<Resource> asList(typescript,new ClasspathResource("org/got5/tapestry5/angular2/services/typescriptCompile.js")));

}
 
开发者ID:ffacon,项目名称:tapestry5-angular2,代码行数:9,代码来源:TSCompiler.java


示例6: transform

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
public InputStream transform(final Resource source, final ResourceDependencies dependencies) throws IOException {
  InputStream is = null;
  String content;


  
  try {
    is = source.openStream();
    content = IOUtils.toString(is, UTF8);
  } finally {
    InternalUtils.close(is);
  }
 
  RhinoExecutor executor = executorPool.get();

  String fileName = source.getFile();
  if (fileName != null && fileName.endsWith(".ts")) {
  }

  try {

    NativeObject result = (NativeObject) executor.invokeFunction("transpile", content, source.toString(),
        "{noEmitOnError: true, noImplicitAny: true,target: ts.ScriptTarget.ES6, module: ts.ModuleKind.CommonJS}");

    if (result.containsKey("exception")) {
      throw new RuntimeException(getString(result, "exception"));
    }

    return IOUtils.toInputStream(getString(result, "output"), UTF8);

  } finally {
    executor.discard();
  }

}
 
开发者ID:ffacon,项目名称:tapestry5-angular2,代码行数:36,代码来源:TSCompiler.java


示例7: transform

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
@Override
public InputStream transform(final Resource source, final ResourceDependencies dependencies) throws IOException {
  try (InputStream is = source.openStream()) {
    String content = IOUtils.toString(is, StandardCharsets.UTF_8);
    String fileName = source.getFile();
    boolean isES6Module = false;
    boolean withReact = false;
    if (fileName != null) {
      int idx = fileName.lastIndexOf('.');
      if (idx >= -1) {
        String extension = fileName.substring(idx + 1);
        switch (extension) {
        case "jsm":
          isES6Module = true;
          break;
        case "jsxm":
          isES6Module = true;
          withReact = true;
          break;
        case "jsx":
          withReact = true;
          break;
        }
      }
    }

    Map<String, String> result = babelCompiler.compile(Collections.singletonMap(fileName, content), isES6Module,
        useColoredOutput, withReact, productionMode, enableStage3Transformations);
    return IOUtils.toInputStream(result.get(fileName), StandardCharsets.UTF_8);
  }
}
 
开发者ID:eddyson-de,项目名称:tapestry-react,代码行数:32,代码来源:BabelResourceTransformer.java


示例8: NodeBabelCompiler

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
public NodeBabelCompiler(final Resource mainCompiler) throws IOException {
  try (InputStream is = mainCompiler.openStream();
      InputStream wrapperIs = NodeBabelCompiler.class
          .getResourceAsStream("/de/eddyson/tapestry/react/services/babel-compiler-wrapper.js")) {
    this.compilerText = IOUtils.toString(is, StandardCharsets.UTF_8)
        + IOUtils.toString(wrapperIs, StandardCharsets.UTF_8);
  }
}
 
开发者ID:eddyson-de,项目名称:tapestry-react,代码行数:9,代码来源:NodeBabelCompiler.java


示例9: newResource

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
@Override
protected Resource newResource(final String path) {
  if (!path.isEmpty() && path.charAt(0) == '/') {
    String p = assetPathResolver.resolve(path.substring(1));
    return new WebjarsResource(p, assetPathResolver, classLoader);
  }
  return new WebjarsResource(path, assetPathResolver, classLoader);
}
 
开发者ID:eddyson-de,项目名称:tapestry-webjars,代码行数:9,代码来源:WebjarsResource.java


示例10: initializeAssetsFromPaths

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
private void initializeAssetsFromPaths(final Resource baseResource,
        final String[] expandedPaths, final PlasticField assetsField)
{
    assetsField.injectComputed(new ComputedValue<Asset[]>()
    {

        @Override
        public Asset[] get(InstanceContext context)
        {
            ComponentResources resources = context.get(ComponentResources.class);

            return convertPathsToAssetArray(baseResource, resources.getLocale(), expandedPaths);
        }
    });
}
 
开发者ID:pubfactory,项目名称:tapestry-compat,代码行数:16,代码来源:AbstractIncludeWorker.java


示例11: convertPathsToAssetArray

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
private Asset[] convertPathsToAssetArray(final Resource baseResource, final Locale locale, String[] assetPaths)
{
    return F.flow(assetPaths).map(new Mapper<String, Asset>()
    {

        @Override
        public Asset map(String assetPath)
        {
            return assetSource.getAsset(baseResource, assetPath, locale);
        }
    }).toArray(Asset.class);
}
 
开发者ID:pubfactory,项目名称:tapestry-compat,代码行数:13,代码来源:AbstractIncludeWorker.java


示例12: getImage

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
public Asset getImage() {
	return new Asset() {
		
		public String toClientURL() {
			return "https://www.paypal.com/en_US/i/logo/PayPal_mark_37x23.gif";
		}
		
		public Resource getResource() {
			return null;
		}
	};
}
 
开发者ID:trsvax,项目名称:tapestry-paypal-rest,代码行数:13,代码来源:PayPalButton.java


示例13: MinifyResource

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
MinifyResource(final Resource resource) {
  this.resource = resource;
}
 
开发者ID:eddyson-de,项目名称:tapestry-minification-cache-warming,代码行数:4,代码来源:MinificationCacheWarmingImpl.java


示例14: RhinoBabelCompiler

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
public RhinoBabelCompiler(final OperationTracker tracker, final Resource mainCompiler) {
  executorPool = new RhinoExecutorPool(tracker,
      CollectionFactory.<Resource, Resource>newList(mainCompiler,
          new ClasspathResource(RhinoBabelCompiler.class.getClassLoader(),
              "de/eddyson/tapestry/react/services/babel-compiler-wrapper.js")));
}
 
开发者ID:eddyson-de,项目名称:tapestry-react,代码行数:7,代码来源:RhinoBabelCompiler.java


示例15: createFromRequestPath

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
public Resource createFromRequestPath(final String path) {
  return new WebjarsResource(WebJarAssetLocator.WEBJARS_PATH_PREFIX + "/" + path, assetPathResolver, classLoader);
}
 
开发者ID:eddyson-de,项目名称:tapestry-webjars,代码行数:4,代码来源:WebjarsResource.java


示例16: createAsset

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
@Override
public Asset createAsset(final Resource resource) {
  return createAsset(resource, "webjars",
      ((WebjarsResource) resource).getPath().substring(WebJarAssetLocator.WEBJARS_PATH_PREFIX.length() + 1));
}
 
开发者ID:eddyson-de,项目名称:tapestry-webjars,代码行数:6,代码来源:WebjarsAssetFactory.java


示例17: CommonJSAMDWrapper

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
public CommonJSAMDWrapper(final Resource resource) {
  this.resource = resource;
}
 
开发者ID:eddyson-de,项目名称:tapestry-webjars,代码行数:4,代码来源:CommonJSAMDWrapper.java


示例18: transformResource

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
private Resource transformResource() {
  return new AMDModuleWrapperResource(resource);
}
 
开发者ID:eddyson-de,项目名称:tapestry-webjars,代码行数:4,代码来源:CommonJSAMDWrapper.java


示例19: getResource

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
/**
 * Returns <code>null</code>.
 */
@Override
public Resource getResource() {
	return null;
}
 
开发者ID:thiagohp,项目名称:eloquentia,代码行数:8,代码来源:AddCssFromTags.java


示例20: AMDModuleWrapperResource

import org.apache.tapestry5.ioc.Resource; //导入依赖的package包/类
public AMDModuleWrapperResource(final Resource resource) {
  this.resource = resource;

}
 
开发者ID:eddyson-de,项目名称:tapestry-webjars,代码行数:5,代码来源:CommonJSAMDWrapper.java



注:本文中的org.apache.tapestry5.ioc.Resource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CombatTagPlus类代码示例发布时间:2022-05-23
下一篇:
Java ContentType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap