本文整理汇总了Python中java.lang.Integer.toString方法的典型用法代码示例。如果您正苦于以下问题:Python Integer.toString方法的具体用法?Python Integer.toString怎么用?Python Integer.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang.Integer
的用法示例。
在下文中一共展示了Integer.toString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from java.lang import Integer [as 别名]
# 或者: from java.lang.Integer import toString [as 别名]
def __init__(self, w, b):
JDialog.__init__(self, w)
self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
self.panel = Panel()
self.getContentPane().add(self.panel)
t = Text()
t.addFocusListener(FocusLostListener(self.lostfocus))
self.panel + t
view = ""
for byte in b:
view += Integer.toString((0xFF & byte), 2).zfill(8)
view += ' '
t.settext(view[:-1])
self.pack()
self.setVisible(1)
示例2: __activate__
# 需要导入模块: from java.lang import Integer [as 别名]
# 或者: from java.lang.Integer import toString [as 别名]
def __activate__(self, context):
self.velocityContext = context
self.log = self.vc("log")
self.systemConfig = self.vc("systemConfig")
self.session = self.vc("sessionState")
self.response = self.vc("response")
self.request = self.vc("request")
self.msg = ""
self.appId = None
uri = URLDecoder.decode(self.request.getAttribute("RequestURI"))
matches = re.match("^(.*?)/(.*?)/(.*?)/(.*?)/(.*?)$", uri)
if matches and matches.group(5):
self.appId = matches.group(5)
if not self.appId:
self.msg = "No appId specified"
self.log.error(self.msg)
return
self.log.debug("Getting configuration for: " + self.appId)
self.consumerName = self.systemConfig.getString(None, "authserver", self.appId, "name")
self.sharedKey = self.systemConfig.getString(None, "authserver", self.appId, "sharedKey")
self.aud = self.systemConfig.getString(None, "authserver", self.appId, "aud")
self.iss = self.systemConfig.getString(None, "authserver", self.appId, "iss")
self.expiry = self.systemConfig.getInteger(None, "authserver", self.appId, "expiry")
self.logoutUrl = self.systemConfig.getString(None, "authserver", self.appId, "logoutUrl")
logout = self.request.getParameter("logout")
if logout == "1":
self.session.invalidate()
self.response.sendRedirect(self.logoutUrl)
return
if not self.consumerName:
self.msg = "Invalid configuration, no app name"
self.log.error(self.msg)
return
if not self.sharedKey:
self.msg = "Invalid shared Key"
self.log.error(self.msg)
return
if not self.aud:
self.msg = "Invalid aud"
self.log.error(self.msg)
return
if not self.iss:
self.msg = "Invalid iss"
self.log.error(self.msg)
return
if not self.expiry:
self.msg = "Invalid expiry"
self.log.error(self.msg)
return
# Because we don't trust the configuration
current_user = self.vc("page").authentication.get_username()
isAdmin = self.vc("page").authentication.is_admin()
# Admin only...
if not isAdmin:
self.msg = "Sorry, this page is only for administrators."
self.log.error(self.msg)
return
# Get the roles...
typ = "[\"" + "\",\"".join(self.vc("page").authentication.get_roles_list()) + "\"]"
# Generating signature...
dtNow = Date().getTime()
now = dtNow / 1000
iat = now
nbf = now - 1
exp = now + self.expiry
secRandom = SecureRandom()
jti = Long.toString(dtNow) + "_" + Integer.toString(secRandom.nextInt())
payload = Payload('{"iss":"%s", "sub":"%s", "aud":"%s", "iat":"%s", "nbf":"%s", "exp":"%s", "jti":"%s", "typ":%s}' % (self.iss, current_user, self.aud, iat, nbf, exp, jti, typ))
jwsHeader = JWSHeader(JWSAlgorithm.HS256)
macSigner = MACSigner(self.sharedKey)
jwsObject = JWSObject(jwsHeader, payload)
jwsObject.sign(macSigner)
self.jws = jwsObject.serialize()