Re: Wicket 7 Websocket Gradle or Maven file with Jetty 9.3?

2014-12-10 Thread Martin Grigorov
Welcome !

Please file a ticket about the problem with RedirectPage.
With a quickstart would be the best!
I don't quite understand the issue from the description below.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Dec 10, 2014 at 10:25 PM, Adam Hammer  wrote:

> Thank you for that, Looks like everything is working in regards to
> Websockets.
>
> Speaking of constructors, RedirectPage() might need a public no-args
> constructor. Since wicket 7 it doesn't work with IFrame properly. I
> switched to WebMarkupContainer with a Attribute Modifier to get around, but
> not serializable.
>
> Thanks again for your help in this matter. I hope to share my Wicket based
> project with the group soon! I've been building a CMS/Platform on top of it
> since Wicket 5.
>
> Sincerely,
>Adam Hammer
>
>
> On Wed, Dec 10, 2014 at 5:30 AM, Martin Grigorov 
> wrote:
>
> > On Wed, Dec 10, 2014 at 3:23 PM, Martin Grigorov 
> > wrote:
> >
> > > The problem is that with your code Jetty won't scan
> > > for javax.websocket.server.ServerApplicationConfig's in the classpath.
> > > So org.apache.wicket.protocol.ws.javax.WicketServerApplicationConfig is
> > > not used at all.
> > >
> > > Here is a trick that I've just did to make my websocket demo work in
> > > embedded Jetty:
> > >
> > > Create a class :
> > >
> > > package org.apache.wicket.protocol.ws.javax;
> > >
> > > public class MyEndpointConfig extends WicketServerEndpointConfig
> > > {
> > > }
> > >
> > > You need to do that because WicketServerEndpointConfig has package
> > private
> > > visibility. (I'll make it public for the next release)
> > >
> >
> > https://issues.apache.org/jira/browse/WICKET-5789
> >
> >
> > >
> > > Then do:
> > > wscontainer.addEndpoint(new MyEndpointConfig());
> > >
> > > Voila!
> > >
> > > If you find a way to tell Jetty to do a proper scan in embedded mode
> then
> > > please share it with me!
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Wed, Dec 10, 2014 at 1:19 PM, Adam Hammer 
> > > wrote:
> > >
> > >> Neither of those break, at the WebSocket parts.
> > >>
> > >> It's embedded jetty 9.3
> > >>
> > >>   server = new Server(Simple.getPort());
> > >> WebAppContext bb = new WebAppContext();
> > >> bb.setServer(server);
> > >> bb.setContextPath("/");
> > >> bb.setWar("src/main/webapp");
> > >>
> > >>
> > >> // START JMX SERVER
> > >> // MBeanServer mBeanServer =
> > >> ManagementFactory.getPlatformMBeanServer();
> > >> // MBeanContainer mBeanContainer = new
> > >> MBeanContainer(mBeanServer);
> > >> // server.getContainer().addEventListener(mBeanContainer);
> > >> // mBeanContainer.start();
> > >>
> > >> server.setHandler(bb);
> > >>
> > >> try {
> > >> ServerContainer wscontainer =
> > >> WebSocketServerContainerInitializer.configureContext(bb);
> > >> wscontainer.addEndpoint(EventSocket.class);
> > >> server.start();
> > >> } catch (Exception e) {
> > >> System.out.println(Simple.getPort());
> > >> e.printStackTrace();
> > >> System.exit(1);
> > >> }
> > >>
> > >> I put the EventSocket.class in my code to listen to callbacks on
> Jetty's
> > >> side, nothing is triggered in it either.
> > >>
> > >> Thanks for any help,
> > >>Adam
> > >>
> > >> On Wed, Dec 10, 2014 at 1:17 AM, Martin Grigorov <
> mgrigo...@apache.org>
> > >> wrote:
> > >>
> > >> > Hi,
> > >> >
> > >> > The dependencies look good.
> > >> > The ws:/ url also looks good.
> > >> > It seems the Endpoint is not registered though.
> > >> > How do you start the application ? Do you deploy in standalone Jetty
> > or
> > >> do
> > >> > you use embedded Jetty ?
> > >> > Put a breakpoint
> > >> > at org.apache.wicket.protocol.ws.javax.WicketEndpoint#onOpen() and
> > >> > at
> > >> >
> > >>
> >
> org.apache.wicket.protocol.ws.javax.WicketServerApplicationConfig#getEndpointConfigs().
> > >> > Is any of them called ?
> > >> >
> > >> > Martin Grigorov
> > >> > Wicket Training and Consulting
> > >> > https://twitter.com/mtgrigorov
> > >> >
> > >> > On Wed, Dec 10, 2014 at 11:01 AM, Adam Hammer <
> adamhamm...@gmail.com>
> > >> > wrote:
> > >> >
> > >> > > Hi Wicket Group Members.
> > >> > >
> > >> > > Anyone have this, I can't seem to get websocket to connect
> > >> > Wicket7.0.0m4, I
> > >> > > suspect my problem is something with dependencies with jetty 9.3+?
> > >> > >
> > >> > > The behavior is injected properly, however in the Javascript
> console
> > >> in
> > >> > the
> > >> > > client I have the following.
> > >> > >
> > >> > > Firefox can't establish a connection to the server at
> > >> > >
> > >> > >
> > >> >
> > >>
> >
> ws://localhost:8080/wicket/websocket?pageId=0&wicket-ajax-baseurl=%3F0&wicket-app-name=simple.
> > >> > >
> > >> > > My build.gradle dependencies
> > >> > >
> > >> > > --- Begin

Re: Wicket 7 Websocket Gradle or Maven file with Jetty 9.3?

2014-12-10 Thread Adam Hammer
Thank you for that, Looks like everything is working in regards to
Websockets.

Speaking of constructors, RedirectPage() might need a public no-args
constructor. Since wicket 7 it doesn't work with IFrame properly. I
switched to WebMarkupContainer with a Attribute Modifier to get around, but
not serializable.

Thanks again for your help in this matter. I hope to share my Wicket based
project with the group soon! I've been building a CMS/Platform on top of it
since Wicket 5.

Sincerely,
   Adam Hammer


On Wed, Dec 10, 2014 at 5:30 AM, Martin Grigorov 
wrote:

> On Wed, Dec 10, 2014 at 3:23 PM, Martin Grigorov 
> wrote:
>
> > The problem is that with your code Jetty won't scan
> > for javax.websocket.server.ServerApplicationConfig's in the classpath.
> > So org.apache.wicket.protocol.ws.javax.WicketServerApplicationConfig is
> > not used at all.
> >
> > Here is a trick that I've just did to make my websocket demo work in
> > embedded Jetty:
> >
> > Create a class :
> >
> > package org.apache.wicket.protocol.ws.javax;
> >
> > public class MyEndpointConfig extends WicketServerEndpointConfig
> > {
> > }
> >
> > You need to do that because WicketServerEndpointConfig has package
> private
> > visibility. (I'll make it public for the next release)
> >
>
> https://issues.apache.org/jira/browse/WICKET-5789
>
>
> >
> > Then do:
> > wscontainer.addEndpoint(new MyEndpointConfig());
> >
> > Voila!
> >
> > If you find a way to tell Jetty to do a proper scan in embedded mode then
> > please share it with me!
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Wed, Dec 10, 2014 at 1:19 PM, Adam Hammer 
> > wrote:
> >
> >> Neither of those break, at the WebSocket parts.
> >>
> >> It's embedded jetty 9.3
> >>
> >>   server = new Server(Simple.getPort());
> >> WebAppContext bb = new WebAppContext();
> >> bb.setServer(server);
> >> bb.setContextPath("/");
> >> bb.setWar("src/main/webapp");
> >>
> >>
> >> // START JMX SERVER
> >> // MBeanServer mBeanServer =
> >> ManagementFactory.getPlatformMBeanServer();
> >> // MBeanContainer mBeanContainer = new
> >> MBeanContainer(mBeanServer);
> >> // server.getContainer().addEventListener(mBeanContainer);
> >> // mBeanContainer.start();
> >>
> >> server.setHandler(bb);
> >>
> >> try {
> >> ServerContainer wscontainer =
> >> WebSocketServerContainerInitializer.configureContext(bb);
> >> wscontainer.addEndpoint(EventSocket.class);
> >> server.start();
> >> } catch (Exception e) {
> >> System.out.println(Simple.getPort());
> >> e.printStackTrace();
> >> System.exit(1);
> >> }
> >>
> >> I put the EventSocket.class in my code to listen to callbacks on Jetty's
> >> side, nothing is triggered in it either.
> >>
> >> Thanks for any help,
> >>Adam
> >>
> >> On Wed, Dec 10, 2014 at 1:17 AM, Martin Grigorov 
> >> wrote:
> >>
> >> > Hi,
> >> >
> >> > The dependencies look good.
> >> > The ws:/ url also looks good.
> >> > It seems the Endpoint is not registered though.
> >> > How do you start the application ? Do you deploy in standalone Jetty
> or
> >> do
> >> > you use embedded Jetty ?
> >> > Put a breakpoint
> >> > at org.apache.wicket.protocol.ws.javax.WicketEndpoint#onOpen() and
> >> > at
> >> >
> >>
> org.apache.wicket.protocol.ws.javax.WicketServerApplicationConfig#getEndpointConfigs().
> >> > Is any of them called ?
> >> >
> >> > Martin Grigorov
> >> > Wicket Training and Consulting
> >> > https://twitter.com/mtgrigorov
> >> >
> >> > On Wed, Dec 10, 2014 at 11:01 AM, Adam Hammer 
> >> > wrote:
> >> >
> >> > > Hi Wicket Group Members.
> >> > >
> >> > > Anyone have this, I can't seem to get websocket to connect
> >> > Wicket7.0.0m4, I
> >> > > suspect my problem is something with dependencies with jetty 9.3+?
> >> > >
> >> > > The behavior is injected properly, however in the Javascript console
> >> in
> >> > the
> >> > > client I have the following.
> >> > >
> >> > > Firefox can't establish a connection to the server at
> >> > >
> >> > >
> >> >
> >>
> ws://localhost:8080/wicket/websocket?pageId=0&wicket-ajax-baseurl=%3F0&wicket-app-name=simple.
> >> > >
> >> > > My build.gradle dependencies
> >> > >
> >> > > --- Begin Build.gradle dependencies
> >> > > dependencies {
> >> > > compile 'org.apache.wicket:wicket-core:7.+'
> >> > > compile 'org.apache.wicket:wicket-extensions:7.+'
> >> > > compile 'org.apache.wicket:wicket-native-websocket-core:7.+'
> >> > > compile 'org.eclipse.jetty.aggregate:jetty-all:9.+'
> >> > > compile 'org.apache.wicket:wicket-native-websocket-javax:7.+'
> >> > > compile 'javax.websocket:javax.websocket-api:1.1'
> >> > > compile  'org.reflections:reflections-maven:0.9.9-RC1'
> >> > > compile 'org.apache.httpcomponents:httpclient:4.+'
> >> > > compile 'org.apache.commons:commons-exec:1.3'
> >> > > com

Re: How to instruct RenderPageRequestHandler to redirect using 301 Permanent

2014-12-10 Thread Hendy Irawan
Awesome!!!

Thank so much Martin! And additional thanks for answering so quickly :))

Hendy

On Wed, Dec 10, 2014, 20:36 Martin Grigorov-4 [via Apache Wicket] <
ml-node+s1842946n4668721...@n4.nabble.com> wrote:

> RequestCycle.get().urlFor(pageClass, parameters)
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Wed, Dec 10, 2014 at 3:20 PM, Hendy Irawan <[hidden email]
> > wrote:
>
> > Thanks for prompt advice Martin, however please explain more... I
> commented
> > that code because I don't know how to construct the redirectUrl String
> from
> > a PageProvider, inside RequestMapper.mapRequest? (Or alternatively, from
> > PageClass + PageParameters)
> >
> > Hoping you can shed light on this.
> > Thanks in advance.
> >
> > Hendy
> >
> > On Wed, Dec 10, 2014, 20:12 Martin Grigorov-4 [via Apache Wicket] <
> > [hidden email] >
> wrote:
> >
> > > Hi,
> > >
> > > To do a "normal" redirect Wicket
> > > uses javax.servlet.http.HttpServletResponse#sendRedirect() and this
> sets
> > > 302 as a code.
> > > To have better control you should use RedirectRequestHandler, as in
> your
> > > commented out code.
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Wed, Dec 10, 2014 at 2:56 PM, Hendy Irawan <[hidden email]
> > > > wrote:
> > >
> > > > I currently have a custom SEO-friendly RequestMapper with the
> following
> > > > snippet:
> > > >
> > > > @Override
> > > > public final IRequestHandler mapRequest(Request request) {
> > > > try {
> > > > final String userAgent = ((HttpServletRequest)
> > > > request.getContainerRequest()).getHeader("User-Agent");
> > > > final RedirectPolicy redirectPolicy = userAgent !=
> null
> > > &&
> > > > BotUtils.isBot(userAgent) ? RedirectPolicy.NEVER_REDIRECT :
> > > > RedirectPolicy.AUTO_REDIRECT;
> > > >
> > > > final UrlInfo urlInfo = parseRequest(request);
> > > >
> > > > // check if the URL is long enough and starts with
> the
> > > > proper segments
> > > > if (urlInfo != null)
> > > > {
> > > > PageComponentInfo info =
> > > > urlInfo.getPageComponentInfo();
> > > > Class pageClass
> =
> > > > urlInfo.getPageClass();
> > > > PageParameters pageParameters =
> > > > urlInfo.getPageParameters();
> > > >
> > > > if (info == null)
> > > > {
> > > > // if there are is no page instance
> > > > information
> > > > // then this is a simple
> bookmarkable
> > > URL
> > > > return
> processBookmarkable(pageClass,
> > > > pageParameters, redirectPolicy);
> > > > }
> > > > else if (info.getPageInfo().getPageId() !=
> null
> > > &&
> > > > info.getComponentInfo() == null)
> > > > {
> > > > // if there is page instance
> > information
> > > > in the URL but no component and
> > > > listener
> > > > // interface then this is a hybrid
> URL
> > -
> > > > we need to try to reuse
> > > > existing page
> > > > // instance
> > > > return
> > processHybrid(info.getPageInfo(),
> > > > pageClass, pageParameters,
> > > > null);
> > > > }
> > > > else if (info.getComponentInfo() != null)
> > > > {
> > > > // with both page instance and
> > > > component+listener this is a listener
> > > > interface URL
> > > > return processListener(info,
> pageClass,
> > > > pageParameters);
> > > > }
> > > > else if (info.getPageInfo().getPageId() ==
> > null)
> > > > {
> > > > return
> processBookmarkable(pageClass,
> > > > pageParameters, redirectPolicy);
> > > > }
> > > >
> > > > }
> > > > return null;
> > > > } catch (MapperRedirectException e) {
> > > > log.debug("Redirecting '{}' to canonical page: {}",
> > > > request.getUrl(),
> > > > e.getPageProvider());
> > > > //  return new
> RedirectRequestHandler(redirectUrl,
> > > > 301);
> > > > return new
> > RenderPageRequestHandler(e.getPageProvider(),
> > > > RedirectPolicy.ALWAYS_REDIRECT);
> > > > }
> > > > }
> > > >
> > > > What it does is allow freeform root URI paths, e.g.
> > > > http://www.tuneeca.com/t-1113012 instead of 

Re: How to instruct RenderPageRequestHandler to redirect using 301 Permanent

2014-12-10 Thread Martin Grigorov
RequestCycle.get().urlFor(pageClass, parameters)

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Dec 10, 2014 at 3:20 PM, Hendy Irawan  wrote:

> Thanks for prompt advice Martin, however please explain more... I commented
> that code because I don't know how to construct the redirectUrl String from
> a PageProvider, inside RequestMapper.mapRequest? (Or alternatively, from
> PageClass + PageParameters)
>
> Hoping you can shed light on this.
> Thanks in advance.
>
> Hendy
>
> On Wed, Dec 10, 2014, 20:12 Martin Grigorov-4 [via Apache Wicket] <
> ml-node+s1842946n4668717...@n4.nabble.com> wrote:
>
> > Hi,
> >
> > To do a "normal" redirect Wicket
> > uses javax.servlet.http.HttpServletResponse#sendRedirect() and this sets
> > 302 as a code.
> > To have better control you should use RedirectRequestHandler, as in your
> > commented out code.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Wed, Dec 10, 2014 at 2:56 PM, Hendy Irawan <[hidden email]
> > > wrote:
> >
> > > I currently have a custom SEO-friendly RequestMapper with the following
> > > snippet:
> > >
> > > @Override
> > > public final IRequestHandler mapRequest(Request request) {
> > > try {
> > > final String userAgent = ((HttpServletRequest)
> > > request.getContainerRequest()).getHeader("User-Agent");
> > > final RedirectPolicy redirectPolicy = userAgent != null
> > &&
> > > BotUtils.isBot(userAgent) ? RedirectPolicy.NEVER_REDIRECT :
> > > RedirectPolicy.AUTO_REDIRECT;
> > >
> > > final UrlInfo urlInfo = parseRequest(request);
> > >
> > > // check if the URL is long enough and starts with the
> > > proper segments
> > > if (urlInfo != null)
> > > {
> > > PageComponentInfo info =
> > > urlInfo.getPageComponentInfo();
> > > Class pageClass =
> > > urlInfo.getPageClass();
> > > PageParameters pageParameters =
> > > urlInfo.getPageParameters();
> > >
> > > if (info == null)
> > > {
> > > // if there are is no page instance
> > > information
> > > // then this is a simple bookmarkable
> > URL
> > > return processBookmarkable(pageClass,
> > > pageParameters, redirectPolicy);
> > > }
> > > else if (info.getPageInfo().getPageId() != null
> > &&
> > > info.getComponentInfo() == null)
> > > {
> > > // if there is page instance
> information
> > > in the URL but no component and
> > > listener
> > > // interface then this is a hybrid URL
> -
> > > we need to try to reuse
> > > existing page
> > > // instance
> > > return
> processHybrid(info.getPageInfo(),
> > > pageClass, pageParameters,
> > > null);
> > > }
> > > else if (info.getComponentInfo() != null)
> > > {
> > > // with both page instance and
> > > component+listener this is a listener
> > > interface URL
> > > return processListener(info, pageClass,
> > > pageParameters);
> > > }
> > > else if (info.getPageInfo().getPageId() ==
> null)
> > > {
> > > return processBookmarkable(pageClass,
> > > pageParameters, redirectPolicy);
> > > }
> > >
> > > }
> > > return null;
> > > } catch (MapperRedirectException e) {
> > > log.debug("Redirecting '{}' to canonical page: {}",
> > > request.getUrl(),
> > > e.getPageProvider());
> > > //  return new RedirectRequestHandler(redirectUrl,
> > > 301);
> > > return new
> RenderPageRequestHandler(e.getPageProvider(),
> > > RedirectPolicy.ALWAYS_REDIRECT);
> > > }
> > > }
> > >
> > > What it does is allow freeform root URI paths, e.g.
> > > http://www.tuneeca.com/t-1113012 instead of the longer
> > > http://www.tuneeca.com/product/t-1113012 .
> > >
> > > Now, requests to http://www.tuneeca.com/product/t-1113012 are also
> > handled
> > > by the same RequestMapper and will be redirected to
> > > http://www.tuneeca.com/t-1113012 .
> > >
> > > However, currently it's using 302 temporary redirect. How to make it
> use
> > > 301
> > > permanent redirect?
> > >
> > > Thank you.
> > >
> > > Hendy
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://apache-wicket.1842946.n4.nabble.com/How-to-instruct-RenderPageRequestHandler-to-redirect-using

