It's difficult to say what the best solution is without understanding the 
problem your trying to solve with this initialPath field.  It seems like using 
the index.jsp to push the user in the right direction would be the most 
flexible option.  That's what happens at the moment e.g. http://www.example.com 
would redirect to http://www.example.com/control/main so you could just add 
additional logic to figure out a tenant specific redirect.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 10/11/2010, at 4:17 PM, Chatree Srichart wrote:

> Hi Scott Gray,
> May I ask you some suggestion? Is there anyway to handle the root mount
> point when an user enter only domain name in a web browser. The purpose of
> this code is I need to handle the first URI after an user enter only domain
> name on a web browser and redirect to the initial path that be specified in
> the Tenant entity.
> 
> Regards,
> Chatree Srichart
> 
> On Wed, Nov 10, 2010 at 3:00 AM, Scott Gray <scott.g...@hotwaxmedia.com>wrote:
> 
>> On 9/11/2010, at 10:14 PM, hans...@apache.org wrote:
>> 
>>> Author: hansbak
>>> Date: Tue Nov  9 09:14:33 2010
>>> New Revision: 1032896
>>> 
>>> URL: http://svn.apache.org/viewvc?rev=1032896&view=rev
>>> Log:
>>> removing the tenant servlet because that gave a problem with the root
>> mountpoint defined twice in systems which already use the root mount point
>>> 
>>> Removed:
>>> 
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/TenantServlet.java
>>> Modified:
>>> 
>> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
>>> 
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
>>> 
>>> 
>>> Modified:
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
>>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java?rev=1032896&r1=1032895&r2=1032896&view=diff
>>> 
>> ==============================================================================
>>> ---
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
>> (original)
>>> +++
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
>> Tue Nov  9 09:14:33 2010
>>> @@ -288,6 +288,12 @@ public class ContextFilter implements Fi
>>>                    GenericValue tenant = EntityUtil.getFirst(tenants);
>>>                    String tenantId = tenant.getString("tenantId");
>>> 
>>> +                    // if the request URI is "/control/main" then
>> redirect to the initial path
>>> +                    if
>> (httpRequest.getRequestURI().startsWith("/control/main")) {
>>> +                        String initialPath =
>> tenant.getString("initialPath");
>>> +
>> ((HttpServletResponse)response).sendRedirect(initialPath);
>>> +                    }
>>> +
>>>                    // make that tenant active, setup a new delegator and
>> a new dispatcher
>>>                    String tenantDelegatorName =
>> delegator.getDelegatorBaseName() + "#" + tenantId;
>>> 
>> httpRequest.getSession().setAttribute("delegatorName", tenantDelegatorName);
>> 
>> Hi Hans,
>> 
>> You should always return after sending a redirect or otherwise the request
>> continues to be processed.
>> 
>> Also, I'm not sure what the /control/main redirect is for but keep in mind
>> that the framework shouldn't really know anything about URIs like that and
>> depending on them decreases flexibility.  "control" is just a url pattern
>> defined in each webapp's web.xml and can be changed to anything and there is
>> no requirement for each application to have a "main" request.  The only
>> reason "main" is the default page is because each webapp's index.jsp
>> redirects to it.
>> 
>> Regards
>> Scott
>> 
>> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to