How to parse URL-strings based on some template for contained parameters?

2020-05-27 Thread Thorsten Schöning
Hi all,

I'm using Wicket as some template engine to generate reports about
tabular data as HTML-documents in a backend published using SOAP. The
called SOAP-interfaces expect what to generate pretty much as some
path/URL-like resource description:

> alert/topic1/foo/bar
> report/topic1/foo/bar
> report/topic2/bar/foo

I would like to have some parser for those kinds of paths/URLs, so
that I'm able to provide some template-paths and get some results by
name.

> ${type}/${topic}/foo/${fooVal}

Is something like that available in Wicket already?

Looking at "PageParameters", Wicket does only support query strings
and indexed parameters, so no support for templates like the above.
Indexed parameters don't seem too different, though. Additionally,
"PagerParameters" doesn't seem to support parsing itself.

So how can I parse a string only and get "PageParameters"?

I've found "UrlRequestParametersAdapter" and
"UrlPathPageParametersEncoder", the latter supports decoding paths
like "/key1/value/key2/value" etc. And both don't seem to be bound to
an application or HTTP, which would exactly be what I need.

Anything else to look at? Thanks!

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning   E-Mail: thorsten.schoen...@am-soft.de
AM-SoFT IT-Systeme  http://www.AM-SoFT.de/

Telefon...05151-  9468- 55
Fax...05151-  9468- 88
Mobil..0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


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



Re: How to parse URL-strings based on some template for contained parameters?

2020-05-27 Thread Ernesto Reinaldo Barreiro
Hi,

\
> I'm using Wicket as some template engine to generate reports about
> tabular data as HTML-documents in a backend published using SOAP. The
> called SOAP-interfaces expect what to generate pretty much as some
> path/URL-like resource description:
>
> > alert/topic1/foo/bar
> > report/topic1/foo/bar
> > report/topic2/bar/foo
>
> I would like to have some parser for those kinds of paths/URLs, so
> that I'm able to provide some template-paths and get some results by
> name.
>
> > ${type}/${topic}/foo/${fooVal}
>
>
You can count a resource using exactly like that

https://ci.apache.org/projects/wicket/guide/6.x/guide/resources.html#resources_11
https://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/




> Is something like that available in Wicket already?
>
> Looking at "PageParameters", Wicket does only support query strings
> and indexed parameters, so no support for templates like the above.
> Indexed parameters don't seem too different, though. Additionally,
> "PagerParameters" doesn't seem to support parsing itself.
>
> So how can I parse a string only and get "PageParameters"?
>
> I've found "UrlRequestParametersAdapter" and
> "UrlPathPageParametersEncoder", the latter supports decoding paths
> like "/key1/value/key2/value" etc. And both don't seem to be bound to
> an application or HTTP, which would exactly be what I need.
>
> Anything else to look at? Thanks!
>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning
>
> --
> Thorsten Schöning   E-Mail: thorsten.schoen...@am-soft.de
> AM-SoFT IT-Systeme  http://www.AM-SoFT.de/
>
> Telefon...05151-  9468- 55
> Fax...05151-  9468- 88
> Mobil..0178-8 9468- 04
>
> AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
> AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

-- 
Regards - Ernesto Reinaldo Barreiro


Re: WebSocket concurrent modification

2020-05-27 Thread fanfy
Hello,I finally found the problem ... It seems that I didn't understood very
well how to use WebSocketMessageBroadcaster from wicket-spring-boot. The
proper way to broadcast websocket messages from an ajax call is to use
org.apache.wicket.protocol.ws.api.WebSocketPushBroadcaster with an
additional configuration of the Executor that must broadcast the messages
using a separate threadFor example, if using springframework (with wicket
application as a bean) you must configure the executor:
java.util.concurrent.Executor executor =
Executors.newSingleThreadExecutor();
WebSocketSettings.Holder.get(webApplication).setWebSocketPushMessageExecutor(new
Executor() {@Override   
public void run(Runnable command) { 
executor.execute(command);  }   });
To broadcast messages from business code you can use spring events
(published from your business code) To broadcast from ajax handlers inject
this bean and call broadcastToAll(event) directly. 
/** *  * @author Elvis Ciocoiu * */@Componentpublic class
TaskEventWebSocketBroadcaster { private WebSocketPushBroadcaster
broadcaster;@Autowired private Application application; 
@PostConstruct
public void init() {WebSocketSettings webSocketSettings =
WebSocketSettings.Holder.get(application);  
IWebSocketConnectionRegistry
webSocketConnectionRegistry = webSocketSettings.getConnectionRegistry();
broadcaster = new WebSocketPushBroadcaster(webSocketConnectionRegistry);
}   
@EventListener  public void onTaskEvent(TaskEvent taskEvent) {  
broadcastToAll(taskEvent);  }   public void 
broadcastToAll(TaskEvent
taskEvent) {broadcaster.broadcastAll(application, new
TaskEventWebSocketPushMessage(taskEvent));  }   /**  *  
 * @author Elvis
Ciocoiu  *   */ public static class TaskEventWebSocketPushMessage 
implements
IWebSocketPushMessage { private static final long serialVersionUID = 
1L;
private TaskEvent taskEvent;public
TaskEventWebSocketPushMessage(TaskEvent taskEvent) {
this.taskEvent =
taskEvent;  }   public TaskEvent 
getTaskEvent() {   return taskEvent;   }   
}}
I think these distinct scenarios (broadcast from ajaxhandler and from
business thread) should be documented a little more in user guide. Sorry to
waste your time.Thank you

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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