Re: How to instruct RenderPageRequestHandler to redirect using 301 Permanent

2014-12-10 Thread Hendy Irawan
Thanks for prompt advice Martin, however please explain more... I commented
that code because I don't know how to construct the redirectUrl String from
a PageProvider, inside RequestMapper.mapRequest? (Or alternatively, from
PageClass + PageParameters)

Hoping you can shed light on this.
Thanks in advance.

Hendy

On Wed, Dec 10, 2014, 20:12 Martin Grigorov-4 [via Apache Wicket] <
ml-node+s1842946n4668717...@n4.nabble.com> wrote:

> Hi,
>
> To do a "normal" redirect Wicket
> uses javax.servlet.http.HttpServletResponse#sendRedirect() and this sets
> 302 as a code.
> To have better control you should use RedirectRequestHandler, as in your
> commented out code.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Wed, Dec 10, 2014 at 2:56 PM, Hendy Irawan <[hidden email]
> > wrote:
>
> > I currently have a custom SEO-friendly RequestMapper with the following
> > snippet:
> >
> > @Override
> > public final IRequestHandler mapRequest(Request request) {
> > try {
> > final String userAgent = ((HttpServletRequest)
> > request.getContainerRequest()).getHeader("User-Agent");
> > final RedirectPolicy redirectPolicy = userAgent != null
> &&
> > BotUtils.isBot(userAgent) ? RedirectPolicy.NEVER_REDIRECT :
> > RedirectPolicy.AUTO_REDIRECT;
> >
> > final UrlInfo urlInfo = parseRequest(request);
> >
> > // check if the URL is long enough and starts with the
> > proper segments
> > if (urlInfo != null)
> > {
> > PageComponentInfo info =
> > urlInfo.getPageComponentInfo();
> > Class pageClass =
> > urlInfo.getPageClass();
> > PageParameters pageParameters =
> > urlInfo.getPageParameters();
> >
> > if (info == null)
> > {
> > // if there are is no page instance
> > information
> > // then this is a simple bookmarkable
> URL
> > return processBookmarkable(pageClass,
> > pageParameters, redirectPolicy);
> > }
> > else if (info.getPageInfo().getPageId() != null
> &&
> > info.getComponentInfo() == null)
> > {
> > // if there is page instance information
> > in the URL but no component and
> > listener
> > // interface then this is a hybrid URL -
> > we need to try to reuse
> > existing page
> > // instance
> > return processHybrid(info.getPageInfo(),
> > pageClass, pageParameters,
> > null);
> > }
> > else if (info.getComponentInfo() != null)
> > {
> > // with both page instance and
> > component+listener this is a listener
> > interface URL
> > return processListener(info, pageClass,
> > pageParameters);
> > }
> > else if (info.getPageInfo().getPageId() == null)
> > {
> > return processBookmarkable(pageClass,
> > pageParameters, redirectPolicy);
> > }
> >
> > }
> > return null;
> > } catch (MapperRedirectException e) {
> > log.debug("Redirecting '{}' to canonical page: {}",
> > request.getUrl(),
> > e.getPageProvider());
> > //  return new RedirectRequestHandler(redirectUrl,
> > 301);
> > return new RenderPageRequestHandler(e.getPageProvider(),
> > RedirectPolicy.ALWAYS_REDIRECT);
> > }
> > }
> >
> > What it does is allow freeform root URI paths, e.g.
> > http://www.tuneeca.com/t-1113012 instead of the longer
> > http://www.tuneeca.com/product/t-1113012 .
> >
> > Now, requests to http://www.tuneeca.com/product/t-1113012 are also
> handled
> > by the same RequestMapper and will be redirected to
> > http://www.tuneeca.com/t-1113012 .
> >
> > However, currently it's using 302 temporary redirect. How to make it use
> > 301
> > permanent redirect?
> >
> > Thank you.
> >
> > Hendy
> >
> >
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/How-to-instruct-RenderPageRequestHandler-to-redirect-using-301-Permanent-tp4668716.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > -
> > To unsubscribe, e-mail: [hidden email]
> 
> > For additional commands, e-mail: [hidden email]
> 
> >
> >
>
>
> --
>  If you reply to

