You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Mike Mander <wi...@gmx.de> on 2011/09/26 08:39:20 UTC

[Migration 1.5] Howto configure HttpsMapper to ignore https protocol by configuration?

Hi,

on my integration server there is another application using the ssl port 
(certificate etc.). I can't disable it so far.
Because ssl certificate can only be used for one app, i disabled ssl by 
configuration for my app with wicket 1.4.x.
I configured the https port to -1 and so ssl (with HttpsRequired 
annotation) was ignored and http was used instead.

WicketApplication.java
<code>
     @Override
     protected IRequestCycleProcessor newRequestCycleProcessor() {
         HttpsConfig config = new HttpsConfig(_httpPort, _httpsPort);
         return new HttpsRequestCycleProcessor(config) {

             @Override
             protected IRequestTarget checkSecureIncoming(IRequestTarget 
target) {
                 if (_httpsPort == -1) {
                     return target;
                 }
                 return super.checkSecureIncoming(target);
             }

             @Override
             protected IRequestTarget checkSecureOutgoing(IRequestTarget 
target) {
                 if (_httpsPort == -1) {
                     return target;
                 }
                 return super.checkSecureOutgoing(target);
             }
         };
     }

</code>

But with 1.5 the HttpsMapper is not configurable this way. Extending 
HttpsMapper wasn't working because of the  maphandler implementation. Is 
there another way to solve this usecase?

Thanks
Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: [Migration 1.5] Howto configure HttpsMapper to ignore https protocol by configuration?

Posted by Mike Mander <wi...@gmx.de>.
Thanks Martin,

Problem solved. Instead of implementing something i've configured the 
mapper:
         if (_httpsPort > -1) {
             setRootRequestMapper(new 
HttpsMapper(getRootRequestMapper(), new HttpsConfig(_httpPort, 
_httpsPort)));
         }

:-)
That is simple and no need to copy code :-)

Thanks for help
Mike
> Can't you just return the passed IRequestHandler/Url in
> mapHandler/mapRequest() methods if the https port is -1 ?
> No need to use HttpsRequestChecker at all.
>
> On Mon, Sep 26, 2011 at 11:17 AM, Mike Mander<wi...@gmx.de>  wrote:
>> Thanks Martin,
>>
>> Overriding / implementing my own mapper would be an option if i could use
>> the HttpsRequestChecker.
>> But it's package private (1.5.0).
>>
>> But thinking about that again lead me to another option =>  set the
>> https_port in config.
>> setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new
>> HttpsConfig(_httpPort, _httpsPort == -1 ? _httpPort : _httpsPort)));
>>
>> But now i have still the problem with setting the protocol of url.
>>
>> Mike
>>
>>> Just override
>>> org.apache.wicket.protocol.https.HttpsMapper.mapRequest(Request)
>>> and/or
>>> org.apache.wicket.protocol.https.HttpsMapper.mapHandler(IRequestHandler)
>>> and do whatever you need.
>>> This class is very simple. You can even create your own.
>>>
>>> On Mon, Sep 26, 2011 at 8:39 AM, Mike Mander<wi...@gmx.de>    wrote:
>>>> Hi,
>>>>
>>>> on my integration server there is another application using the ssl port
>>>> (certificate etc.). I can't disable it so far.
>>>> Because ssl certificate can only be used for one app, i disabled ssl by
>>>> configuration for my app with wicket 1.4.x.
>>>> I configured the https port to -1 and so ssl (with HttpsRequired
>>>> annotation)
>>>> was ignored and http was used instead.
>>>>
>>>> WicketApplication.java
>>>> <code>
>>>>     @Override
>>>>     protected IRequestCycleProcessor newRequestCycleProcessor() {
>>>>         HttpsConfig config = new HttpsConfig(_httpPort, _httpsPort);
>>>>         return new HttpsRequestCycleProcessor(config) {
>>>>
>>>>             @Override
>>>>             protected IRequestTarget checkSecureIncoming(IRequestTarget
>>>> target) {
>>>>                 if (_httpsPort == -1) {
>>>>                     return target;
>>>>                 }
>>>>                 return super.checkSecureIncoming(target);
>>>>             }
>>>>
>>>>             @Override
>>>>             protected IRequestTarget checkSecureOutgoing(IRequestTarget
>>>> target) {
>>>>                 if (_httpsPort == -1) {
>>>>                     return target;
>>>>                 }
>>>>                 return super.checkSecureOutgoing(target);
>>>>             }
>>>>         };
>>>>     }
>>>>
>>>> </code>
>>>>
>>>> But with 1.5 the HttpsMapper is not configurable this way. Extending
>>>> HttpsMapper wasn't working because of the  maphandler implementation. Is
>>>> there another way to solve this usecase?
>>>>
>>>> Thanks
>>>> Mike
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: [Migration 1.5] Howto configure HttpsMapper to ignore https protocol by configuration?

