Re: HttpServletRequest from Flowscript

2011-06-13 Thread Paul Joseph

Hi Jos,

Thank your for your reply--I am using that old workhourse,  Cocoon 2.1 (.11)

I find that there it appears to be not that simple at all.  I use 
flowscript and Java and am trying to implement Windows Single SIgn On 
with SPNEGO.


The issue is that it needs HttpServletRequest while all I have in the 
flowscript is cocoon.request which is not the same.


I found the following method on the web.

a) get the application context (avalon)

public void contextualize(Context context) throws ContextException {
objectModel = ContextHelper.getObjectModel(context);
}


b) then with the objectModel, we can do:
final HttpServletRequest httpRequest = (HttpServletRequest) 
objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT);



Good...but my problem is simple and after many hours I still don't know 
how to do this:


How does one access the Avalon context in Javascript and then pass it to 
the Java layer?


Now after much reading I find that I should probably write an Action and 
use the sitemap to fire the action.  I gather the sitemap will 
automatically make the objectmodel available to my action code and then 
I can proceed as in step b above.  My only problem is I have never 
written or used an action and so am a bit wary.


rgds
Paul

On 6/13/2011 12:00 AM, Jos Snellings wrote:

Hi Paul,

C3 or C2.2?
In cocoon-3 you may want to use:

import org.apache.cocoon.servlet.util.HttpContextHelper;

HttpServletRequest request;

public void setup(MapString, Object parameters) {

request = HttpContextHelper.getRequest(parameters);
}
from within a cocoon generator.

Cheers,
Jos

On 06/12/2011 07:01 PM, Paul Joseph wrote:

Hi there,

Does anyone know how one can pass the Cocoon request to a java 
function that needs to use HttpServletRequest?


I passed in the cocoon.request  to the Java function using but inside 
the Java code I am not able to cast the cocoon request to the 
HttpServletRequest.


Any guidance would be appreciated.

Paul

-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org



Re: HttpServletRequest from Flowscript

2011-06-13 Thread Jos Snellings

Well, that seems indeed like a rather complex way to achieve a simple thing.

How about this:
- 2.1 still has a horse called xsp, which is a scripting language 
ensuring nicely balanced tags. Like an xml-ized jsp.
  an xsp page has direct access to request data, and you have access to 
pages. I can send you an example.

- in 3 there is no xsp anymore (it got accused of witchcraft or so ;-) ).

Cheers,
Jos

On 06/13/2011 12:12 PM, Paul Joseph wrote:

Hi Jos,

Thank your for your reply--I am using that old workhourse,  Cocoon 2.1 
(.11)


I find that there it appears to be not that simple at all.  I use 
flowscript and Java and am trying to implement Windows Single SIgn On 
with SPNEGO.


The issue is that it needs HttpServletRequest while all I have in the 
flowscript is cocoon.request which is not the same.


I found the following method on the web.

a) get the application context (avalon)

public void contextualize(Context context) throws ContextException {
objectModel = ContextHelper.getObjectModel(context);
}


b) then with the objectModel, we can do:
final HttpServletRequest httpRequest = (HttpServletRequest) 
objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT);



Good...but my problem is simple and after many hours I still don't 
know how to do this:


How does one access the Avalon context in Javascript and then pass it 
to the Java layer?


Now after much reading I find that I should probably write an Action 
and use the sitemap to fire the action.  I gather the sitemap will 
automatically make the objectmodel available to my action code and 
then I can proceed as in step b above.  My only problem is I have 
never written or used an action and so am a bit wary.


rgds
Paul

On 6/13/2011 12:00 AM, Jos Snellings wrote:

Hi Paul,

C3 or C2.2?
In cocoon-3 you may want to use:

import org.apache.cocoon.servlet.util.HttpContextHelper;

HttpServletRequest request;

public void setup(MapString, Object parameters) {

request = HttpContextHelper.getRequest(parameters);
}
from within a cocoon generator.

Cheers,
Jos

On 06/12/2011 07:01 PM, Paul Joseph wrote:

Hi there,

Does anyone know how one can pass the Cocoon request to a java 
function that needs to use HttpServletRequest?


I passed in the cocoon.request  to the Java function using but 
inside the Java code I am not able to cast the cocoon request to the 
HttpServletRequest.


Any guidance would be appreciated.

Paul

-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org