Return-Path: X-Original-To: apmail-struts-issues-archive@minotaur.apache.org Delivered-To: apmail-struts-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 43809102D2 for ; Sat, 8 Mar 2014 17:01:00 +0000 (UTC) Received: (qmail 65408 invoked by uid 500); 8 Mar 2014 17:00:58 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 64714 invoked by uid 500); 8 Mar 2014 17:00:56 -0000 Mailing-List: contact issues-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list issues@struts.apache.org Received: (qmail 64450 invoked by uid 99); 8 Mar 2014 17:00:54 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Mar 2014 17:00:54 +0000 Date: Sat, 8 Mar 2014 17:00:54 +0000 (UTC) From: "Lukasz Lenart (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (WW-4024) Support expressions for scheme attribute in s:url MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/WW-4024?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Lukasz Lenart updated WW-4024: ------------------------------ Fix Version/s: (was: 2.3.17) 2.3.x > Support expressions for scheme attribute in s:url > ------------------------------------------------- > > Key: WW-4024 > URL: https://issues.apache.org/jira/browse/WW-4024 > Project: Struts 2 > Issue Type: Improvement > Components: Plugin - Tags > Affects Versions: 2.3.8 > Reporter: Octavi Ripolles-Querol > Priority: Minor > Fix For: 2.3.x > > Attachments: CustomUrlRenderer.java, CustomUrlRendererV2.java, WW-3999-v1-url-tag.patch > > > I open this issue as of Lukasz Lenart's comment on this Stack Overflow question: http://stackoverflow.com/q/15569532/837154 . I think it would be nice to support expressions at "scheme" attribute in "s:url" tag. The situation I faced is as follows: > I'm developing a secure web application. This application runs on an application server behind a load balancer. The load balancer receives HTTPS traffic from the internet but forwards requests to the application server with HTTP. Responses are sent back from the application server to the load balancer with HTTP and then the load balancer forwards them to the internet with HTTPS. The sysadmins disabled the HTTPS support in the application servers because of performance reasons, so when we developers need to directly access a particular server (e.g. for troubleshooting) we need to use HTTP. > So we have a scenario where the same application, from the point of view of the final user, is accessed both by HTTP and HTTPS, but the application itself only receives HTTP traffic. Struts2, when rendering a s:url tag, by default chooses the scheme used by the request. In this case, always HTTP, which is wrong from the point of view of the final users who access the application through the load balancer. > A work-around to this situation would be to support expressions in the scheme attribute of s:url, so with the following code: > {code:xml} > > > > click me > {code} > Struts would render either > {code:xml} > click me > {code} > or > {code:xml} > click me > {code} > instead of the current output: > {code:xml} > click me > {code} > In my case, I've overcome this situation by using a custom implementation of UrlRenderer, actually a near copy-paste of ServletUrlRenderer, with the only change being the line where Struts2 sets the default value for the scheme attribute. I've set this default value to my convenience, using a value from the Value Stack. > Thanks for taking this into consideration! -- This message was sent by Atlassian JIRA (v6.2#6252)