Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to pass cookie and HTTP headers from incoming request when ''calling" JSP?

New Here ,
Mar 14, 2012 Mar 14, 2012

Hi,

I am very new to ColdFusion, and have been experimenting with the different ways to "call" a JSP from CFML. I'm currently running ColdFusion 8 Developer deployed on GlassFish 3.1.1 (on Win2K3 64-bit).

Thus far, I have been looking at GetPageContext().include and .forward() and using <cfhttp>. 

I have some basic test scenarios working, but in my case, we are using a single sign-on product, Oracle OAM, and I'd like to (need to) be able to pass some of the cookies (e.g., the SSO cookie) that are on the incoming (to the .cfm) request through to the "called" JSP.

I know, that for example, with <cfhttp>, I can set parameters to set headers, but how can I (1) get the (for example) "Cookie:" header from the incoming request, and then set that into a parameter for <cfhttp>?

I also have a similar question in the case where GetPageContext().include() is used, rather than <cfhttp>.

Example code/snippets to do this would be greatly appreciated!!

Thanks,

Jim

2.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Mar 15, 2012 Mar 15, 2012

You can retrive the incoming cookie from the cookie scope and add it to the cfhttp request as another cfhttpparam

<cfhttpparam name="cookiename" type="cookie" value="#cookie.incomingCookieName#" />

jason

Translate
Advocate ,
Mar 15, 2012 Mar 15, 2012

You can retrive the incoming cookie from the cookie scope and add it to the cfhttp request as another cfhttpparam

<cfhttpparam name="cookiename" type="cookie" value="#cookie.incomingCookieName#" />

jason

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 15, 2012 Mar 15, 2012

Jason,

So, for example, if the cookie name on the incoming request is "MyCookieIn", and (for example) I want the cookie to go out with the request that gets caused by the <cfhttp>, but named as "MyCookieOut", then all I need to add is a <cfhttpparam> like:

<cfhttpparam name="MyCookieOut" type="cookie" value="#cookie.MyCookieIn#" />

and then when the <cfhttp> "happens", there'll be a cookie on the outgoing HTTP request named "MyCookieOut"?

Sorry for the (detailed) newbie question, but if that's all there is to it, it is SO cool !!

I thought that I'd have to dig into something like <cfscript>, etc. to pull the cookie out from the incoming request, etc., and was kind of dreading that ...

Jim

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 15, 2012 Mar 15, 2012

Yeah, that's it.

jason

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 16, 2012 Mar 16, 2012
LATEST

Jason,

I tried what you suggested, and it worked perfectly!

Thanks,

Jim

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources