You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by v aditya <va...@gmail.com> on 2008/08/13 07:02:17 UTC

displaying a page from root directory when URL points to sub directory

I want to use some "part" of a URL to identify a particular sub
directory(under root directory) and I want to use the styles and images from
this sub directory to display a page in the root directory here the URL
should still remain the same that is it should still have the "part" intact.
All the pages are present only in root directory and styles and images are
present only in sub directory.Can someone give me any pointers about how
should I proceed. 
-- 
View this message in context: http://www.nabble.com/displaying-a-page-from-root-directory-when-URL-points-to-sub-directory-tp18957092p18957092.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: displaying a page from root directory when URL points to sub directory

Posted by Jan Baumann <ja...@andrena.de>.
If I understood you correctly, you want to put your .jsf files in the 
root directory, say http://www.abc.com/first.jsf, and you want that they 
are shown only if the user navigates to a subdirectory, for example if 
his request url is http://www.abc.com/pages/first.jsf

And if I understood jsf correctly, you can simply use the 
servlet-mapping for the faces servlet. For example setting the mapping to

	<servlet-mapping>
		<servlet-name>Faces Servlet</servlet-name>
		<url-pattern>/pages/*.jsf</url-pattern>
	</servlet-mapping>

the faces servlet should automatically do what I understood you wanted 
to be done, without the need to use any additional filter proxy or similar.

cheers

Jan

v aditya schrieb:
> I'll definately look into how to use proxy server but is there some way to do
> it from JSF standpoint? 
> 
> Thanks in advance!
> 
> -aditya
> 
> 
> 
> Frank Nimphius-2 wrote:
>>
>>
>>
>>   
>>
>>
>> Hi, 
>>
>> can't you set a proxy on the HTTP server. I remember that this is
>> possible to do in Apache. In fact what you want is to intercept the
>> request and forward it on the server side 
>>
>> Frank 
>>
>> v aditya wrote:
>>
>>   
>> no its not about jsp:includes .
>> suppose u have a URL like www.abc.com/pages/first.jsf  .I want the jsf
>> page
>> "first.jsf" to be picked up from the root directory instead of "first.jsf
>> "
>> from the path "/pages/first.jsf" but for the next request the URL should
>> still remain like its coming from "/pages/first.jsf".
>>
>> Frank Nimphius-2 wrote:
>>   
>>   
>>     
>>
>>
>>   
>>   
>>
>>
>> Hi, 
>>
>> sorry, I don't understand the question, can you rephrase ? Do you mean
>> jsp:includes ? 
>>
>> Frank 
>>
>> v aditya wrote:
>>
>>   I want to use some "part" of a URL to identify a particular sub
>> directory(under root directory) and I want to use the styles and images
>> from
>> this sub directory to display a page in the root directory here the URL
>> should still remain the same that is it should still have the "part"
>> intact.
>> All the pages are present only in root directory and styles and images are
>> present only in sub directory.Can someone give me any pointers about how
>> should I proceed. 
>>   
>>
>>
>> -- 
>>
>> Frank Nimphius | Principal Product Manager 
>> Oracle Application Development Tools 
>>
>>   
>>     
>>       
>>       Oracle is committed to developing practices and
>> products that help protect the environment
>>     
>>   
>>
>>
>>
>>
>>
>>  
>>  
>>
>>     
>>   
>>   
>>   
>>
>>
>> -- 
>>
>> Frank Nimphius | Principal Product Manager 
>> Oracle Application Development Tools 
>>
>>   
>>     
>>       
>>       Oracle is committed to developing practices and
>> products that help protect the environment
>>     
>>   
>>
>>
>>
>>
>>
>>  
>>  
>>
> 

Re: displaying a page from root directory when URL points to sub directory

Posted by v aditya <va...@gmail.com>.
thank u all for valuable suggestions...

simon.kitching@chello.at wrote:
> 
> This project might be useful:
>   http://code.google.com/p/urlrewritefilter/
> This could allow you to effectively take the "proxy server" approach 
> that Frank suggested, but do the url modification within your webapp 
> rather than in an external application.
> 
> simon.kitching@chello.at schrieb:
>> This approach sounds like a bad idea to me. Having all your pages in 
>> the root directory means your app will not scale beyone a few dozen 
>> pages; it will just get unmanageable. And this approach simply feels 
>> wrong.
>>
>> If you really want to do this then I would agree with Frank's 
>> suggestion to do this by configuring a proxy server.
>>
>> The alternative would be to write a custom JSF ViewHandler class. It 
>> is the JSF ViewHandler that is responsible for creating a view and 
>> rendering it. In fact, JSF supports the "decorator" pattern for 
>> ViewHandlers, so your code would override a couple of methods but 
>> mostly delegate to the underlying implementation. I think that 
>> implementing this isn't *too* difficult, but not trivial either. You 
>> will certainly probably need to read through the source code for the 
>> ViewHandler implementation of your JSF implementation (Mojarra or 
>> Myfaces Core) and maybe read parts of the JSF specification. Having a 
>> good JSF textbook handy could also be useful.
>>
>> Regards,
>> Simon
>>
>> v aditya schrieb:
>>> I'll definately look into how to use proxy server but is there some 
>>> way to do
>>> it from JSF standpoint?
>>> Thanks in advance!
>>>
>>> -aditya
>>>
>>>
>>>
>>> Frank Nimphius-2 wrote:
>>>  
>>>>
>>>>
>>>>  
>>>>
>>>> Hi,
>>>> can't you set a proxy on the HTTP server. I remember that this is
>>>> possible to do in Apache. In fact what you want is to intercept the
>>>> request and forward it on the server side
>>>> Frank
>>>> v aditya wrote:
>>>>
>>>>   no its not about jsp:includes .
>>>> suppose u have a URL like www.abc.com/pages/first.jsf  .I want the jsf
>>>> page
>>>> "first.jsf" to be picked up from the root directory instead of 
>>>> "first.jsf
>>>> "
>>>> from the path "/pages/first.jsf" but for the next request the URL 
>>>> should
>>>> still remain like its coming from "/pages/first.jsf".
>>>>
>>>> Frank Nimphius-2 wrote:
>>>>        
>>>>
>>>>    
>>>>
>>>> Hi,
>>>> sorry, I don't understand the question, can you rephrase ? Do you mean
>>>> jsp:includes ?
>>>> Frank
>>>> v aditya wrote:
>>>>
>>>>   I want to use some "part" of a URL to identify a particular sub
>>>> directory(under root directory) and I want to use the styles and images
>>>> from
>>>> this sub directory to display a page in the root directory here the URL
>>>> should still remain the same that is it should still have the "part"
>>>> intact.
>>>> All the pages are present only in root directory and styles and 
>>>> images are
>>>> present only in sub directory.Can someone give me any pointers about 
>>>> how
>>>> should I proceed.  
>>>>     
>>>
>>>   
>>
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/displaying-a-page-from-root-directory-when-URL-points-to-sub-directory-tp18957092p18961832.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: displaying a page from root directory when URL points to sub directory

Posted by "simon.kitching@chello.at" <si...@chello.at>.
This project might be useful:
  http://code.google.com/p/urlrewritefilter/
This could allow you to effectively take the "proxy server" approach 
that Frank suggested, but do the url modification within your webapp 
rather than in an external application.

simon.kitching@chello.at schrieb:
> This approach sounds like a bad idea to me. Having all your pages in 
> the root directory means your app will not scale beyone a few dozen 
> pages; it will just get unmanageable. And this approach simply feels 
> wrong.
>
> If you really want to do this then I would agree with Frank's 
> suggestion to do this by configuring a proxy server.
>
> The alternative would be to write a custom JSF ViewHandler class. It 
> is the JSF ViewHandler that is responsible for creating a view and 
> rendering it. In fact, JSF supports the "decorator" pattern for 
> ViewHandlers, so your code would override a couple of methods but 
> mostly delegate to the underlying implementation. I think that 
> implementing this isn't *too* difficult, but not trivial either. You 
> will certainly probably need to read through the source code for the 
> ViewHandler implementation of your JSF implementation (Mojarra or 
> Myfaces Core) and maybe read parts of the JSF specification. Having a 
> good JSF textbook handy could also be useful.
>
> Regards,
> Simon
>
> v aditya schrieb:
>> I'll definately look into how to use proxy server but is there some 
>> way to do
>> it from JSF standpoint?
>> Thanks in advance!
>>
>> -aditya
>>
>>
>>
>> Frank Nimphius-2 wrote:
>>  
>>>
>>>
>>>  
>>>
>>> Hi,
>>> can't you set a proxy on the HTTP server. I remember that this is
>>> possible to do in Apache. In fact what you want is to intercept the
>>> request and forward it on the server side
>>> Frank
>>> v aditya wrote:
>>>
>>>   no its not about jsp:includes .
>>> suppose u have a URL like www.abc.com/pages/first.jsf  .I want the jsf
>>> page
>>> "first.jsf" to be picked up from the root directory instead of 
>>> "first.jsf
>>> "
>>> from the path "/pages/first.jsf" but for the next request the URL 
>>> should
>>> still remain like its coming from "/pages/first.jsf".
>>>
>>> Frank Nimphius-2 wrote:
>>>        
>>>
>>>    
>>>
>>> Hi,
>>> sorry, I don't understand the question, can you rephrase ? Do you mean
>>> jsp:includes ?
>>> Frank
>>> v aditya wrote:
>>>
>>>   I want to use some "part" of a URL to identify a particular sub
>>> directory(under root directory) and I want to use the styles and images
>>> from
>>> this sub directory to display a page in the root directory here the URL
>>> should still remain the same that is it should still have the "part"
>>> intact.
>>> All the pages are present only in root directory and styles and 
>>> images are
>>> present only in sub directory.Can someone give me any pointers about 
>>> how
>>> should I proceed.  
>>>     
>>
>>   
>
>


Re: displaying a page from root directory when URL points to sub directory

Posted by "simon.kitching@chello.at" <si...@chello.at>.
This approach sounds like a bad idea to me. Having all your pages in the 
root directory means your app will not scale beyone a few dozen pages; 
it will just get unmanageable. And this approach simply feels wrong.

If you really want to do this then I would agree with Frank's suggestion 
to do this by configuring a proxy server.

The alternative would be to write a custom JSF ViewHandler class. It is 
the JSF ViewHandler that is responsible for creating a view and 
rendering it. In fact, JSF supports the "decorator" pattern for 
ViewHandlers, so your code would override a couple of methods but mostly 
delegate to the underlying implementation. I think that implementing 
this isn't *too* difficult, but not trivial either. You will certainly 
probably need to read through the source code for the ViewHandler 
implementation of your JSF implementation (Mojarra or Myfaces Core) and 
maybe read parts of the JSF specification. Having a good JSF textbook 
handy could also be useful.

Regards,
Simon

v aditya schrieb:
> I'll definately look into how to use proxy server but is there some way to do
> it from JSF standpoint? 
>
> Thanks in advance!
>
> -aditya
>
>
>
> Frank Nimphius-2 wrote:
>   
>>
>>
>>   
>>
>>
>> Hi, 
>>
>> can't you set a proxy on the HTTP server. I remember that this is
>> possible to do in Apache. In fact what you want is to intercept the
>> request and forward it on the server side 
>>
>> Frank 
>>
>> v aditya wrote:
>>
>>   
>> no its not about jsp:includes .
>> suppose u have a URL like www.abc.com/pages/first.jsf  .I want the jsf
>> page
>> "first.jsf" to be picked up from the root directory instead of "first.jsf
>> "
>> from the path "/pages/first.jsf" but for the next request the URL should
>> still remain like its coming from "/pages/first.jsf".
>>
>> Frank Nimphius-2 wrote:
>>   
>>   
>>     
>>
>>
>>   
>>   
>>
>>
>> Hi, 
>>
>> sorry, I don't understand the question, can you rephrase ? Do you mean
>> jsp:includes ? 
>>
>> Frank 
>>
>> v aditya wrote:
>>
>>   I want to use some "part" of a URL to identify a particular sub
>> directory(under root directory) and I want to use the styles and images
>> from
>> this sub directory to display a page in the root directory here the URL
>> should still remain the same that is it should still have the "part"
>> intact.
>> All the pages are present only in root directory and styles and images are
>> present only in sub directory.Can someone give me any pointers about how
>> should I proceed. 
>>   
>>
>>     
>
>   


RE: displaying a page from root directory when URL points to sub directory

Posted by F....@delagelanden.com.
Hi,

I think you might get this to work using a Servlet Filter.
In the filter you can check all requested URLs and act upon them.
In your case you can use the Response object to change the default
behaviour.
I'm not sure that you can do something in there that does what you want,
but it may be worth looking into.

Regards,

Freek Segers

> -----Original Message-----
> From: v aditya [mailto:vanka.aditya@gmail.com] 
> Sent: 13 augustus 2008 8:11
> To: users@myfaces.apache.org
> Subject: Re: displaying a page from root directory when URL 
> points to sub directory
> 
> 
> I'll definately look into how to use proxy server but is 
> there some way to do it from JSF standpoint? 
> 
> Thanks in advance!
> 
> -aditya
> 
> 
> 
> Frank Nimphius-2 wrote:
> > 
> > 
> > 
> > 
> >   
> > 
> > 
> > Hi,
> > 
> > can't you set a proxy on the HTTP server. I remember that this is 
> > possible to do in Apache. In fact what you want is to intercept the 
> > request and forward it on the server side
> > 
> > Frank
> > 
> > v aditya wrote:
> > 
> >   
> > no its not about jsp:includes .
> > suppose u have a URL like www.abc.com/pages/first.jsf  .I 
> want the jsf 
> > page "first.jsf" to be picked up from the root directory instead of 
> > "first.jsf "
> > from the path "/pages/first.jsf" but for the next request the URL 
> > should still remain like its coming from "/pages/first.jsf".
> > 
> > Frank Nimphius-2 wrote:
> >   
> >   
> >     
> > 
> > 
> >   
> >   
> > 
> > 
> > Hi,
> > 
> > sorry, I don't understand the question, can you rephrase ? 
> Do you mean 
> > jsp:includes ?
> > 
> > Frank
> > 
> > v aditya wrote:
> > 
> >   I want to use some "part" of a URL to identify a particular sub 
> > directory(under root directory) and I want to use the styles and 
> > images from this sub directory to display a page in the 
> root directory 
> > here the URL should still remain the same that is it should 
> still have 
> > the "part"
> > intact.
> > All the pages are present only in root directory and styles 
> and images 
> > are present only in sub directory.Can someone give me any pointers 
> > about how should I proceed.
> >   
> > 
> > 
> > --
> > 
> > Frank Nimphius | Principal Product Manager Oracle Application 
> > Development Tools
> > 
> >   
> >     
> >       
> >       Oracle is committed to developing practices and products that 
> > help protect the environment
> >     
> >   
> > 
> > 
> > 
> > 
> > 
> >  
> >  
> > 
> >     
> >   
> >   
> >   
> > 
> > 
> > --
> > 
> > Frank Nimphius | Principal Product Manager Oracle Application 
> > Development Tools
> > 
> >   
> >     
> >       
> >       Oracle is committed to developing practices and products that 
> > help protect the environment
> >     
> >   
> > 
> > 
> > 
> > 
> > 
> >  
> >  
> > 
> 
> --
> View this message in context: 
> http://www.nabble.com/displaying-a-page-from-root-directory-wh
> en-URL-points-to-sub-directory-tp18957092p18957555.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> 
> 
> 
> 



================================================
The information transmitted via this e-mail is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material.  Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.


Re: displaying a page from root directory when URL points to sub directory

Posted by v aditya <va...@gmail.com>.
I'll definately look into how to use proxy server but is there some way to do
it from JSF standpoint? 

Thanks in advance!

-aditya



Frank Nimphius-2 wrote:
> 
> 
> 
> 
>   
> 
> 
> Hi, 
> 
> can't you set a proxy on the HTTP server. I remember that this is
> possible to do in Apache. In fact what you want is to intercept the
> request and forward it on the server side 
> 
> Frank 
> 
> v aditya wrote:
> 
>   
> no its not about jsp:includes .
> suppose u have a URL like www.abc.com/pages/first.jsf  .I want the jsf
> page
> "first.jsf" to be picked up from the root directory instead of "first.jsf
> "
> from the path "/pages/first.jsf" but for the next request the URL should
> still remain like its coming from "/pages/first.jsf".
> 
> Frank Nimphius-2 wrote:
>   
>   
>     
> 
> 
>   
>   
> 
> 
> Hi, 
> 
> sorry, I don't understand the question, can you rephrase ? Do you mean
> jsp:includes ? 
> 
> Frank 
> 
> v aditya wrote:
> 
>   I want to use some "part" of a URL to identify a particular sub
> directory(under root directory) and I want to use the styles and images
> from
> this sub directory to display a page in the root directory here the URL
> should still remain the same that is it should still have the "part"
> intact.
> All the pages are present only in root directory and styles and images are
> present only in sub directory.Can someone give me any pointers about how
> should I proceed. 
>   
> 
> 
> -- 
> 
> Frank Nimphius | Principal Product Manager 
> Oracle Application Development Tools 
> 
>   
>     
>       
>       Oracle is committed to developing practices and
> products that help protect the environment
>     
>   
> 
> 
> 
> 
> 
>  
>  
> 
>     
>   
>   
>   
> 
> 
> -- 
> 
> Frank Nimphius | Principal Product Manager 
> Oracle Application Development Tools 
> 
>   
>     
>       
>       Oracle is committed to developing practices and
> products that help protect the environment
>     
>   
> 
> 
> 
> 
> 
>  
>  
> 

-- 
View this message in context: http://www.nabble.com/displaying-a-page-from-root-directory-when-URL-points-to-sub-directory-tp18957092p18957555.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: displaying a page from root directory when URL points to sub directory

Posted by v aditya <va...@gmail.com>.

no its not about jsp:includes .
suppose u have a URL like www.abc.com/pages/first.jsf .I want the jsf page
"first.jsf" to be picked up from the root directory instead of "first.jsf "
from the path "/pages/first.jsf" but for the next request the URL should
still remain like its coming from "/pages/first.jsf".

Frank Nimphius-2 wrote:
> 
> 
> 
> 
>   
>   
> 
> 
> Hi, 
> 
> sorry, I don't understand the question, can you rephrase ? Do you mean
> jsp:includes ? 
> 
> Frank 
> 
> v aditya wrote:
> 
>   I want to use some "part" of a URL to identify a particular sub
> directory(under root directory) and I want to use the styles and images
> from
> this sub directory to display a page in the root directory here the URL
> should still remain the same that is it should still have the "part"
> intact.
> All the pages are present only in root directory and styles and images are
> present only in sub directory.Can someone give me any pointers about how
> should I proceed. 
>   
> 
> 
> -- 
> 
> Frank Nimphius | Principal Product Manager 
> Oracle Application Development Tools 
> 
>   
>     
>       
>       Oracle is committed to developing practices and
> products that help protect the environment
>     
>   
> 
> 
> 
> 
> 
>  
>  
> 

-- 
View this message in context: http://www.nabble.com/displaying-a-page-from-root-directory-when-URL-points-to-sub-directory-tp18957092p18957344.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.