You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Greg Akins <an...@gmail.com> on 2010/08/25 16:46:11 UTC

URL "format" advice

I need to implement a webapp that uses the URL to determine the
"partner" that is accessing the application.  I'd like your opinion on
the way to do this that might work best with Struts.

Right now, we use a querystring parameter to set a session value that
is references throughout the application to determine the partner.

I can do that same thing with struts (ie., www.example.com/myapp?partnerId=8)

I am wondering if it might be better to create a URL like
www.example.com/myapp/8

Ultimately, it would be nice to map a url to a domain (ie.,
www.example.com/myapp/8 -> partner8.example.com

Ultimately, this would avoid problems with keeping the value in the
session, as it could always be retrieved from the URL

-- 
Greg Akins

http://insomnia-consulting.org
http://www.pghcodingdojo.org
http://pittjug.dev.java.net
http://twitter.com/akinsgre
http://www.linkedin.com/in/akinsgre

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


Re: URL "format" advice

Posted by Greg Akins <an...@gmail.com>.
Thanks Dale and Jordi; I started using a Filter to determine, but
hadn't seen the wildcard mapping.  That looks like just what I was
looking for.

On Mon, Sep 6, 2010 at 9:28 AM, Dale Newfield <da...@newfield.org> wrote:
> On 9/6/10 6:27 AM, jordi wrote:
>>
>> You can do that with wildcard mappings. I'm using Advanced wildcard
>> mappings
>> with regex... check it out
>>
>> http://struts.apache.org/2.x/docs/wildcard-mappings.html
>
> Especially if you couple that with the Url Rewrite Filter.
> http://www.tuckey.org/urlrewrite/
>
> -Dale
>



-- 
Greg Akins

http://insomnia-consulting.org
http://www.pghcodingdojo.org
http://pittjug.dev.java.net
http://twitter.com/akinsgre
http://www.linkedin.com/in/akinsgre

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


Re: URL "format" advice

Posted by Dale Newfield <da...@newfield.org>.
On 9/6/10 6:27 AM, jordi wrote:
> You can do that with wildcard mappings. I'm using Advanced wildcard mappings
> with regex... check it out
>
> http://struts.apache.org/2.x/docs/wildcard-mappings.html

Especially if you couple that with the Url Rewrite Filter.
http://www.tuckey.org/urlrewrite/

-Dale

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


Re: URL "format" advice

Posted by jordi <jo...@donky.org>.
You can do that with wildcard mappings. I'm using Advanced wildcard mappings
with regex... check it out

http://struts.apache.org/2.x/docs/wildcard-mappings.html

<http://struts.apache.org/2.x/docs/wildcard-mappings.html>jordi

On Wed, Aug 25, 2010 at 4:46 PM, Greg Akins <an...@gmail.com> wrote:

> I need to implement a webapp that uses the URL to determine the
> "partner" that is accessing the application.  I'd like your opinion on
> the way to do this that might work best with Struts.
>
> Right now, we use a querystring parameter to set a session value that
> is references throughout the application to determine the partner.
>
> I can do that same thing with struts (ie.,
> www.example.com/myapp?partnerId=8)
>
> I am wondering if it might be better to create a URL like
> www.example.com/myapp/8
>
> Ultimately, it would be nice to map a url to a domain (ie.,
> www.example.com/myapp/8 -> partner8.example.com
>
> Ultimately, this would avoid problems with keeping the value in the
> session, as it could always be retrieved from the URL
>
> --
> Greg Akins
>
> http://insomnia-consulting.org
> http://www.pghcodingdojo.org
> http://pittjug.dev.java.net
> http://twitter.com/akinsgre
> http://www.linkedin.com/in/akinsgre
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: URL "format" advice

Posted by ch...@chrismiles.org.
That sort of thing is probably best handled outside Struts in my opinion.
A servlet filter which catches requests with that pattern /myapp/8 and
then does a clean forward to blah?partner=8 - I do a similar thing in my
app, but you then need to think about relative URLs for everything which
then sits under that.

Personally unless you have a specific need for clean URLs such as for
search engine optimisation then its not really worth the effort.

Chris

> I need to implement a webapp that uses the URL to determine the
> "partner" that is accessing the application.  I'd like your opinion on
> the way to do this that might work best with Struts.
>
> Right now, we use a querystring parameter to set a session value that
> is references throughout the application to determine the partner.
>
> I can do that same thing with struts (ie.,
> www.example.com/myapp?partnerId=8)
>
> I am wondering if it might be better to create a URL like
> www.example.com/myapp/8
>
> Ultimately, it would be nice to map a url to a domain (ie.,
> www.example.com/myapp/8 -> partner8.example.com
>
> Ultimately, this would avoid problems with keeping the value in the
> session, as it could always be retrieved from the URL
>
> --
> Greg Akins
>
> http://insomnia-consulting.org
> http://www.pghcodingdojo.org
> http://pittjug.dev.java.net
> http://twitter.com/akinsgre
> http://www.linkedin.com/in/akinsgre
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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