Posted by Martin Grigorov <mg...@apache.org>.
Can't you just return the passed IRequestHandler/Url in
mapHandler/mapRequest() methods if the https port is -1 ?
No need to use HttpsRequestChecker at all.

On Mon, Sep 26, 2011 at 11:17 AM, Mike Mander <wi...@gmx.de> wrote:
> Thanks Martin,
>
> Overriding / implementing my own mapper would be an option if i could use
> the HttpsRequestChecker.
> But it's package private (1.5.0).
>
> But thinking about that again lead me to another option => set the
> https_port in config.
> setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new
> HttpsConfig(_httpPort, _httpsPort == -1 ? _httpPort : _httpsPort)));
>
> But now i have still the problem with setting the protocol of url.
>
> Mike
>
>> Just override
>> org.apache.wicket.protocol.https.HttpsMapper.mapRequest(Request)
>> and/or
>> org.apache.wicket.protocol.https.HttpsMapper.mapHandler(IRequestHandler)
>> and do whatever you need.
>> This class is very simple. You can even create your own.
>>
>> On Mon, Sep 26, 2011 at 8:39 AM, Mike Mander<wi...@gmx.de>  wrote:
>>>
>>> Hi,
>>>
>>> on my integration server there is another application using the ssl port
>>> (certificate etc.). I can't disable it so far.
>>> Because ssl certificate can only be used for one app, i disabled ssl by
>>> configuration for my app with wicket 1.4.x.
>>> I configured the https port to -1 and so ssl (with HttpsRequired
>>> annotation)
>>> was ignored and http was used instead.
>>>
>>> WicketApplication.java
>>> <code>
>>>    @Override
>>>    protected IRequestCycleProcessor newRequestCycleProcessor() {
>>>        HttpsConfig config = new HttpsConfig(_httpPort, _httpsPort);
>>>        return new HttpsRequestCycleProcessor(config) {
>>>
>>>            @Override
>>>            protected IRequestTarget checkSecureIncoming(IRequestTarget
>>> target) {
>>>                if (_httpsPort == -1) {
>>>                    return target;
>>>                }
>>>                return super.checkSecureIncoming(target);
>>>            }
>>>
>>>            @Override
>>>            protected IRequestTarget checkSecureOutgoing(IRequestTarget
>>> target) {
>>>                if (_httpsPort == -1) {
>>>                    return target;
>>>                }
>>>                return super.checkSecureOutgoing(target);
>>>            }
>>>        };
>>>    }
>>>
>>> </code>
>>>
>>> But with 1.5 the HttpsMapper is not configurable this way. Extending
>>> HttpsMapper wasn't working because of the  maphandler implementation. Is
>>> there another way to solve this usecase?
>>>
>>> Thanks
>>> Mike
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: [Migration 1.5] Howto configure HttpsMapper to ignore https protocol by configuration?

Posted by Mike Mander <wi...@gmx.de>.
Thanks Martin,

Overriding / implementing my own mapper would be an option if i could 
use the HttpsRequestChecker.
But it's package private (1.5.0).

