Re: [tools, struts1] On an HTTPS page, link to HTTP URL includes port number :443

Christopher Schultz <[email protected]> Fri, 05 Dec 2014 20:54:34 -0500
Newsgroups gmane.comp.jakarta.velocity.user
Message-ID <[email protected]>
Mike,

On 12/5/14 8:23 PM, Mike Kienenberger wrote:
> I'm still using struts 1 and velocity on a project I'm actively
> working on this month.
> 
> I can take a look on Monday morning and see what we're doing.

Okay. I actually wrote this and tried to send it a few days ago but was
having SMTP issues across international borders (i.e. my V-prefixed ISP
has braindead SMTP servers, don't get me started). I finally got this
sent after returning to the US.

In the intervening days, I tried a few things that will work if
necessary. My current hack does something like this:

#set($myHref = $link.forward('my-link'))
#if('http' == $href.scheme && $href.port == '443')
#set($href = $href.port(80))
#end

<a href="$href">link text</a>

So it's doable... I was just hoping that it wouldn't require an ugly
hack like this. Fortunately, this is one of a *very* small number of
URLs that are (a) configured in struts-config.xml and (b) point to
resources external to our web application.

Thanks,
-chris

> On Fri, Dec 5, 2014 at 8:20 PM, Christopher Schultz
> <[email protected]> wrote:
>> All,
>>
>> I'm using StrutsLinkTool and I have a "forward" defined in
>> struts-config.xml that is a complete URL (like
>> "http://www.google.com/?q=foo"). In my page, I have this:
>>
>> <a href="$link.forward('my-link-name')">link text</a>
>>
>> The page this link is on is served via HTTPS with no port number, so of
>> course I'm using the default port number for TLS (:443). In the page
>> source, the link looks like this:
>>
>> <a href="http://www.google.com:443/?q=foo">link text</a>
>>
>> The link is unfollowable because the server (not actually google.com)
>> returns a 400 response because of the HTTP protocol being used on an
>> HTTPS port. :(
>>
>> Is there a way to suppress the port number in this URL? I believe
>> [Struts]LinkTool is adding it because of the port number of the current
>> request.
>>
>> Technically speaking, this is a URL that we can simply specify directly
>> in the page, but it's nice to have it configured via struts-config.xml
>> to have all our "forwards" defined in one place.
>>
>> Thanks,
>> -chris
>>
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
signature.asc (application/pgp-signature, 859 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUgmHcAAoJEBzwKT+lPKRYKFkP/07pz2AyPpZNl0B5/NW4dfNP
a17jcIWwuuzQ/xWyjiZ5CodeGMfoIqkHBeJiuigUwdL4/kJmbDUH2l+n5fXGpwPc
sLa2lq3ILA9CPN3QLiYc1PuGs4/KoRbjlX6PJPViER5xWUVKH274OGvCenOSbLrg
+xX7mSR9CqnyQcYkRHI3oXk6836B39tvCeVg2lQc4rSJikAgvUGNRoXcmH8iLrmZ
3T+nuFQOpfJP2XeSx/HKISJsfwqN2JlbM1z89UdejY+lLFvStC7Om+K8WE3idONt
xFNOR0JK3WWKWV6bV4qzElujAsHmdoOX8CyUnbRWSIemGviOwLnjEtvDcTMT0k3e
qtMUVQxLVjm0sBDIzOp3IfIi37WDpnXtxeGh6xnGjdeFi3fEk2X47PVelnChj8xQ
PSku9Mid6y3p4497tecoLMqS7mKncMfYAMyF4IaEZR6FTJJUcXdxUQfOdjyPs2rt
is1JskLXA1aNCIESIAshqAtcoXjXf6ybL7WzSUKqhkz01JujK5jp9FsypLOPLGCS
/4uryAv6Suk9judIACvcMqgP4FeGP9G6+EcusTnSdJ3MCla15FduvtlEbdWIiSOG
8L1b8xHi9PhysOtuenl+lxMJ3lBZDVIiwBYghQvlbG44sQMIj29kvBX+ZTyu22Th
3cdytF4JchIDsp1iKl5R
=vRWK
-----END PGP SIGNATURE-----