当前位置: 首页>>代码示例>>Java>>正文


Java IConnection.hasAttribute方法代码示例

本文整理汇总了Java中org.red5.server.api.IConnection.hasAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java IConnection.hasAttribute方法的具体用法?Java IConnection.hasAttribute怎么用?Java IConnection.hasAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.red5.server.api.IConnection的用法示例。


在下文中一共展示了IConnection.hasAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: appDisconnect

import org.red5.server.api.IConnection; //导入方法依赖的package包/类
@Override
public void appDisconnect(IConnection conn) 
{
	String username;
	String roomname;
	
	try
	{
		if(conn.hasAttribute("username")){
			username = conn.getStringAttribute("username");
			roomname = conn.getStringAttribute("roomname");
			this.removeUser(username, roomname);
		}
	}
	catch(Exception e)
	{
		log.error("Error removing user : ", e);
	}
	
	super.appDisconnect(conn);
}
 
开发者ID:rajdeeprath,项目名称:red5-server-apps,代码行数:22,代码来源:Application.java

示例2: generateFilename

import org.red5.server.api.IConnection; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public String generateFilename(IScope scope, String name, String extension, GenerationType type) {
   	logger.debug("Get stream directory: scope={}, name={}, type={}", new Object[]{scope, name, type.toString()});		
	StringBuilder path = new StringBuilder();
	// get the session id
	IConnection conn = Red5.getConnectionLocal();
	if (conn.hasAttribute("sessionId")) {
		String sessionId = conn.getStringAttribute("sessionId");
		path.append(sessionId);
		path.append('/');
	}
	// add resources name
	path.append(name);
	// add extension if we have one
       if (extension != null){
           // add extension
       	path.append(extension);
       }		
	// determine whether its playback or record
	if (type.equals(GenerationType.PLAYBACK)) {
		logger.debug("Playback path used");
		// look on s3 for the file first	
		boolean found = false;
		try {
			S3Service s3Service = new RestS3Service(awsCredentials);
			S3Bucket bucket = s3Service.getBucket(bucketName);
			String objectKey = path.toString();
			S3Object file = s3Service.getObject(bucket, objectKey);
			if (file != null) {
				S3Object details = s3Service.getObjectDetails(bucket, objectKey);
				logger.debug("Details - key: {} content type: {}", details.getKey(), details.getContentType()); 
				path.insert(0, bucket.getLocation());
				// set found flag
				found = true;
			}
		} catch (S3ServiceException e) {
			logger.warn("Error looking up media file", e);
		}
		// use local path
		if (!found) {
			logger.debug("File was not found on S3, using local playback location");
			path.insert(0, playbackPath);
		}
	} else {
		logger.debug("Record path used");
		path.insert(0, recordPath);
	}

       String fileName = path.toString();
       logger.debug("Generated filename: {}", fileName);
       return fileName;
}
 
开发者ID:Red5,项目名称:red5-examples,代码行数:53,代码来源:S3FilenameGenerator.java


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