There are many solutions to this problem. Some solutions involve use of a servlet to determine the user's operating system, or some other solution that requires use of server-side code. In this tip, I'll show you how to determine the user's operating system via the request object from Expression Language.
To determine whether a user requires the use of NFS or SMB for accessing a file share, simply use expression language to obtain the user-agent from the request object as such:
#{header['user-agent'].contains('Windows')?'file://':'smb://'}rest/of/url/here
In the EL above, if the user-agent contains "Windows", then the
file://prefix is used, otherwise
smb://will be utilized for the link. This solution can be implemented directly within the views, relieving the requirement to recompile code.
No comments:
Post a Comment
Please leave a comment...