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


Python Integer.toString方法代码示例

本文整理汇总了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)
开发者ID:alansferreira,项目名称:cb2java,代码行数:17,代码来源:text.py

示例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()
开发者ID:jcu-eresearch,项目名称:TDH-Research-Data-Catalogue,代码行数:78,代码来源:jws.py


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