自定义会话ID生成实现UuidGenerator [英] Custom session id generation implement UuidGenerator

查看:518
本文介绍了自定义会话ID生成实现UuidGenerator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在glassfish服务器中为我的搜索设置会话id生成(自定义会话ID生成)的cutom类,从我的搜索到现在我发现自定义类应该实现com sun enterprise uuid.UuidGeneratorclass



所以我试图创建自己的类作为

  import com.sun.enterprise。 util.uuid; 
public class Customsessionid实现UuidGenerator {


public UuidGeneratorImpl()
{
}

public String generateUuid(){
返回UuidUtil.generateUuid();
}

public String generateUuid(Object obj){
return UuidUtil.generateUuid(obj);
}

}

但是import导致错误为package not发现

任何人都可以帮助我实现UuiGenerator类,如果您可以提前致谢,请提供sutom会话ID生成代码

解决方案

您无法以您尝试的方式导入软件包。您必须使用通配符或导入特定的类:



试试这个:

  import com.sun.enterprise.util.uuid。*; 

有关包和导入的详细说明可以参见 here (尤其是示例7.5.1-3。否导入一个子包装


i want to set cutom class for session id generation(Custom session id generation) in glassfish server , from my search till now i found that custom class should implement "com sun enterprise util uuid.UuidGenerator" class

so i tried to create my own class as

import com.sun.enterprise.util.uuid;
public class Customsessionid implements UuidGenerator {


    public UuidGeneratorImpl() 
    {
    }

    public String generateUuid() {
        return UuidUtil.generateUuid();
    }

    public String generateUuid(Object obj) {
        return UuidUtil.generateUuid(obj);
    }

}

but import gives error as package not found

can anybody help me implementing UuiGenerator class please provide code for sutom session id generation if you can thanks in advance

解决方案

You can't import a package in the way you tried. You have to use a wildcard or import a specific class:

Try this:

import com.sun.enterprise.util.uuid.*;

A detailed explanation of packages and imports can be found here (especially Example 7.5.1-3. No Import of a Subpackage)

这篇关于自定义会话ID生成实现UuidGenerator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