You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ha...@on2trade.de on 2001/03/19 17:58:02 UTC
html:link and ssl
Hallo,
I have some problems with the struts html-tag link with the
properties forward or page. I want to use this tag with ssl. It doesn't
create the link, because the method in
org.apache.struts.util.RequestUtils throws in the method
absoluteURL a MalformedURLException because unknown
protocol.
Do I need some additional package for ssl? Or is there a other
solution?
Thanks for help
Harald
Re: html:link and ssl
Posted by ha...@on2trade.de.
Hallo,
here is my example:
struts-config:
<global-forwards>
..
<forward name="login" path="/2/login.jsp"/>
..
</global-forwards>
an now I want to use in every page something like this:
<body>
..
<html:link forward="login">login </html:link>
..
</body>
I don't want to switch from ssl to non-ssl. I am using the whole time ssl. But the
link wouldn't be create.
Example for testing page:
<html>
<head>
</head>
<body >
<%=pageContext.getRequest().getScheme() %><br>
<%=pageContext.getRequest().getServerName() %><br>
<%=pageContext.getRequest().getServerPort() %><br>
<%=((HttpServletRequest)pageContext.getRequest()).getContextPath() %><br>
<%java.net.URL url = new java.net.URL(request.getScheme(),
request.getServerName(),
request.getServerPort(),
request.getContextPath());%>
<%=url.toString()%>
<html:link forward="login">index</html:link>
</body>
</html>
When I request this page with: http://myserver/mycontext/index.jsp I get back:
http
myserver
80
/mycontext
http://myserver/mycontext
login (as link)
When I request this page with: https://myserver/mycontext/index.jsp
I get back:
Exception:
java.net.MalformedURLException: unknown protocol: https at
java.net.URL.(URL.java:307) at java.net.URL.(URL.java:224)
I hope this will explame my problem in more details.
Harald
On 19 Mar 2001, at 9:24, Craig R. McClanahan wrote:
>
>
> On Mon, 19 Mar 2001 harald.ruf@on2trade.de wrote:
>
> > Hallo,
> >
> > I have some problems with the struts html-tag link with the
> > properties forward or page. I want to use this tag with ssl. It doesn't
> > create the link, because the method in
> > org.apache.struts.util.RequestUtils throws in the method
> > absoluteURL a MalformedURLException because unknown
> > protocol.
> > Do I need some additional package for ssl? Or is there a other
> > solution?
> >
>
> Could you give an example of how you are trying to do this?
>
> Note that trying to use the "page" attribute only works within the current
> web application (the path you give it is context-relative beginning with a
> "/"). To go to a different web application, or to switch from SSL to
> non-SSL or back, you will need to make sure you generate a redirection,
> either by using the "href" attribute, or by referencing a <forward>
> element that has redirect="true" on it.
>
> > Thanks for help
> >
> > Harald
> >
>
> Craig
>
>
Re: html:link and ssl
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Mon, 19 Mar 2001 harald.ruf@on2trade.de wrote:
> Hallo,
>
> I have some problems with the struts html-tag link with the
> properties forward or page. I want to use this tag with ssl. It doesn't
> create the link, because the method in
> org.apache.struts.util.RequestUtils throws in the method
> absoluteURL a MalformedURLException because unknown
> protocol.
> Do I need some additional package for ssl? Or is there a other
> solution?
>
Could you give an example of how you are trying to do this?
Note that trying to use the "page" attribute only works within the current
web application (the path you give it is context-relative beginning with a
"/"). To go to a different web application, or to switch from SSL to
non-SSL or back, you will need to make sure you generate a redirection,
either by using the "href" attribute, or by referencing a <forward>
element that has redirect="true" on it.
> Thanks for help
>
> Harald
>
Craig