But thinking about that again lead me to another option => set the 
https_port in config.
setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new 
HttpsConfig(_httpPort, _httpsPort == -1 ? _httpPort : _httpsPort)));

But now i have still the problem with setting the protocol of url.

Mike

> Just override org.apache.wicket.protocol.https.HttpsMapper.mapRequest(Request)
> and/or org.apache.wicket.protocol.https.HttpsMapper.mapHandler(IRequestHandler)
> and do whatever you need.
> This class is very simple. You can even create your own.
>
> On Mon, Sep 26, 2011 at 8:39 AM, Mike Mander<wi...@gmx.de>  wrote:
>> Hi,
>>
>> on my integration server there is another application using the ssl port
>> (certificate etc.). I can't disable it so far.
>> Because ssl certificate can only be used for one app, i disabled ssl by
>> configuration for my app with wicket 1.4.x.
>> I configured the https port to -1 and so ssl (with HttpsRequired annotation)
>> was ignored and http was used instead.
>>
>> WicketApplication.java
>> <code>
>>     @Override
>>     protected IRequestCycleProcessor newRequestCycleProcessor() {
>>         HttpsConfig config = new HttpsConfig(_httpPort, _httpsPort);
>>         return new HttpsRequestCycleProcessor(config) {
>>
>>             @Override
>>             protected IRequestTarget checkSecureIncoming(IRequestTarget
>> target) {
>>                 if (_httpsPort == -1) {
>>                     return target;
>>                 }
>>                 return super.checkSecureIncoming(target);
>>             }
>>
>>             @Override
>>             protected IRequestTarget checkSecureOutgoing(IRequestTarget
>> target) {
>>                 if (_httpsPort == -1) {
>>                     return target;
>>                 }
>>                 return super.checkSecureOutgoing(target);
>>             }
>>         };
>>     }
>>
>> </code>
>>
>> But with 1.5 the HttpsMapper is not configurable this way. Extending
>> HttpsMapper wasn't working because of the  maphandler implementation. Is
>> there another way to solve this usecase?
>>
>> Thanks
>> Mike
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: [Migration 1.5] Howto configure HttpsMapper to ignore https protocol by configuration?

Posted by Martin Grigorov <mg...@apache.org>.
Just override org.apache.wicket.protocol.https.HttpsMapper.mapRequest(Request)
and/or org.apache.wicket.protocol.https.HttpsMapper.mapHandler(IRequestHandler)
and do whatever you need.
This class is very simple. You can even create your own.

On Mon, Sep 26, 2011 at 8:39 AM, Mike Mander <wi...@gmx.de> wrote:
> Hi,
>
> on my integration server there is another application using the ssl port
> (certificate etc.). I can't disable it so far.
> Because ssl certificate can only be used for one app, i disabled ssl by
> configuration for my app with wicket 1.4.x.
> I configured the https port to -1 and so ssl (with HttpsRequired annotation)
> was ignored and http was used instead.
>
> WicketApplication.java
> <code>
>    @Override
>    protected IRequestCycleProcessor newRequestCycleProcessor() {
>        HttpsConfig config = new HttpsConfig(_httpPort, _httpsPort);
>        return new HttpsRequestCycleProcessor(config) {
>
>            @Override
>            protected IRequestTarget checkSecureIncoming(IRequestTarget
> target) {
>                if (_httpsPort == -1) {
>                    return target;
>                }
>                return super.checkSecureIncoming(target);
>            }
>
>            @Override
>            protected IRequestTarget checkSecureOutgoing(IRequestTarget
> target) {
>                if (_httpsPort == -1) {
>                    return target;
>                }
>                return super.checkSecureOutgoing(target);
>            }
>        };
>    }
>
> </code>
>
> But with 1.5 the HttpsMapper is not configurable this way. Extending
> HttpsMapper wasn't working because of the  maphandler implementation. Is
> there another way to solve this usecase?
>
> Thanks
> Mike
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org