Re: Wicket 7 Websocket Gradle or Maven file with Jetty 9.3?

2014-12-10 Thread Martin Grigorov
On Wed, Dec 10, 2014 at 3:23 PM, Martin Grigorov 
wrote:

> The problem is that with your code Jetty won't scan
> for javax.websocket.server.ServerApplicationConfig's in the classpath.
> So org.apache.wicket.protocol.ws.javax.WicketServerApplicationConfig is
> not used at all.
>
> Here is a trick that I've just did to make my websocket demo work in
> embedded Jetty:
>
> Create a class :
>
> package org.apache.wicket.protocol.ws.javax;
>
> public class MyEndpointConfig extends WicketServerEndpointConfig
> {
> }
>
> You need to do that because WicketServerEndpointConfig has package private
> visibility. (I'll make it public for the next release)
>

https://issues.apache.org/jira/browse/WICKET-5789


>
> Then do:
> wscontainer.addEndpoint(new MyEndpointConfig());
>
> Voila!
>
> If you find a way to tell Jetty to do a proper scan in embedded mode then
> please share it with me!
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Wed, Dec 10, 2014 at 1:19 PM, Adam Hammer 
> wrote:
>
>> Neither of those break, at the WebSocket parts.
>>
>> It's embedded jetty 9.3
>>
>>   server = new Server(Simple.getPort());
>> WebAppContext bb = new WebAppContext();
>> bb.setServer(server);
>> bb.setContextPath("/");
>> bb.setWar("src/main/webapp");
>>
>>
>> // START JMX SERVER
>> // MBeanServer mBeanServer =
>> ManagementFactory.getPlatformMBeanServer();
>> // MBeanContainer mBeanContainer = new
>> MBeanContainer(mBeanServer);
>> // server.getContainer().addEventListener(mBeanContainer);
>> // mBeanContainer.start();
>>
>> server.setHandler(bb);
>>
>> try {
>> ServerContainer wscontainer =
>> WebSocketServerContainerInitializer.configureContext(bb);
>> wscontainer.addEndpoint(EventSocket.class);
>> server.start();
>> } catch (Exception e) {
>> System.out.println(Simple.getPort());
>> e.printStackTrace();
>> System.exit(1);
>> }
>>
>> I put the EventSocket.class in my code to listen to callbacks on Jetty's
>> side, nothing is triggered in it either.
>>
>> Thanks for any help,
>>Adam
>>
>> On Wed, Dec 10, 2014 at 1:17 AM, Martin Grigorov 
>> wrote:
>>
>> > Hi,
>> >
>> > The dependencies look good.
>> > The ws:/ url also looks good.
>> > It seems the Endpoint is not registered though.
>> > How do you start the application ? Do you deploy in standalone Jetty or
>> do
>> > you use embedded Jetty ?
>> > Put a breakpoint
>> > at org.apache.wicket.protocol.ws.javax.WicketEndpoint#onOpen() and
>> > at
>> >
>> org.apache.wicket.protocol.ws.javax.WicketServerApplicationConfig#getEndpointConfigs().
>> > Is any of them called ?
>> >
>> > Martin Grigorov
>> > Wicket Training and Consulting
>> > https://twitter.com/mtgrigorov
>> >
>> > On Wed, Dec 10, 2014 at 11:01 AM, Adam Hammer 
>> > wrote:
>> >
>> > > Hi Wicket Group Members.
>> > >
>> > > Anyone have this, I can't seem to get websocket to connect
>> > Wicket7.0.0m4, I
>> > > suspect my problem is something with dependencies with jetty 9.3+?
>> > >
>> > > The behavior is injected properly, however in the Javascript console
>> in
>> > the
>> > > client I have the following.
>> > >
>> > > Firefox can't establish a connection to the server at
>> > >
>> > >
>> >
>> ws://localhost:8080/wicket/websocket?pageId=0&wicket-ajax-baseurl=%3F0&wicket-app-name=simple.
>> > >
>> > > My build.gradle dependencies
>> > >
>> > > --- Begin Build.gradle dependencies
>> > > dependencies {
>> > > compile 'org.apache.wicket:wicket-core:7.+'
>> > > compile 'org.apache.wicket:wicket-extensions:7.+'
>> > > compile 'org.apache.wicket:wicket-native-websocket-core:7.+'
>> > > compile 'org.eclipse.jetty.aggregate:jetty-all:9.+'
>> > > compile 'org.apache.wicket:wicket-native-websocket-javax:7.+'
>> > > compile 'javax.websocket:javax.websocket-api:1.1'
>> > > compile  'org.reflections:reflections-maven:0.9.9-RC1'
>> > > compile 'org.apache.httpcomponents:httpclient:4.+'
>> > > compile 'org.apache.commons:commons-exec:1.3'
>> > > compile  'org.apache.commons:commons-io:1.+'
>> > > compile  'org.apache.velocity:velocity:1.+'
>> > > compile  'com.google.inject:guice:3.+'
>> > > compile  'com.google.guava:guava:+'
>> > > compile  'com.google.code.gson:gson:+'
>> > > compile  'org.hibernate:hibernate-core:3.+'
>> > > compile  'org.hibernate:hibernate-entitymanager:3.+'
>> > > compile  'com.h2database:h2:1.+'
>> > > compile  'com.googlecode.juniversalchardet:juniversalchardet:1.+'
>> > > compile  'org.mockito:mockito-core:1.+'
>> > > compile  'org.slf4j:slf4j-log4j12:1.+'
>> > > compile 'log4j:log4j:1.+'
>> > > compile 'net.lingala.zip4j:zip4j:1.+'
>> > > compile 'net.glxn:qrgen:+'
>> > > compile 'org.bitcoinj:bitcoinj-core:+'
>> > > compile 'commons-io:commons-io:2.4'
>> > > compile 'commons-daemon:c

Re: Wicket 7 Websocket Gradle or Maven file with Jetty 9.3?

2014-12-10 Thread Martin Grigorov
The problem is that with your code Jetty won't scan
for javax.websocket.server.ServerApplicationConfig's in the classpath.
So org.apache.wicket.protocol.ws.javax.WicketServerApplicationConfig is not
used at all.

Here is a trick that I've just did to make my websocket demo work in
embedded Jetty:

Create a class :

package org.apache.wicket.protocol.ws.javax;

public class MyEndpointConfig extends WicketServerEndpointConfig
{
}

You need to do that because WicketServerEndpointConfig has package private
visibility. (I'll make it public for the next release)

Then do:
wscontainer.addEndpoint(new MyEndpointConfig());

Voila!

If you find a way to tell Jetty to do a proper scan in embedded mode then
please share it with me!

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Dec 10, 2014 at 1:19 PM, Adam Hammer  wrote:

> Neither of those break, at the WebSocket parts.
>
> It's embedded jetty 9.3
>
>   server = new Server(Simple.getPort());
> WebAppContext bb = new WebAppContext();
> bb.setServer(server);
> bb.setContextPath("/");
> bb.setWar("src/main/webapp");
>
>
> // START JMX SERVER
> // MBeanServer mBeanServer =
> ManagementFactory.getPlatformMBeanServer();
> // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
> // server.getContainer().addEventListener(mBeanContainer);
> // mBeanContainer.start();
>
> server.setHandler(bb);
>
> try {
> ServerContainer wscontainer =
> WebSocketServerContainerInitializer.configureContext(bb);
> wscontainer.addEndpoint(EventSocket.class);
> server.start();
> } catch (Exception e) {
> System.out.println(Simple.getPort());
> e.printStackTrace();
> System.exit(1);
> }
>
> I put the EventSocket.class in my code to listen to callbacks on Jetty's
> side, nothing is triggered in it either.
>
> Thanks for any help,
>Adam
>
> On Wed, Dec 10, 2014 at 1:17 AM, Martin Grigorov 
> wrote:
>
> > Hi,
> >
> > The dependencies look good.
> > The ws:/ url also looks good.
> > It seems the Endpoint is not registered though.
> > How do you start the application ? Do you deploy in standalone Jetty or
> do
> > you use embedded Jetty ?
> > Put a breakpoint
> > at org.apache.wicket.protocol.ws.javax.WicketEndpoint#onOpen() and
> > at
> >
> org.apache.wicket.protocol.ws.javax.WicketServerApplicationConfig#getEndpointConfigs().
> > Is any of them called ?
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Wed, Dec 10, 2014 at 11:01 AM, Adam Hammer 
> > wrote:
> >
> > > Hi Wicket Group Members.
> > >
> > > Anyone have this, I can't seem to get websocket to connect
> > Wicket7.0.0m4, I
> > > suspect my problem is something with dependencies with jetty 9.3+?
> > >
> > > The behavior is injected properly, however in the Javascript console in
> > the
> > > client I have the following.
> > >
> > > Firefox can't establish a connection to the server at
> > >
> > >
> >
> ws://localhost:8080/wicket/websocket?pageId=0&wicket-ajax-baseurl=%3F0&wicket-app-name=simple.
> > >
> > > My build.gradle dependencies
> > >
> > > --- Begin Build.gradle dependencies
> > > dependencies {
> > > compile 'org.apache.wicket:wicket-core:7.+'
> > > compile 'org.apache.wicket:wicket-extensions:7.+'
> > > compile 'org.apache.wicket:wicket-native-websocket-core:7.+'
> > > compile 'org.eclipse.jetty.aggregate:jetty-all:9.+'
> > > compile 'org.apache.wicket:wicket-native-websocket-javax:7.+'
> > > compile 'javax.websocket:javax.websocket-api:1.1'
> > > compile  'org.reflections:reflections-maven:0.9.9-RC1'
> > > compile 'org.apache.httpcomponents:httpclient:4.+'
> > > compile 'org.apache.commons:commons-exec:1.3'
> > > compile  'org.apache.commons:commons-io:1.+'
> > > compile  'org.apache.velocity:velocity:1.+'
> > > compile  'com.google.inject:guice:3.+'
> > > compile  'com.google.guava:guava:+'
> > > compile  'com.google.code.gson:gson:+'
> > > compile  'org.hibernate:hibernate-core:3.+'
> > > compile  'org.hibernate:hibernate-entitymanager:3.+'
> > > compile  'com.h2database:h2:1.+'
> > > compile  'com.googlecode.juniversalchardet:juniversalchardet:1.+'
> > > compile  'org.mockito:mockito-core:1.+'
> > > compile  'org.slf4j:slf4j-log4j12:1.+'
> > > compile 'log4j:log4j:1.+'
> > > compile 'net.lingala.zip4j:zip4j:1.+'
> > > compile 'net.glxn:qrgen:+'
> > > compile 'org.bitcoinj:bitcoinj-core:+'
> > > compile 'commons-io:commons-io:2.4'
> > > compile 'commons-daemon:commons-daemon:1.0.15'
> > > compile 'javax.mail:mail:1.4.1'
> > >
> > > testCompile 'junit:junit:4.10'
> > > }
> > > --- Web.xml filter
> > >
> > > simple
> > >
> > >
> > >
> >
> org.apache.wicket.protocol.ws.javax.JavaxWebSocketFilter
> > > 
> > >

Re: How to instruct RenderPageRequestHandler to redirect using 301 Permanent

2014-12-10 Thread Martin Grigorov
Hi,

To do a "normal" redirect Wicket
uses javax.servlet.http.HttpServletResponse#sendRedirect() and this sets
302 as a code.
To have better control you should use RedirectRequestHandler, as in your
commented out code.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Dec 10, 2014 at 2:56 PM, Hendy Irawan  wrote:

> I currently have a custom SEO-friendly RequestMapper with the following
> snippet:
>
> @Override
> public final IRequestHandler mapRequest(Request request) {
> try {
> final String userAgent = ((HttpServletRequest)
> request.getContainerRequest()).getHeader("User-Agent");
> final RedirectPolicy redirectPolicy = userAgent != null &&
> BotUtils.isBot(userAgent) ? RedirectPolicy.NEVER_REDIRECT :
> RedirectPolicy.AUTO_REDIRECT;
>
> final UrlInfo urlInfo = parseRequest(request);
>
> // check if the URL is long enough and starts with the
> proper segments
> if (urlInfo != null)
> {
> PageComponentInfo info =
> urlInfo.getPageComponentInfo();
> Class pageClass =
> urlInfo.getPageClass();
> PageParameters pageParameters =
> urlInfo.getPageParameters();
>
> if (info == null)
> {
> // if there are is no page instance
> information
> // then this is a simple bookmarkable URL
> return processBookmarkable(pageClass,
> pageParameters, redirectPolicy);
> }
> else if (info.getPageInfo().getPageId() != null &&
> info.getComponentInfo() == null)
> {
> // if there is page instance information
> in the URL but no component and
> listener
> // interface then this is a hybrid URL -
> we need to try to reuse
> existing page
> // instance
> return processHybrid(info.getPageInfo(),
> pageClass, pageParameters,
> null);
> }
> else if (info.getComponentInfo() != null)
> {
> // with both page instance and
> component+listener this is a listener
> interface URL
> return processListener(info, pageClass,
> pageParameters);
> }
> else if (info.getPageInfo().getPageId() == null)
> {
> return processBookmarkable(pageClass,
> pageParameters, redirectPolicy);
> }
>
> }
> return null;
> } catch (MapperRedirectException e) {
> log.debug("Redirecting '{}' to canonical page: {}",
> request.getUrl(),
> e.getPageProvider());
> //  return new RedirectRequestHandler(redirectUrl,
> 301);
> return new RenderPageRequestHandler(e.getPageProvider(),
> RedirectPolicy.ALWAYS_REDIRECT);
> }
> }
>
> What it does is allow freeform root URI paths, e.g.
> http://www.tuneeca.com/t-1113012 instead of the longer
> http://www.tuneeca.com/product/t-1113012 .
>
> Now, requests to http://www.tuneeca.com/product/t-1113012 are also handled
> by the same RequestMapper and will be redirected to
> http://www.tuneeca.com/t-1113012 .
>
> However, currently it's using 302 temporary redirect. How to make it use
> 301
> permanent redirect?
>
> Thank you.
>
> Hendy
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-instruct-RenderPageRequestHandler-to-redirect-using-301-Permanent-tp4668716.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


How to instruct RenderPageRequestHandler to redirect using 301 Permanent

2014-12-10 Thread Hendy Irawan
I currently have a custom SEO-friendly RequestMapper with the following
snippet:

@Override
public final IRequestHandler mapRequest(Request request) {
try {
final String userAgent = ((HttpServletRequest)
request.getContainerRequest()).getHeader("User-Agent");
final RedirectPolicy redirectPolicy = userAgent != null &&
BotUtils.isBot(userAgent) ? RedirectPolicy.NEVER_REDIRECT :
RedirectPolicy.AUTO_REDIRECT;

final UrlInfo urlInfo = parseRequest(request);

// check if the URL is long enough and starts with the proper 
segments
if (urlInfo != null)
{
PageComponentInfo info = urlInfo.getPageComponentInfo();
Class pageClass = 
urlInfo.getPageClass();
PageParameters pageParameters = 
urlInfo.getPageParameters();

if (info == null)
{
// if there are is no page instance information
// then this is a simple bookmarkable URL
return processBookmarkable(pageClass, 
pageParameters, redirectPolicy);
}
else if (info.getPageInfo().getPageId() != null &&
info.getComponentInfo() == null)
{
// if there is page instance information in the 
URL but no component and
listener
// interface then this is a hybrid URL - we 
need to try to reuse
existing page
// instance
return processHybrid(info.getPageInfo(), 
pageClass, pageParameters,
null);
}
else if (info.getComponentInfo() != null)
{
// with both page instance and 
component+listener this is a listener
interface URL
return processListener(info, pageClass, 
pageParameters);
}
else if (info.getPageInfo().getPageId() == null)
{
return processBookmarkable(pageClass, 
pageParameters, redirectPolicy);
}

}
return null;
} catch (MapperRedirectException e) {
log.debug("Redirecting '{}' to canonical page: {}", 
request.getUrl(),
e.getPageProvider());
//  return new RedirectRequestHandler(redirectUrl, 301);
return new RenderPageRequestHandler(e.getPageProvider(),
RedirectPolicy.ALWAYS_REDIRECT);
}
}

What it does is allow freeform root URI paths, e.g.
http://www.tuneeca.com/t-1113012 instead of the longer
http://www.tuneeca.com/product/t-1113012 .

Now, requests to http://www.tuneeca.com/product/t-1113012 are also handled
by the same RequestMapper and will be redirected to
http://www.tuneeca.com/t-1113012 .

However, currently it's using 302 temporary redirect. How to make it use 301
permanent redirect?

Thank you.

Hendy


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-instruct-RenderPageRequestHandler-to-redirect-using-301-Permanent-tp4668716.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket 7 Websocket Gradle or Maven file with Jetty 9.3?

2014-12-10 Thread Adam Hammer
Neither of those break, at the WebSocket parts.

It's embedded jetty 9.3

  server = new Server(Simple.getPort());
WebAppContext bb = new WebAppContext();
bb.setServer(server);
bb.setContextPath("/");
bb.setWar("src/main/webapp");


// START JMX SERVER
// MBeanServer mBeanServer =
ManagementFactory.getPlatformMBeanServer();
// MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
// server.getContainer().addEventListener(mBeanContainer);
// mBeanContainer.start();

server.setHandler(bb);

try {
ServerContainer wscontainer =
WebSocketServerContainerInitializer.configureContext(bb);
wscontainer.addEndpoint(EventSocket.class);
server.start();
} catch (Exception e) {
System.out.println(Simple.getPort());
e.printStackTrace();
System.exit(1);
}

I put the EventSocket.class in my code to listen to callbacks on Jetty's
side, nothing is triggered in it either.

Thanks for any help,
   Adam

On Wed, Dec 10, 2014 at 1:17 AM, Martin Grigorov 
wrote:

> Hi,
>
> The dependencies look good.
> The ws:/ url also looks good.
> It seems the Endpoint is not registered though.
> How do you start the application ? Do you deploy in standalone Jetty or do
> you use embedded Jetty ?
> Put a breakpoint
> at org.apache.wicket.protocol.ws.javax.WicketEndpoint#onOpen() and
> at
> org.apache.wicket.protocol.ws.javax.WicketServerApplicationConfig#getEndpointConfigs().
> Is any of them called ?
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Wed, Dec 10, 2014 at 11:01 AM, Adam Hammer 
> wrote:
>
> > Hi Wicket Group Members.
> >
> > Anyone have this, I can't seem to get websocket to connect
> Wicket7.0.0m4, I
> > suspect my problem is something with dependencies with jetty 9.3+?
> >
> > The behavior is injected properly, however in the Javascript console in
> the
> > client I have the following.
> >
> > Firefox can't establish a connection to the server at
> >
> >
> ws://localhost:8080/wicket/websocket?pageId=0&wicket-ajax-baseurl=%3F0&wicket-app-name=simple.
> >
> > My build.gradle dependencies
> >
> > --- Begin Build.gradle dependencies
> > dependencies {
> > compile 'org.apache.wicket:wicket-core:7.+'
> > compile 'org.apache.wicket:wicket-extensions:7.+'
> > compile 'org.apache.wicket:wicket-native-websocket-core:7.+'
> > compile 'org.eclipse.jetty.aggregate:jetty-all:9.+'
> > compile 'org.apache.wicket:wicket-native-websocket-javax:7.+'
> > compile 'javax.websocket:javax.websocket-api:1.1'
> > compile  'org.reflections:reflections-maven:0.9.9-RC1'
> > compile 'org.apache.httpcomponents:httpclient:4.+'
> > compile 'org.apache.commons:commons-exec:1.3'
> > compile  'org.apache.commons:commons-io:1.+'
> > compile  'org.apache.velocity:velocity:1.+'
> > compile  'com.google.inject:guice:3.+'
> > compile  'com.google.guava:guava:+'
> > compile  'com.google.code.gson:gson:+'
> > compile  'org.hibernate:hibernate-core:3.+'
> > compile  'org.hibernate:hibernate-entitymanager:3.+'
> > compile  'com.h2database:h2:1.+'
> > compile  'com.googlecode.juniversalchardet:juniversalchardet:1.+'
> > compile  'org.mockito:mockito-core:1.+'
> > compile  'org.slf4j:slf4j-log4j12:1.+'
> > compile 'log4j:log4j:1.+'
> > compile 'net.lingala.zip4j:zip4j:1.+'
> > compile 'net.glxn:qrgen:+'
> > compile 'org.bitcoinj:bitcoinj-core:+'
> > compile 'commons-io:commons-io:2.4'
> > compile 'commons-daemon:commons-daemon:1.0.15'
> > compile 'javax.mail:mail:1.4.1'
> >
> > testCompile 'junit:junit:4.10'
> > }
> > --- Web.xml filter
> >
> > simple
> >
> >
> >
> org.apache.wicket.protocol.ws.javax.JavaxWebSocketFilter
> > 
> > applicationClassName
> > com.metalrain.simple.SimpleImpl
> > 
> > 
> >
> > 
> > simple
> > /*
> > 
> >
> >  Java Code (Just a websocket behavior, with breakpoints all around,
> > they don't trigger)
> >  add(new WebSocketBehavior() {
> > @Override
> > public void onEvent(Component component, IEvent event) {
> > super.onEvent(component, event);
> > }
> >
> > @Override
> > protected void onConnect(ConnectedMessage message) {
> > super.onConnect(message);
> > }
> >
> > @Override
> > protected void onPush(WebSocketRequestHandler handler,
> > IWebSocketPushMessage message) {
> > super.onPush(handler, message);
> > }
> >
> > @Override
> > protected void onClose(ClosedMessage message) {
> > super.onClose(message);
> > }
> >
> > @Override
> > protected void onMessage(WebSocketRequestHandler handler

Re: How to call onResourceRequested for page behavior in ajax update (Atmosphere related)

2014-12-10 Thread Daniel Stoch
Hi,

It seems that I am using an older version of AtmosphereBehavior which
implements IResourceListener. Since 6.17.0 this implementation was
removed and the code is moved to onRequest() method.
So I must check a newer version, maybe my problem is solved.

Thanks for a tip!

--
Daniel

On Wed, Dec 10, 2014 at 11:03 AM, Martin Grigorov  wrote:
> Hi,
>
> Please give more details.
> https://github.com/apache/wicket/blob/master/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereBehavior.java#L51
> doesn't implement IResourceListener, so it seems you do something custom.
>
> Just implementing IResourceListener doesn't mean anything to Wicket.
> You need to create a callback url with
> org.apache.wicket.Component#urlFor(org.apache.wicket.RequestListenerInterface,
> org.apache.wicket.request.mapper.parameter.PageParameters) and use it
> somehow to invoke org.apache.wicket.IResourceListener#onResourceRequested
>
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Wed, Dec 10, 2014 at 11:45 AM, Daniel Stoch 
> wrote:
>
>> Is it possible to invoke this listener manually, or maybe this is a
>> generally a bad practise?
>>
>> --
>> Daniel
>>
>> > On 9 gru 2014, at 12:24, Daniel Stoch  wrote:
>> >
>> > Hi,
>> >
>> > I have a behavior which implements IResourceListener
>> > (AtmosphereBehavior). The problem is when this behavior is added to
>> > page during ajax request (eg. some panel is dynamically added to page)
>> > - then onResourceRequested is not invoked for page. So when using
>> > AtmosphereBehavior the suspended connection from the client is not
>> > registered.
>> >
>> > How should I solve this problem: how and when call this
>> > onResourceRequested method?
>> >
>> > --
>> > Best regards,
>> > Daniel
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>

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



AutoCompleteTextField with position: fixed

2014-12-10 Thread pureza
Hi,

I need to have an AutoCompleteTextField with position: fixed, because it
sits inside a fixed Modal. However, Wicket calculates the position
coordinates based on the top of the document and not the top of the screen,
so the dropdown doesn't show up in the right place when there is a
scrollbar.

To fix this, I tried to add custom JavaScript code to the
AutoCompleteBehavior, by overriding updateAjaxAttributes and adding my own
AjaxCallListener. However, this didn't work because AutoCompleteBehavior
seems to ignore any AjaxCallListener, as reported here:
http://mail-archives.apache.org/mod_mbox/wicket-users/201301.mbox/%3c1358755750041-4655560.p...@n4.nabble.com%3E.

Could you tell me what's the best way of achieving this?

Thank you,

Luis Pureza

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AutoCompleteTextField-with-position-fixed-tp4668713.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Stateless login page with auth-roles

2014-12-10 Thread ChambreNoire
Yes I thought of that but it doesn't redirect to the loginpage (and results
in WicketRuntimeExceptions - Error attaching this container for rendering -
possibly because of a resulting page missmatch). I'm obviously missing
something...

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Stateless-login-page-with-auth-roles-tp4668706p4668712.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: How to call onResourceRequested for page behavior in ajax update (Atmosphere related)

2014-12-10 Thread Martin Grigorov
Hi,

Please give more details.
https://github.com/apache/wicket/blob/master/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereBehavior.java#L51
doesn't implement IResourceListener, so it seems you do something custom.

Just implementing IResourceListener doesn't mean anything to Wicket.
You need to create a callback url with
org.apache.wicket.Component#urlFor(org.apache.wicket.RequestListenerInterface,
org.apache.wicket.request.mapper.parameter.PageParameters) and use it
somehow to invoke org.apache.wicket.IResourceListener#onResourceRequested


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Dec 10, 2014 at 11:45 AM, Daniel Stoch 
wrote:

> Is it possible to invoke this listener manually, or maybe this is a
> generally a bad practise?
>
> --
> Daniel
>
> > On 9 gru 2014, at 12:24, Daniel Stoch  wrote:
> >
> > Hi,
> >
> > I have a behavior which implements IResourceListener
> > (AtmosphereBehavior). The problem is when this behavior is added to
> > page during ajax request (eg. some panel is dynamically added to page)
> > - then onResourceRequested is not invoked for page. So when using
> > AtmosphereBehavior the suspended connection from the client is not
> > registered.
> >
> > How should I solve this problem: how and when call this
> > onResourceRequested method?
> >
> > --
> > Best regards,
> > Daniel
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Stateless login page with auth-roles

2014-12-10 Thread Martin Grigorov
OK.

Then instead of using restartResponseAtSignInPage() just do:
setResponsePage(getSignInPage())

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Dec 10, 2014 at 11:46 AM, ChambreNoire  wrote:

> No, not directly, but it leads to the set() method of
> RestartResponseAtInterceptPageException's inner InterceptData class which
> calls bind();
>
>
> https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/RestartResponseAtInterceptPageException.java#L141
>
> CN
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Stateless-login-page-with-auth-roles-tp4668706p4668709.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Stateless login page with auth-roles

2014-12-10 Thread ChambreNoire
No, not directly, but it leads to the set() method of
RestartResponseAtInterceptPageException's inner InterceptData class which
calls bind();

https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/RestartResponseAtInterceptPageException.java#L141

CN

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Stateless-login-page-with-auth-roles-tp4668706p4668709.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: How to call onResourceRequested for page behavior in ajax update (Atmosphere related)

2014-12-10 Thread Daniel Stoch
Is it possible to invoke this listener manually, or maybe this is a generally a 
bad practise?

--
Daniel

> On 9 gru 2014, at 12:24, Daniel Stoch  wrote:
> 
> Hi,
> 
> I have a behavior which implements IResourceListener
> (AtmosphereBehavior). The problem is when this behavior is added to
> page during ajax request (eg. some panel is dynamically added to page)
> - then onResourceRequested is not invoked for page. So when using
> AtmosphereBehavior the suspended connection from the client is not
> registered.
> 
> How should I solve this problem: how and when call this
> onResourceRequested method?
> 
> --
> Best regards,
> Daniel

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



Re: Stateless login page with auth-roles

2014-12-10 Thread Martin Grigorov
Hi,

https://github.com/apache/wicket/blob/master/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebApplication.java#L101
There is no code that binds the session.


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Dec 10, 2014 at 11:22 AM, ChambreNoire  wrote:

> Hi,
>
> I've followed the Wicket guide's chapter on security in order to implement
> authorization. Amongst other bits it advises using the following code in
> the
> AuthenticatedPage :
>
> @Override
> protected void onConfigure() {
> super.onConfigure();
>
> AuthenticatedWebApplication app =
> (AuthenticatedWebApplication)Application.get();
> //if user is not signed in, redirect him to sign in page
> if(!AuthenticatedWebSession.get().isSignedIn())
> app.restartResponseAtSignInPage();
> }
>
> The problem is that restartResponseAtSignInPage() binds a new session so I
> end up with a session despite redirecting to the stateless login page.
>
> Any ideas?
>
> CN
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Stateless-login-page-with-auth-roles-tp4668706.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Stateless login page with auth-roles

2014-12-10 Thread ChambreNoire
Hi,

I've followed the Wicket guide's chapter on security in order to implement
authorization. Amongst other bits it advises using the following code in the
AuthenticatedPage :

@Override
protected void onConfigure() {
super.onConfigure();

AuthenticatedWebApplication app =
(AuthenticatedWebApplication)Application.get();
//if user is not signed in, redirect him to sign in page
if(!AuthenticatedWebSession.get().isSignedIn())
app.restartResponseAtSignInPage();
}

The problem is that restartResponseAtSignInPage() binds a new session so I
end up with a session despite redirecting to the stateless login page.

Any ideas?

CN

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Stateless-login-page-with-auth-roles-tp4668706.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Using 6.X snapshots

2014-12-10 Thread ChambreNoire
Nevermind. It was a combination of the update not going through due to
problems with my VPN setup and the small fact that the version should have
been 6.19.0-SNAPSHOT and not 6.19-SNAPSHOT.

CN

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Using-6-X-snapshots-tp4668702p4668705.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket 7 Websocket Gradle or Maven file with Jetty 9.3?

2014-12-10 Thread Martin Grigorov
Hi,

The dependencies look good.
The ws:/ url also looks good.
It seems the Endpoint is not registered though.
How do you start the application ? Do you deploy in standalone Jetty or do
you use embedded Jetty ?
Put a breakpoint
at org.apache.wicket.protocol.ws.javax.WicketEndpoint#onOpen() and
at 
org.apache.wicket.protocol.ws.javax.WicketServerApplicationConfig#getEndpointConfigs().
Is any of them called ?

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Dec 10, 2014 at 11:01 AM, Adam Hammer  wrote:

> Hi Wicket Group Members.
>
> Anyone have this, I can't seem to get websocket to connect Wicket7.0.0m4, I
> suspect my problem is something with dependencies with jetty 9.3+?
>
> The behavior is injected properly, however in the Javascript console in the
> client I have the following.
>
> Firefox can't establish a connection to the server at
>
> ws://localhost:8080/wicket/websocket?pageId=0&wicket-ajax-baseurl=%3F0&wicket-app-name=simple.
>
> My build.gradle dependencies
>
> --- Begin Build.gradle dependencies
> dependencies {
> compile 'org.apache.wicket:wicket-core:7.+'
> compile 'org.apache.wicket:wicket-extensions:7.+'
> compile 'org.apache.wicket:wicket-native-websocket-core:7.+'
> compile 'org.eclipse.jetty.aggregate:jetty-all:9.+'
> compile 'org.apache.wicket:wicket-native-websocket-javax:7.+'
> compile 'javax.websocket:javax.websocket-api:1.1'
> compile  'org.reflections:reflections-maven:0.9.9-RC1'
> compile 'org.apache.httpcomponents:httpclient:4.+'
> compile 'org.apache.commons:commons-exec:1.3'
> compile  'org.apache.commons:commons-io:1.+'
> compile  'org.apache.velocity:velocity:1.+'
> compile  'com.google.inject:guice:3.+'
> compile  'com.google.guava:guava:+'
> compile  'com.google.code.gson:gson:+'
> compile  'org.hibernate:hibernate-core:3.+'
> compile  'org.hibernate:hibernate-entitymanager:3.+'
> compile  'com.h2database:h2:1.+'
> compile  'com.googlecode.juniversalchardet:juniversalchardet:1.+'
> compile  'org.mockito:mockito-core:1.+'
> compile  'org.slf4j:slf4j-log4j12:1.+'
> compile 'log4j:log4j:1.+'
> compile 'net.lingala.zip4j:zip4j:1.+'
> compile 'net.glxn:qrgen:+'
> compile 'org.bitcoinj:bitcoinj-core:+'
> compile 'commons-io:commons-io:2.4'
> compile 'commons-daemon:commons-daemon:1.0.15'
> compile 'javax.mail:mail:1.4.1'
>
> testCompile 'junit:junit:4.10'
> }
> --- Web.xml filter
>
> simple
>
>
> org.apache.wicket.protocol.ws.javax.JavaxWebSocketFilter
> 
> applicationClassName
> com.metalrain.simple.SimpleImpl
> 
> 
>
> 
> simple
> /*
> 
>
>  Java Code (Just a websocket behavior, with breakpoints all around,
> they don't trigger)
>  add(new WebSocketBehavior() {
> @Override
> public void onEvent(Component component, IEvent event) {
> super.onEvent(component, event);
> }
>
> @Override
> protected void onConnect(ConnectedMessage message) {
> super.onConnect(message);
> }
>
> @Override
> protected void onPush(WebSocketRequestHandler handler,
> IWebSocketPushMessage message) {
> super.onPush(handler, message);
> }
>
> @Override
> protected void onClose(ClosedMessage message) {
> super.onClose(message);
> }
>
> @Override
> protected void onMessage(WebSocketRequestHandler handler,
> TextMessage message) {
> super.onMessage(handler, message);
> }
>
> @Override
> protected void onMessage(WebSocketRequestHandler handler,
> BinaryMessage binaryMessage) {
> super.onMessage(handler, binaryMessage);
> }
> });
>  End Java
>
>
> Thanks in advance,
>Adam Hammer
>


Wicket 7 Websocket Gradle or Maven file with Jetty 9.3?

2014-12-10 Thread Adam Hammer
Hi Wicket Group Members.

Anyone have this, I can't seem to get websocket to connect Wicket7.0.0m4, I
suspect my problem is something with dependencies with jetty 9.3+?

The behavior is injected properly, however in the Javascript console in the
client I have the following.

Firefox can't establish a connection to the server at
ws://localhost:8080/wicket/websocket?pageId=0&wicket-ajax-baseurl=%3F0&wicket-app-name=simple.

My build.gradle dependencies

--- Begin Build.gradle dependencies
dependencies {
compile 'org.apache.wicket:wicket-core:7.+'
compile 'org.apache.wicket:wicket-extensions:7.+'
compile 'org.apache.wicket:wicket-native-websocket-core:7.+'
compile 'org.eclipse.jetty.aggregate:jetty-all:9.+'
compile 'org.apache.wicket:wicket-native-websocket-javax:7.+'
compile 'javax.websocket:javax.websocket-api:1.1'
compile  'org.reflections:reflections-maven:0.9.9-RC1'
compile 'org.apache.httpcomponents:httpclient:4.+'
compile 'org.apache.commons:commons-exec:1.3'
compile  'org.apache.commons:commons-io:1.+'
compile  'org.apache.velocity:velocity:1.+'
compile  'com.google.inject:guice:3.+'
compile  'com.google.guava:guava:+'
compile  'com.google.code.gson:gson:+'
compile  'org.hibernate:hibernate-core:3.+'
compile  'org.hibernate:hibernate-entitymanager:3.+'
compile  'com.h2database:h2:1.+'
compile  'com.googlecode.juniversalchardet:juniversalchardet:1.+'
compile  'org.mockito:mockito-core:1.+'
compile  'org.slf4j:slf4j-log4j12:1.+'
compile 'log4j:log4j:1.+'
compile 'net.lingala.zip4j:zip4j:1.+'
compile 'net.glxn:qrgen:+'
compile 'org.bitcoinj:bitcoinj-core:+'
compile 'commons-io:commons-io:2.4'
compile 'commons-daemon:commons-daemon:1.0.15'
compile 'javax.mail:mail:1.4.1'

testCompile 'junit:junit:4.10'
}
--- Web.xml filter
   
simple

org.apache.wicket.protocol.ws.javax.JavaxWebSocketFilter

applicationClassName
com.metalrain.simple.SimpleImpl




simple
/*


 Java Code (Just a websocket behavior, with breakpoints all around,
they don't trigger)
 add(new WebSocketBehavior() {
@Override
public void onEvent(Component component, IEvent event) {
super.onEvent(component, event);
}

@Override
protected void onConnect(ConnectedMessage message) {
super.onConnect(message);
}

@Override
protected void onPush(WebSocketRequestHandler handler,
IWebSocketPushMessage message) {
super.onPush(handler, message);
}

@Override
protected void onClose(ClosedMessage message) {
super.onClose(message);
}

@Override
protected void onMessage(WebSocketRequestHandler handler,
TextMessage message) {
super.onMessage(handler, message);
}

@Override
protected void onMessage(WebSocketRequestHandler handler,
BinaryMessage binaryMessage) {
super.onMessage(handler, binaryMessage);
}
});
 End Java


Thanks in advance,
   Adam Hammer