Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This can support domain matching layout? #71

Closed
wenzis opened this issue Dec 17, 2014 · 3 comments
Closed

This can support domain matching layout? #71

wenzis opened this issue Dec 17, 2014 · 3 comments

Comments

@wenzis
Copy link

wenzis commented Dec 17, 2014

org.sitemesh.webapp.WebAppContext.getRequestPath()返回的路径只包含了项目信息,去除了域名http://localhost:8080/,比如我对于http://l192.168.1.100:8080和http://l192.168.1.111:8080要使用不同的布局,这个就没办法了吗?

@wenzis
Copy link
Author

wenzis commented Dec 20, 2014

org.sitemesh.webapp.WebAppContext.getRequestPath()
The returned path only contains the project information, the removal of the domain name
http://localhost:8080/,For such as I,http://l192.168.1.100:8080 and http://l192.168.1.111:8080To use a different layout, this is no way out?

@wenzis wenzis changed the title 这个能不能支持域名匹配布局啊? This can support domain matching layout? Dec 20, 2014
@codeconsole
Copy link
Member

if you still need this feature, we are willing to implement it. Let us know.

@codeconsole
Copy link
Member

I can offer 2 solutions in the meantime:

Extend the PathBasedDecoratorSelector

    public String[] selectDecoratorPaths(Content content, C siteMeshContext) throws IOException {
        String[] result = pathMapper.get(siteMeshContext.getPath());
        return convertPaths(result == null ? EMPTY : result);
    }

You can get the HttpServletRequest object by calling siteMeshContext.getRequest()

Altneratively, you could all the work inside the page by dynamically setting the decorator using a meta tag:
e.g.

Here is an example:

    <c:if test="${not empty param.bootstrap}">
      <meta name="decorator" content="bootstrap.jsp${not empty param.doubled?',chaining.html':''}" />
    </c:if>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants