You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by is_maximum <mn...@gmail.com> on 2010/12/31 05:14:11 UTC

How to manage URLs in JSF

Hi all,

I have an application which is displaying the content of another wb
application in a frame. In this process, the jsf will rewrite new links with
current application context path:

APP1 --> calls APP2

link1: http://localhost:8080/pages/newPath/newPage.xhtml

in above link, /newPath/newPage.xhtml is for the other application (APP2)
and doesn't exist in APP1

I want to write a filter or something to check that if the path is not from
my application I invoke an action method (#{dispatcher.dispatch}) and add
this new path as an parameter, say, 

EXT_PATH=/newPath/newPage.xhtml

so the controller (here is dispatcher) decides how to do with it.

I wrote a PhaseListener but it seems this URL will be resolved even before
that so in result, because I don't have that path in my APP1 and I get an
error!

Could you please help me on this?


-----
--
Regards

Mohammad Norouzi

Help each other to reach the future faster

http://pixelshot.wordpress.com Pixelshot Photoblog 

http://brainable.blogspot.com Brainable Blog 


-- 
View this message in context: http://old.nabble.com/How-to-manage-URLs-in-JSF-tp30561750p30561750.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: How to manage URLs in JSF

Posted by is_maximum <mn...@gmail.com>.
No we can't. We don't want to change the lagacy application


omid p wrote:
> 
> Hi,
> Can you not use webservice for displaying the content of app1 into app2 ?
> 
> 


-----
--
Regards

Mohammad Norouzi

Help each other to reach the future faster

http://pixelshot.wordpress.com Pixelshot Photoblog 

http://brainable.blogspot.com Brainable Blog 


-- 
View this message in context: http://old.nabble.com/How-to-manage-URLs-in-JSF-tp30561750p30569585.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: How to manage URLs in JSF

Posted by omid p <ve...@gmail.com>.
Hi,
Can you not use webservice for displaying the content of app1 into app2 ?

Re: How to manage URLs in JSF

Posted by is_maximum <mn...@gmail.com>.
Yes I checked PrettyFaces but I want to keep this project very light.

Do you know how can I set the navigation rule or page.xml (which is for
JBoss Seam) in a way that with a certain path or url pattern invoke the
action so I wont invoke the action manually?




Kito Mann wrote:
> 
> On Dec 31, 2010, at 11:11 PM, is_maximum <mn...@gmail.com> wrote:
> 
>>
>> Thanks Kito,
>> Can you please tell me about url rewrite? I know what it is but my
>> question
>> is that isn't it the same Servlet Filter?
>>
>> I created a Filter in which I check the URL and in that case I set an
>> attribute in request, then I have a PhaseListener, in which I can
>> retrieve
>> the attribute and if it is true, I invoke a certain action in a managed
>> bean. What is your idea about this?
>>
>> I think URL rewriting won't work because changing URL cannot help, I need
>> to
>> invoke an action as well.
> 
> Well, if your action method adds a parameter to the URL, you can do
> the same thing with urlrewrite (assuming there isn't complicated logic
> involved). Urlrewrite is just a sophisticated Servlet filter.
> 
> Have you looked at PrettyFaces though?
> 
>>
>>
>>
>> Kito Mann wrote:
>>>
>>> Hello Mohammad,
>>>
>>> There are at least three options:
>>>
>>> (1) Use PrettyFaces
>>> (2) Use urlrewrite
>>> (3) Write a custom Servlet filter
>>>
>>> These options are listed in my order of preference :-).
>>>
>>> Sent from my iPhone
>>>
>>> http://www.jsfcentral.com
>>> http://www.Virtua.com
>>>
>>>
>>> On Dec 30, 2010, at 11:14 PM, is_maximum <mn...@gmail.com> wrote:
>>>
>>>>
>>>> Hi all,
>>>>
>>>> I have an application which is displaying the content of another wb
>>>> application in a frame. In this process, the jsf will rewrite new links
>>>> with
>>>> current application context path:
>>>>
>>>> APP1 --> calls APP2
>>>>
>>>> link1: http://localhost:8080/pages/newPath/newPage.xhtml
>>>>
>>>> in above link, /newPath/newPage.xhtml is for the other application
>>>> (APP2)
>>>> and doesn't exist in APP1
>>>>
>>>> I want to write a filter or something to check that if the path is not
>>>> from
>>>> my application I invoke an action method (#{dispatcher.dispatch}) and
>>>> add
>>>> this new path as an parameter, say,
>>>>
>>>> EXT_PATH=/newPath/newPage.xhtml
>>>>
>>>> so the controller (here is dispatcher) decides how to do with it.
>>>>
>>>> I wrote a PhaseListener but it seems this URL will be resolved even
>>>> before
>>>> that so in result, because I don't have that path in my APP1 and I get
>>>> an
>>>> error!
>>>>
>>>> Could you please help me on this?
>>>>
>>>>
>>>> -----
>>>> --
>>>> Regards
>>>>
>>>> Mohammad Norouzi
>>>>
>>>> Help each other to reach the future faster
>>>>
>>>> http://pixelshot.wordpress.com Pixelshot Photoblog
>>>>
>>>> http://brainable.blogspot.com Brainable Blog
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/How-to-manage-URLs-in-JSF-tp30561750p30561750.html
>>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>
>>
>> -----
>> --
>> Regards
>>
>> Mohammad Norouzi
>>
>> Help each other to reach the future faster
>>
>> http://pixelshot.wordpress.com Pixelshot Photoblog
>>
>> http://brainable.blogspot.com Brainable Blog
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/How-to-manage-URLs-in-JSF-tp30561750p30566263.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
> 
> 


-----
--
Regards

Mohammad Norouzi

Help each other to reach the future faster

http://pixelshot.wordpress.com Pixelshot Photoblog 

http://brainable.blogspot.com Brainable Blog 


-- 
View this message in context: http://old.nabble.com/How-to-manage-URLs-in-JSF-tp30561750p30566741.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: How to manage URLs in JSF

Posted by Kito Mann <ki...@virtua.com>.
On Dec 31, 2010, at 11:11 PM, is_maximum <mn...@gmail.com> wrote:

>
> Thanks Kito,
> Can you please tell me about url rewrite? I know what it is but my question
> is that isn't it the same Servlet Filter?
>
> I created a Filter in which I check the URL and in that case I set an
> attribute in request, then I have a PhaseListener, in which I can retrieve
> the attribute and if it is true, I invoke a certain action in a managed
> bean. What is your idea about this?
>
> I think URL rewriting won't work because changing URL cannot help, I need to
> invoke an action as well.

Well, if your action method adds a parameter to the URL, you can do
the same thing with urlrewrite (assuming there isn't complicated logic
involved). Urlrewrite is just a sophisticated Servlet filter.

Have you looked at PrettyFaces though?

>
>
>
> Kito Mann wrote:
>>
>> Hello Mohammad,
>>
>> There are at least three options:
>>
>> (1) Use PrettyFaces
>> (2) Use urlrewrite
>> (3) Write a custom Servlet filter
>>
>> These options are listed in my order of preference :-).
>>
>> Sent from my iPhone
>>
>> http://www.jsfcentral.com
>> http://www.Virtua.com
>>
>>
>> On Dec 30, 2010, at 11:14 PM, is_maximum <mn...@gmail.com> wrote:
>>
>>>
>>> Hi all,
>>>
>>> I have an application which is displaying the content of another wb
>>> application in a frame. In this process, the jsf will rewrite new links
>>> with
>>> current application context path:
>>>
>>> APP1 --> calls APP2
>>>
>>> link1: http://localhost:8080/pages/newPath/newPage.xhtml
>>>
>>> in above link, /newPath/newPage.xhtml is for the other application (APP2)
>>> and doesn't exist in APP1
>>>
>>> I want to write a filter or something to check that if the path is not
>>> from
>>> my application I invoke an action method (#{dispatcher.dispatch}) and add
>>> this new path as an parameter, say,
>>>
>>> EXT_PATH=/newPath/newPage.xhtml
>>>
>>> so the controller (here is dispatcher) decides how to do with it.
>>>
>>> I wrote a PhaseListener but it seems this URL will be resolved even
>>> before
>>> that so in result, because I don't have that path in my APP1 and I get an
>>> error!
>>>
>>> Could you please help me on this?
>>>
>>>
>>> -----
>>> --
>>> Regards
>>>
>>> Mohammad Norouzi
>>>
>>> Help each other to reach the future faster
>>>
>>> http://pixelshot.wordpress.com Pixelshot Photoblog
>>>
>>> http://brainable.blogspot.com Brainable Blog
>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/How-to-manage-URLs-in-JSF-tp30561750p30561750.html
>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>
>>
>>
>
>
> -----
> --
> Regards
>
> Mohammad Norouzi
>
> Help each other to reach the future faster
>
> http://pixelshot.wordpress.com Pixelshot Photoblog
>
> http://brainable.blogspot.com Brainable Blog
>
>
> --
> View this message in context: http://old.nabble.com/How-to-manage-URLs-in-JSF-tp30561750p30566263.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>

Re: How to manage URLs in JSF

Posted by is_maximum <mn...@gmail.com>.
Thanks Kito,
Can you please tell me about url rewrite? I know what it is but my question
is that isn't it the same Servlet Filter?

I created a Filter in which I check the URL and in that case I set an
attribute in request, then I have a PhaseListener, in which I can retrieve
the attribute and if it is true, I invoke a certain action in a managed
bean. What is your idea about this?

I think URL rewriting won't work because changing URL cannot help, I need to
invoke an action as well.



Kito Mann wrote:
> 
> Hello Mohammad,
> 
> There are at least three options:
> 
> (1) Use PrettyFaces
> (2) Use urlrewrite
> (3) Write a custom Servlet filter
> 
> These options are listed in my order of preference :-).
> 
> Sent from my iPhone
> 
> http://www.jsfcentral.com
> http://www.Virtua.com
> 
> 
> On Dec 30, 2010, at 11:14 PM, is_maximum <mn...@gmail.com> wrote:
> 
>>
>> Hi all,
>>
>> I have an application which is displaying the content of another wb
>> application in a frame. In this process, the jsf will rewrite new links
>> with
>> current application context path:
>>
>> APP1 --> calls APP2
>>
>> link1: http://localhost:8080/pages/newPath/newPage.xhtml
>>
>> in above link, /newPath/newPage.xhtml is for the other application (APP2)
>> and doesn't exist in APP1
>>
>> I want to write a filter or something to check that if the path is not
>> from
>> my application I invoke an action method (#{dispatcher.dispatch}) and add
>> this new path as an parameter, say,
>>
>> EXT_PATH=/newPath/newPage.xhtml
>>
>> so the controller (here is dispatcher) decides how to do with it.
>>
>> I wrote a PhaseListener but it seems this URL will be resolved even
>> before
>> that so in result, because I don't have that path in my APP1 and I get an
>> error!
>>
>> Could you please help me on this?
>>
>>
>> -----
>> --
>> Regards
>>
>> Mohammad Norouzi
>>
>> Help each other to reach the future faster
>>
>> http://pixelshot.wordpress.com Pixelshot Photoblog
>>
>> http://brainable.blogspot.com Brainable Blog
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/How-to-manage-URLs-in-JSF-tp30561750p30561750.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
> 
> 


-----
--
Regards

Mohammad Norouzi

Help each other to reach the future faster

http://pixelshot.wordpress.com Pixelshot Photoblog 

http://brainable.blogspot.com Brainable Blog 


-- 
View this message in context: http://old.nabble.com/How-to-manage-URLs-in-JSF-tp30561750p30566263.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: How to manage URLs in JSF

Posted by is_maximum <mn...@gmail.com>.
However, I am using JSF 1.2 but can you tell me how it works?
 

struberg wrote:
> 
> with JSF-2 you can also use a composite component which uses h:outputLink
> 
> LieGrue,
> strub
> 
> --- On Fri, 12/31/10, Kito Mann <ki...@virtua.com> wrote:
> 
>> From: Kito Mann <ki...@virtua.com>
>> Subject: Re: How to manage URLs in JSF
>> To: "MyFaces Discussion" <us...@myfaces.apache.org>
>> Date: Friday, December 31, 2010, 5:38 AM
>> Hello Mohammad,
>> 
>> There are at least three options:
>> 
>> (1) Use PrettyFaces
>> (2) Use urlrewrite
>> (3) Write a custom Servlet filter
>> 
>> These options are listed in my order of preference :-).
>> 
>> Sent from my iPhone
>> 
>> http://www.jsfcentral.com
>> http://www.Virtua.com
>> 
>> 
>> On Dec 30, 2010, at 11:14 PM, is_maximum <mn...@gmail.com>
>> wrote:
>> 
>> >
>> > Hi all,
>> >
>> > I have an application which is displaying the content
>> of another wb
>> > application in a frame. In this process, the jsf will
>> rewrite new links with
>> > current application context path:
>> >
>> > APP1 --> calls APP2
>> >
>> > link1: http://localhost:8080/pages/newPath/newPage.xhtml
>> >
>> > in above link, /newPath/newPage.xhtml is for the other
>> application (APP2)
>> > and doesn't exist in APP1
>> >
>> > I want to write a filter or something to check that if
>> the path is not from
>> > my application I invoke an action method
>> (#{dispatcher.dispatch}) and add
>> > this new path as an parameter, say,
>> >
>> > EXT_PATH=/newPath/newPage.xhtml
>> >
>> > so the controller (here is dispatcher) decides how to
>> do with it.
>> >
>> > I wrote a PhaseListener but it seems this URL will be
>> resolved even before
>> > that so in result, because I don't have that path in
>> my APP1 and I get an
>> > error!
>> >
>> > Could you please help me on this?
>> >
>> >
>> > -----
>> > --
>> > Regards
>> >
>> > Mohammad Norouzi
>> >
>> > Help each other to reach the future faster
>> >
>> > http://pixelshot.wordpress.com Pixelshot Photoblog
>> >
>> > http://brainable.blogspot.com Brainable Blog
>> >
>> >
>> > --
>> > View this message in context:
>> http://old.nabble.com/How-to-manage-URLs-in-JSF-tp30561750p30561750.html
>> > Sent from the MyFaces - Users mailing list archive at
>> Nabble.com.
>> >
>> 
> 
> 
>       
> 
> 


-----
--
Regards

Mohammad Norouzi

Help each other to reach the future faster

http://pixelshot.wordpress.com Pixelshot Photoblog 

http://brainable.blogspot.com Brainable Blog 


-- 
View this message in context: http://old.nabble.com/How-to-manage-URLs-in-JSF-tp30561750p30566268.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: How to manage URLs in JSF

Posted by Mark Struberg <st...@yahoo.de>.
with JSF-2 you can also use a composite component which uses h:outputLink

LieGrue,
strub

--- On Fri, 12/31/10, Kito Mann <ki...@virtua.com> wrote:

> From: Kito Mann <ki...@virtua.com>
> Subject: Re: How to manage URLs in JSF
> To: "MyFaces Discussion" <us...@myfaces.apache.org>
> Date: Friday, December 31, 2010, 5:38 AM
> Hello Mohammad,
> 
> There are at least three options:
> 
> (1) Use PrettyFaces
> (2) Use urlrewrite
> (3) Write a custom Servlet filter
> 
> These options are listed in my order of preference :-).
> 
> Sent from my iPhone
> 
> http://www.jsfcentral.com
> http://www.Virtua.com
> 
> 
> On Dec 30, 2010, at 11:14 PM, is_maximum <mn...@gmail.com>
> wrote:
> 
> >
> > Hi all,
> >
> > I have an application which is displaying the content
> of another wb
> > application in a frame. In this process, the jsf will
> rewrite new links with
> > current application context path:
> >
> > APP1 --> calls APP2
> >
> > link1: http://localhost:8080/pages/newPath/newPage.xhtml
> >
> > in above link, /newPath/newPage.xhtml is for the other
> application (APP2)
> > and doesn't exist in APP1
> >
> > I want to write a filter or something to check that if
> the path is not from
> > my application I invoke an action method
> (#{dispatcher.dispatch}) and add
> > this new path as an parameter, say,
> >
> > EXT_PATH=/newPath/newPage.xhtml
> >
> > so the controller (here is dispatcher) decides how to
> do with it.
> >
> > I wrote a PhaseListener but it seems this URL will be
> resolved even before
> > that so in result, because I don't have that path in
> my APP1 and I get an
> > error!
> >
> > Could you please help me on this?
> >
> >
> > -----
> > --
> > Regards
> >
> > Mohammad Norouzi
> >
> > Help each other to reach the future faster
> >
> > http://pixelshot.wordpress.com Pixelshot Photoblog
> >
> > http://brainable.blogspot.com Brainable Blog
> >
> >
> > --
> > View this message in context: http://old.nabble.com/How-to-manage-URLs-in-JSF-tp30561750p30561750.html
> > Sent from the MyFaces - Users mailing list archive at
> Nabble.com.
> >
> 


      

Re: How to manage URLs in JSF

Posted by Kito Mann <ki...@virtua.com>.
Hello Mohammad,

There are at least three options:

(1) Use PrettyFaces
(2) Use urlrewrite
(3) Write a custom Servlet filter

These options are listed in my order of preference :-).

