如何在 ColdFusion 8 中调用 java 方法并向其传递 Coldfusion Session 变量?

发布于 2024-11-30 06:45:46 字数 1022 浏览 0 评论 0原文

我正在尝试将下面的 java 方法调用到 CFM 页面,但我似乎无法获取它。此外,我需要设置 CF 会话变量的值。

Provider.sendResponse(getServletContext(), 响应, IntegrationIDs.AuthnContextClasses.name, 用户名, 属性);

预先感谢您提供的任何帮助。

这是我的代码示例,

<cfset Obj = createobject("java","com.blah.blah.blah.Provider")/>

<cfset servletContext = />
<cfset response = />
<cfset serverName = SESSION.server/>
<cfset authnContext = />
<cfset uid = SESSION.uid />
<cfset attributes = />
<cfset targetUrl = http://yyy.com/>

<cfset Obj_value = Obj.sendResponse(
             javax.servlet.ServletContext servletContext,
             javax.servlet.http.HttpServletResponse response,
             java.lang.String ServerName,
             java.lang.String authnContext,
             java.lang.String uid,
             java.util.Map<java.lang.String,java.util.List<java.lang.String>>attributes,
             java.lang.String targetUrl)/> 

我是否以错误的方式处理这个问题。预先感谢您提供的任何帮助。非常欣赏。

I am trying to invoke the java method below to a CFM page and I can not seem to get it. Additionally I need to set the values from CF session variables.

Provider.sendResponse(getServletContext(), response, IntegrationIDs.AuthnContextClasses.name, userName, attributes);

Thank you in advance for any assistance.

Here is my code example

<cfset Obj = createobject("java","com.blah.blah.blah.Provider")/>

<cfset servletContext = />
<cfset response = />
<cfset serverName = SESSION.server/>
<cfset authnContext = />
<cfset uid = SESSION.uid />
<cfset attributes = />
<cfset targetUrl = http://yyy.com/>

<cfset Obj_value = Obj.sendResponse(
             javax.servlet.ServletContext servletContext,
             javax.servlet.http.HttpServletResponse response,
             java.lang.String ServerName,
             java.lang.String authnContext,
             java.lang.String uid,
             java.util.Map<java.lang.String,java.util.List<java.lang.String>>attributes,
             java.lang.String targetUrl)/> 

Am I approaching this the wrong way. Thank you in advance for any assistance. Greatly appreciate.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

溺孤伤于心 2024-12-07 06:45:46

您的示例未显示对象的实际调用。我应该看到类似 createobject("java","com.blah.blah.blah.classname").init() 的东西,后面跟着要传递的变量的“setup”...比如“Repsonse=session.somevariabl”...您给出的示例太不完整,无法准确说明您遇到的困难。

要访问会话变量,请使用“session.XXX”。会话就像一个哈希表或向量(CF 术语中的“结构”)。如果“username”存储在会话中,则上面的示例可能类似于

Provider.sendResponse(getServletContext(), response, IntegrationIDs.AuthnContextClasses.name, session.Username, attribute );

但是如果没有更多的示例代码,我不确定您需要解决什么问题:)

Your example doesn't show the actual invoking of the object. I should see something like createobject("java","com.blah.blah.blah.classname").init() followed by "setup" of varialbes to pass ... like "Repsonse=session.somevariabl" ... the example you give is too incomplete to tell exactly where you are stumped.

To access a session variable you use "session.XXX". Session is like a hash table or vector (a "structure" in CF lingo). if "username" was stored in the session your example above could look like

Provider.sendResponse(getServletContext(), response, IntegrationIDs.AuthnContextClasses.name, session.Username, attributes);

But with out a bit more example code to go on I'm not sure what problem you need to solve :)

寂寞清仓 2024-12-07 06:45:46

您不需要在调用中定义参数类型。您将调用方法与定义方法混淆了。

<cfset Obj_value = Obj.sendResponse(
         servletContext,
         response,
         ServerName,
         authnContext,
         uid,
         attributes,
         targetUrl)/> 

You do not need to define the parameter types in your call. You are confusing calling a method with defining one.

<cfset Obj_value = Obj.sendResponse(
         servletContext,
         response,
         ServerName,
         authnContext,
         uid,
         attributes,
         targetUrl)/> 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文