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

Java Environment类代码示例

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

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



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

示例1: continueObjectCreationAsync

import com.google.apphosting.api.ApiProxy.Environment; //导入依赖的package包/类
/**
 * Runs calls in a background thread so that the results will actually be asynchronous.
 *
 * @see com.google.appengine.tools.cloudstorage.RawGcsService#continueObjectCreationAsync(
 *        com.google.appengine.tools.cloudstorage.RawGcsService.RawGcsCreationToken,
 *        java.nio.ByteBuffer, long)
 */
@Override
public Future<RawGcsCreationToken> continueObjectCreationAsync(final RawGcsCreationToken token,
    final ByteBuffer chunk, long timeoutMillis) {
  try {
    ensureInitialized();
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
  final Environment environment = ApiProxy.getCurrentEnvironment();
  return writePool.schedule(new Callable<RawGcsCreationToken>() {
    @Override
    public RawGcsCreationToken call() throws Exception {
      ApiProxy.setEnvironmentForCurrentThread(environment);
      return append(token, chunk);
    }
  }, 50, TimeUnit.MILLISECONDS);
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-gcs-client,代码行数:25,代码来源:LocalRawGcsService.java


示例2: printGaeProperties

import com.google.apphosting.api.ApiProxy.Environment; //导入依赖的package包/类
private void printGaeProperties(StringBuilder sb)
{
	sb.append("<h2>GAE Properties</h2>");
	Environment env = ApiProxy.getCurrentEnvironment();
	Iterator<Entry<String, Object>> iter = env.getAttributes().entrySet().iterator();
	sb.append("<table><tr><th>Name</th><th>Value</th></tr>");
	sb.append("<tr><td>").append("getAppId()").append("</td><td>").append(env.getAppId()).append("</td></tr>");
	sb.append("<tr><td>").append("getVersionId()").append("</td><td>").append(env.getVersionId()).append("</td></tr>");
	sb.append("<tr><td>").append("getModuleId()").append("</td><td>").append(env.getModuleId()).append("</td></tr>");
	sb.append("<tr><td>").append("getAuthDomain()").append("</td><td>").append(env.getAuthDomain()).append("</td></tr>");
	sb.append("<tr><td>").append("getEmail()").append("</td><td>").append(env.getEmail()).append("</td></tr>");

	UserService userService = UserServiceFactory.getUserService();
	boolean userLoggedIn = userService.isUserLoggedIn();
	sb.append("<tr><td>").append("isUserLoggedIn()").append("</td><td>").append(userLoggedIn).append("</td></tr>");
	if (userLoggedIn)
	{
		String logoutUrl = "Click <a href=\"" + userService.createLogoutURL(request.getRequestURI()) + "\">here</a> to Logout";
		sb.append("<tr><td>").append("createLogoutURL()").append("</td><td>").append(logoutUrl).append("</td></tr>");
	}
	else
	{
		String loginUrl = "Click <a href=\"" + userService.createLoginURL(request.getRequestURI()) + "\">here</a> to Login";
		sb.append("<tr><td>").append("createLoginURL()").append("</td><td>").append(loginUrl).append("</td></tr>");
	}

	while (iter.hasNext())
	{
		Entry<String, Object> entry = iter.next();
		String paramName = entry.getKey();
		String paramValue = entry.getValue().toString();
		sb.append("<tr><td>").append(paramName).append("</td><td>").append(paramValue).append("</td></tr>");
	}
	sb.append("</table>");
}
 
开发者ID:zach-m,项目名称:gae-jersey-guice-jsf,代码行数:36,代码来源:InfoAPI.java


示例3: getInfo

import com.google.apphosting.api.ApiProxy.Environment; //导入依赖的package包/类
public static String getInfo() {
  String version = SystemProperty.applicationVersion.get();
  String majorVersion = version.substring(0, version.indexOf('.'));
  Environment env = ApiProxy.getCurrentEnvironment();
  String hostname =
      "" + env.getAttributes().get("com.google.appengine.runtime.default_version_hostname");
  String infostring = "version: " + majorVersion + " and hostname: " + hostname;
  return infostring;
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-hello,代码行数:10,代码来源:HelloInfo.java


示例4: makeAsyncCall

import com.google.apphosting.api.ApiProxy.Environment; //导入依赖的package包/类
public Future<byte[]> makeAsyncCall(
    Environment environment,
    String packageName,
    String methodName,
    byte[] request,
    ApiProxy.ApiConfig apiConfig) {
  return oldDelegate.makeAsyncCall(environment, packageName, methodName, request, apiConfig);
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:9,代码来源:LogTest.java


示例5: doGet

import com.google.apphosting.api.ApiProxy.Environment; //导入依赖的package包/类
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
  resp.setContentType("text/plain");
  Environment env = ApiProxy.getCurrentEnvironment();

  for (Entry entry : env.getAttributes().entrySet()) {
    resp.getWriter().println(entry.getKey() + " => " + entry.getValue());
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:9,代码来源:GetEnvironmentAttributesServlet.java


示例6: getThreadLocalEnvironment

import com.google.apphosting.api.ApiProxy.Environment; //导入依赖的package包/类
/**
 * Returns the thread local environment if it is a VmApiProxyEnvironment.
 *
 * @return The ThreadLocal environment or null if no VmApiProxyEnvironment is set on this thread.
 */
private VmApiProxyEnvironment getThreadLocalEnvironment() {
  Environment env = ApiProxy.getCurrentEnvironment();
  if (env instanceof VmApiProxyEnvironment) {
    return (VmApiProxyEnvironment) env;
  }
  return null;
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:13,代码来源:VmRuntimeLogHandler.java


示例7: VmRequestThreadFactory

import com.google.apphosting.api.ApiProxy.Environment; //导入依赖的package包/类
/**
 * Create a new VmRequestThreadFactory.
 *
 * @param requestEnvironment The request environment to install on each thread.
 */
public VmRequestThreadFactory(Environment requestEnvironment) {
  this.mutex = new Object();
  this.requestEnvironment = requestEnvironment;
  this.createdThreads = Lists.newLinkedList();
  this.allowNewRequestThreadCreation = true;
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:12,代码来源:VmRequestThreadFactory.java


示例8: getThreadLocalEnvironment

import com.google.apphosting.api.ApiProxy.Environment; //导入依赖的package包/类
/**
 * Returns the thread local environment if it is a VmApiProxyEnvironment.
 *
 * @return The ThreadLocal environment or null if no VmApiProxyEnvironment is set.
 */
private VmApiProxyEnvironment getThreadLocalEnvironment() {
  Environment env = ApiProxy.getCurrentEnvironment();
  if (env instanceof VmApiProxyEnvironment) {
    return (VmApiProxyEnvironment) env;
  }
  return null;
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:13,代码来源:AppEngineAuthentication.java


示例9: doStart

import com.google.apphosting.api.ApiProxy.Environment; //导入依赖的package包/类
@Override
protected void doStart() throws Exception {
    this.helper = createHelper();
    this.environment = ApiProxy.getCurrentEnvironment();
    getServletContext().setAttribute(API_PROXY_LOCAL, ApiProxy.getDelegate());
    getServletContext().setAttribute(APPENGINE_WEB_XML, readAppengineWebXml());
    getServletContext().setAttribute(WEB_XML, readWebXml());
    SystemProperty.environment.set(SystemProperty.Environment.Value.Development);
    configureUserRealmAppengineHelper();
    super.doStart();
}
 
开发者ID:feroult,项目名称:yawp,代码行数:12,代码来源:AppengineWebAppContext.java


示例10: getBaseUrlWithoutSchema

import com.google.apphosting.api.ApiProxy.Environment; //导入依赖的package包/类
public static String getBaseUrlWithoutSchema() {
	if (SystemProperty.environment.value()!=SystemProperty.Environment.Value.Development) {
		String appId = AppHelper.getAppId();
		return appId+".appspot.com";
	} else {
		return "127.0.0.1:8888";
	}
}
 
开发者ID:andryfailli,项目名称:teampot,代码行数:9,代码来源:AppHelper.java


示例11: getAppId

import com.google.apphosting.api.ApiProxy.Environment; //导入依赖的package包/类
public static String getAppId() {
	Environment environment = ApiProxy.getCurrentEnvironment();
	
	String appFullId = environment.getAppId();
	int tildeIndex = appFullId.indexOf("~");
	
	return tildeIndex>-1 ? appFullId.substring(tildeIndex+1) : appFullId;		
}
 
开发者ID:andryfailli,项目名称:teampot,代码行数:9,代码来源:AppHelper.java


示例12: getRequestThreads

import com.google.apphosting.api.ApiProxy.Environment; //导入依赖的package包/类
public List<Thread> getRequestThreads(Environment environmnent) {
  return oldDelegate.getRequestThreads(environmnent);
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:4,代码来源:LogTest.java


示例13: makeSyncCall

import com.google.apphosting.api.ApiProxy.Environment; //导入依赖的package包/类
public byte[] makeSyncCall(
    Environment environment, String packageName, String methodName, byte[] request)
    throws ApiProxyException {
  return oldDelegate.makeSyncCall(environment, packageName, methodName, request);
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:6,代码来源:LogTest.java


示例14: log

import com.google.apphosting.api.ApiProxy.Environment; //导入依赖的package包/类
public void log(Environment environment, LogRecord record) {
  records.add(record);
  oldDelegate.log(environment, record);
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:5,代码来源:LogTest.java


示例15: flushLogs

import com.google.apphosting.api.ApiProxy.Environment; //导入依赖的package包/类
public void flushLogs(Environment environment) {
  oldDelegate.flushLogs(environment);
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:4,代码来源:LogTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java IMaven类代码示例发布时间:2022-05-23
下一篇:
Java TiesStrategy类代码示例发布时间: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