Sent from my iPhone

http://www.jsfcentral.com
http://www.Virtua.com


On Dec 30, 2010, at 11:14 PM, is_maximum <mn...@gmail.com> wrote:

>
> Hi all,
>
> I have an application which is displaying the content of another wb
> application in a frame. In this process, the jsf will rewrite new links with
> current application context path:
>
> APP1 --> calls APP2
>
> link1: http://localhost:8080/pages/newPath/newPage.xhtml
>
> in above link, /newPath/newPage.xhtml is for the other application (APP2)
> and doesn't exist in APP1
>
> I want to write a filter or something to check that if the path is not from
> my application I invoke an action method (#{dispatcher.dispatch}) and add
> this new path as an parameter, say,
>
> EXT_PATH=/newPath/newPage.xhtml
>
> so the controller (here is dispatcher) decides how to do with it.
>
> I wrote a PhaseListener but it seems this URL will be resolved even before
> that so in result, because I don't have that path in my APP1 and I get an
> error!
>
> Could you please help me on this?
>
>
> -----
> --
> Regards
>
> Mohammad Norouzi
>
> Help each other to reach the future faster
>
> http://pixelshot.wordpress.com Pixelshot Photoblog
>
> http://brainable.blogspot.com Brainable Blog
>
>
> --
> View this message in context: http://old.nabble.com/How-to-manage-URLs-in-JSF-tp30561750p30561750.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>