How to delete version number in url for Wicket version 6.13.0 and newer ones? - wicket-6

The accepted solution given by
delete version number in url
causes problems to AJAX for Wicket version 6.13.0 and newer ones. It keeps reloading the whole page endlessly.
-----Updated-----
Later I found out the following solution worked for me (wicket version 6.15.0) by setting the ONE_PASS_RENDER rendering strategy:
class MyApplication extends WebApplication {
#Override protected void init() {
getRequestCycleSettings().setRenderStrategy(
IRequestCycleSettings.RenderStrategy.ONE_PASS_RENDER);
}
}
It is suggested by https://stackoverflow.com/a/12422490/2700356

For Wicket 7 use this code:
getRequestCycleSettings().setRenderStrategy(RequestCycleSettings.RenderStrategy.ONE_PASS_RENDER);

Related

cefsharp - "Links that open a specific application" seem to be not working

I just begin with Cefsharp on C#.
Everything works fine except Cefsharp can not execute some special links that open/run a specific application on the computer.
The link still works on other Chromium official browsers (Google Chrome), I clicked the link and it launches the application. Cefshap is not, it does nothing when I clicked the link.
The link looks something like this: "runapp://api.abcxyz/..."
How can I make it work on Cefsharp?
image show that the link works on other chromium browsers
Firstly for security reasons loading of external protocols is disabled by default. Historically you would have implemented OnProtocolExecution.
There is currently an upstream bug in OnProtocolExecution see https://bitbucket.org/chromiumembedded/cef/issues/2715/onprotocolexecution-page-goes-blank-after
You can implement a workaround using RequestHandler.OnBeforeBrowser and calling Process.Start
It would look roughly something like the following (Written in Notepad++ very quickly, there maybe minor mistakes that you'd have to correct).
public class ExampleRequestHandler : RequestHandler
{
protected override bool OnBeforeBrowse(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IRequest request, bool userGesture, bool isRedirect)
{
if(request.Url.StartsWith("mailto:"))
{
System.Diagnostics.Process.Start(request.Url);
//Cancel navigation
return true;
}
return false;
}
}
browser.RequestHandler = new ExampleRequestHandler();

Remove cache created with <cache> tag helper

I have used <cache> tag helper in my Asp.Net Core 3.1 website to cache some parts of the page. However, in some situations I want to clear these cache entries and make the website re-create those. How can I achieve that? I tried the code mentioned in this answer but couldn't get it to work. When I register the service the application seems to ignore it and no entries get cached in my custom service.
Here is a way to do it:
private readonly CacheTagHelperMemoryCacheFactory factory;
public MyClass(CacheTagHelperMemoryCacheFactory factory)
{
this.factory = factory;
}
and later
(this.factory.Cache as MemoryCache).Compact(1.0);

JXBrowser control over dialog website not responding

Hey im having issues with a website in the jxbrowser. it seems like it is running into a timeout or whatever and then in the jxbrowser there is a dialog showing up "website not responding" and i can click on "reload" or "leave".
Can I in any way access this dialog and overwrite it? For instance everytime i would get this dont ask but go to the homepage instead?
I'm having trouble finding this if it is even possible.
I found a solution. JXBrowser has a RenderAdapter where a function exists onRenderUnresponsive wich can be overridden. Look at this: https://jxbrowser.support.teamdev.com/support/solutions/articles/9000091687-detecting-unresponsive-web-page
In my case I simply want to reload the website:
Browser browser = new Browser();
browser.addRenderListener(new RenderAdapter() {
#Override
public void onRenderUnresponsive(RenderEvent event) {
browser.reloadIgnoringCache(false);
}
});

Avoid back button using vaadin

I develop RIA application using Vaadin CDI addon.
About the app : it has two views(viewA and viewB) which maintained by Navigator.
User story is pretty simple:
User enters viewA
Perform some business stuff
Redirects to viewB
Using address bar to go some external website(ex. google.com)
Press back and it goes to he lastest page what he saw(viewB), instead of viewA
Any suggestions/tips-n-tricks how to avoid redirecting to viewB, but redirect to viewA?
Vaadin Forum quiet about this thing.
Thank you
I had same problem but resolved using following code:
getUI().getNavigator().addViewChangeListener(new ViewChangeListener() {
public boolean beforeViewChange(ViewChangeEvent event) {
return changeView;
}
#Override
public void afterViewChange(ViewChangeEvent event) {
// TODO Auto-generated method stub
}});
Set changeView = true only through proper navigation's (eg: On button clicks).
This how you can avoid navigation's using browser back button. In this case if user uses any of browser buttons the view does not changes and it remains on same page.
You could override View.enter(...) in your ViewB, and, according to your application state, update your view URI using Page.getCurrent().setUriFragment(recentUrl, false);

UnsatisfiedLinkError when acccessing the google calender in GWT

I am getting "UnsatisfiedLinkError: com.google.gwt.gdata.client.GData.isLoaded()" when using the gwt gdata library..
final String GDATA_API_KEY = "ABQIAAAABGWvCfqj7y33zGBuY57s7EfWCbD5ZXtDEt-shSPCo3EL0Dtuj-0TG3CmT93zHHI9Q";
if (!GData.isLoaded(GDataSystemPackage.CALENDAR)) {
GData.loadGDataApi(GDATA_API_KEY, new Runnable() {
public void run() {
authenticate();
}
}, GDataSystemPackage.CALENDAR);
} else {
authenticate(); // Load application
}
}
Any help?
UnsatisfiedLinkError is a Java error that often happens if code is not available that should be - it can't happen in compiled GWT code as far as I know, since all code has to be linked at compiletime, not runtime. Are you sure you are calling that client code on a client, and not from some server code?
To clarify why this might be happening: GWT allows interaction with native JavaScript by JSNI methods - those methods look to a normal JVM like native calls, implemented with some native library, while they have a javascript impl that is used in the browser. If you try to run that code outside of a browser, there will be no way to run that JS.

Resources