You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Markus Pscheidt <ma...@weberhofer.at> on 2004/04/28 15:49:08 UTC

Unconditional session id with setForward()

Hi!

I would like to prevent creating sessions in my webapp which is based on
Struts and Velocity.

There is the StrutsLinkTool.setForward() method. Is it possible to prevent
the setForward() call from creating session ids??

I've read in a post at the velocity developer list that a session id is
created unconditionally in the setForward() call so maybe it is is not
possible..

Markus

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Unconditional session id with setForward()

Posted by Markus Pscheidt <ma...@weberhofer.at>.
> Markus Pscheidt said:
>> I would like to prevent creating sessions in my webapp which is based on
>> Struts and Velocity.
>
> ok.
>
>> There is the StrutsLinkTool.setForward() method. Is it possible to
>> prevent
>> the setForward() call from creating session ids??
>
> hmm.  i'm pretty sure that LinkTool/StrutsLinkTool doesn't create session
> ids.
> they also shouldn't create sessions.  however, they do always call
> response.encodeURL(String), which is supposed to encode the session id
> into
> the URL if sessions are being used but cookies are not supported
>
> see
> http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletResponse.html#encodeURL(java.lang.String)
> for more on this.
>
>> I've read in a post at the velocity developer list that a session id is
>> created unconditionally in the setForward() call so maybe it is is not
>> possible..
>
> really?
> could you post a link to this so i can be sure i'm not mistaken?
>
> Nathan Bubna
> nathan@esha.com
>
>

>
>
>

Here is the link:
http://www.mail-archive.com/velocity-dev@jakarta.apache.org/msg07893.html

The relevant lines are quoted here:

...
>how is this method an improvement on HttpServletResponse's
>encodeURL(String)
>method (which is called as the final step in LinkTool.toString())?
...
The difference from the HttpServletResponse counterpart is that this one
puts the session id in unconditionally.
...

Markus



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Unconditional session id with setForward()

Posted by Nathan Bubna <na...@esha.com>.
Markus Pscheidt said:
> I would like to prevent creating sessions in my webapp which is based on
> Struts and Velocity.

ok.

> There is the StrutsLinkTool.setForward() method. Is it possible to prevent
> the setForward() call from creating session ids??

hmm.  i'm pretty sure that LinkTool/StrutsLinkTool doesn't create session ids.
they also shouldn't create sessions.  however, they do always call
response.encodeURL(String), which is supposed to encode the session id into
the URL if sessions are being used but cookies are not supported

see
http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletResponse.html#encodeURL(java.lang.String)
for more on this.

> I've read in a post at the velocity developer list that a session id is
> created unconditionally in the setForward() call so maybe it is is not
> possible..

really?
could you post a link to this so i can be sure i'm not mistaken?

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Configuration Problem in Oracle9iAs

Posted by Mike Kienenberger <mk...@alaska.net>.
Rana Asif Rubbani <ra...@adamsoftintl.com> wrote:
> Please advise that why the script files are not being picked up while in a
> template or i have to access them using absolute URLs or paths.
> the templates are being picked up fine but not the js files in them.


This is an Oracle Application Server question, not a velocity question.

However, using OAS 10g, Velocity, and struts, here is an example of how I do 
it for a ccs file.

	<link rel=stylesheet 
href="${request.getScheme()}://${request.getServerName()}:${request.getServerPort()}${request.getContextPath()}/img/ebpp.css" 
type="text/css">

This assumes that /img is at the same level (ie, main level) in your war 
file as /WEB-INF.


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Configuration Problem in Oracle9iAs

Posted by Rana Asif Rubbani <ra...@adamsoftintl.com>.
Hi

I'm trying to run velocity in Oracle9iAs and i'm quite new to velocity
world.

The directory structure my application in Oracle9iAs is

all jsp/velocity templates are in
D:/oracle9ias/j2ee/home/applications/doccomply/doccomply/

I'm using a javascript file lets say test.js in a velocity template but when
html is rendered the js file is not picked up and it gives a javascript
error.

e.g. the code for inclusion of javacript is

<script scr="test.js" language="JavaScript"></script>

but when i give absolute url or path in the template like

<script scr="$url/test.js" language="JavaScript"></script>

where url = http://jupiter:7778/doccomply

it works fine...
I'm afraid that when thi s code will be deployed on testing or production
servers the url will change and my code will not work.
Different users access the same application in production using different
URLs.

Please advise that why the script files are not being picked up while in a
template or i have to access them using absolute URLs or paths.
the templates are being picked up fine but not the js files in them.


regards
Rana Asif Rubbani


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Unconditional session id with setForward()

Posted by Mike Kienenberger <mk...@alaska.net>.
Markus Pscheidt <ma...@weberhofer.at> wrote:
> I would like to prevent creating sessions in my webapp which is based on
> Struts and Velocity.
> 
> There is the StrutsLinkTool.setForward() method. Is it possible to prevent
> the setForward() call from creating session ids??
> 
> I've read in a post at the velocity developer list that a session id is
> created unconditionally in the setForward() call so maybe it is is not
> possible..

The general approach to this would be to subclass StrutsLinkTool, change 
setForward so that it won't create a session id, and update your toolbox.xml 
file to use your new LinkTool.

The "change setForward" step is something you'll have to investigate.   It 
may require a little work.

-Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org