This is my html page:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns:wicket="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Apache Wicket HelloWorld</title>
</head>
<body>
<a href="#" wicket:id="counter-link"></a><label wicket:id="counter-label"></label>
</body>
</html>
And this is its corresponding Java class:
public class MyCounter extends WebPage {
public MyCounter() {
add(new Link<Void>("counter-link") {
@Override
public void onClick() {
//link code goes here
}
});
add(new Label("counter-label", "Was clicked 0 times"));
}
}
Here if I try to set Link in, and then call the page it just returns 404 and the logs don't show any errors:
15:29:48.551 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.552 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.553 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.553 [http-nio-8080-exec-15] DEBUG org.apache.wicket.request.mapper.CompoundRequestMapper -- No compatible mapper found for URL ''
15:29:48.553 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.554 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.554 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.554 [http-nio-8080-exec-15] DEBUG org.apache.wicket.MarkupContainer -- Add counter-link to [Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 2, render count = 0]
15:29:48.555 [http-nio-8080-exec-15] DEBUG org.apache.wicket.MarkupContainer -- Add counter-label to [Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 2, render count = 0]
15:29:48.555 [http-nio-8080-exec-15] DEBUG org.apache.wicket.MarkupContainer -- Add _header_ to [Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 2, render count = 0]
15:29:48.555 [http-nio-8080-exec-15] DEBUG org.apache.wicket.page.DefaultPageLockManager -- 'http-nio-8080-exec-15' attempting to acquire lock to page with id '2'
15:29:48.555 [http-nio-8080-exec-15] DEBUG org.apache.wicket.page.DefaultPageLockManager -- http-nio-8080-exec-15 acquired lock to page 2
15:29:48.555 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Page -- Page '[Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 2, render count = 0]' is not stateless because of component with path 'counter-link'.
15:29:48.555 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Component -- Begin render [Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 2, render count = 1]
15:29:48.555 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Component -- Begin render [HtmlHeaderContainer [Component id = _header_]]
15:29:48.556 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Component -- internalRenderHead: [Link [Component id = counter-link]]
15:29:48.557 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Page -- Page '[Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 2, render count = 1]' is not stateless because of component with path 'counter-link'.
15:29:48.557 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.557 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.557 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.557 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.557 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Component -- internalRenderHead: [Component id = counter-label]
15:29:48.557 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Component -- internalRenderHead: [HtmlHeaderContainer [Component id = _header_]]
15:29:48.557 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Component -- internalRenderHead: [MyCounter [Component id = 2]]
15:29:48.558 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Page -- Rendered [HtmlHeaderContainer [Component id = _header_]]
15:29:48.558 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Component -- End render [HtmlHeaderContainer [Component id = _header_]]
15:29:48.558 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Component -- Begin render [Link [Component id = counter-link]]
15:29:48.558 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.558 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.559 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.559 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.559 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Page -- Rendered [Link [Component id = counter-link]]
15:29:48.559 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Component -- End render [Link [Component id = counter-link]]
15:29:48.559 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Component -- Begin render [Component id = counter-label]
15:29:48.559 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Page -- Rendered [Component id = counter-label]
15:29:48.559 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Component -- End render [Component id = counter-label]
15:29:48.559 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Page -- Rendered [Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 2, render count = 1]
15:29:48.559 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Component -- End render [Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 2, render count = 1]
15:29:48.559 [http-nio-8080-exec-15] DEBUG org.apache.wicket.page.DefaultPageLockManager -- 'http-nio-8080-exec-15' attempting to acquire lock to page with id '2'
15:29:48.559 [http-nio-8080-exec-15] DEBUG org.apache.wicket.page.DefaultPageLockManager -- http-nio-8080-exec-15 acquired lock to page 2
15:29:48.559 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.560 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.560 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.560 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.560 [http-nio-8080-exec-15] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:29:48.560 [http-nio-8080-exec-15] DEBUG org.apache.wicket.Page -- ending request for page [Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 2, render count = 1], request org.apache.wicket.protocol.http.servlet.ServletWebRequest@35792874
15:29:48.561 [Wicket-AsyncPageStore-PageSavingThread] DEBUG org.apache.wicket.pageStore.AsynchronousPageStore$PageAddingRunnable -- Saving asynchronously: PendingAdd [sessionId=EC0425FA3075CE007424F77A684F8201, pageId=2, pageClass=org.apache.wicket.pageStore.SerializedPage]...
15:29:48.561 [Wicket-AsyncPageStore-PageSavingThread] DEBUG org.apache.wicket.pageStore.DiskPageStore -- Storing data for page with id '2' in session with id 'EC0425FA3075CE007424F77A684F8201'
15:29:48.561 [http-nio-8080-exec-15] DEBUG org.apache.wicket.pageStore.AsynchronousPageStore -- Offered for storing asynchronously page with id '2'
15:29:48.562 [http-nio-8080-exec-15] DEBUG org.apache.wicket.page.DefaultPageLockManager -- 'http-nio-8080-exec-15' released lock to page with id '2'
15:29:48.562 [http-nio-8080-exec-15] DEBUG org.apache.wicket.page.PageAccessSynchronizer -- 'http-nio-8080-exec-15' notifying blocked threads
BUT if I remove the Link and set another Label instead then everything works
public class MyCounter extends WebPage {
public MyCounter() {
add(new Label("counter-link", "Some text"));
add(new Label("counter-label", "Was clicked 0 times"));
}
}
and logs look the same:
15:32:08.005 [http-nio-8080-exec-1] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:32:08.009 [http-nio-8080-exec-1] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:32:08.009 [http-nio-8080-exec-1] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:32:08.009 [http-nio-8080-exec-1] DEBUG org.apache.wicket.request.mapper.CompoundRequestMapper -- No compatible mapper found for URL ''
15:32:08.010 [http-nio-8080-exec-1] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:32:08.010 [http-nio-8080-exec-1] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:32:08.017 [http-nio-8080-exec-1] DEBUG org.apache.wicket.protocol.http.servlet.ServletWebRequest -- Calculating context relative path from: context path '/wicket_demo_war', filterPrefix 'counte/', uri '/wicket_demo_war/counter'
15:32:08.040 [http-nio-8080-exec-1] DEBUG org.apache.wicket.MarkupContainer -- Add counter-link to [Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 0, render count = 0]
15:32:08.040 [http-nio-8080-exec-1] DEBUG org.apache.wicket.MarkupContainer -- Add counter-label to [Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 0, render count = 0]
15:32:08.044 [http-nio-8080-exec-1] DEBUG org.apache.wicket.markup.MarkupCache -- Load markup: cacheKey=com.asgarov.wicket.demo.counter.MyCounter_en_US.html
15:32:08.055 [http-nio-8080-exec-1] DEBUG org.apache.wicket.core.util.resource.locator.ResourceStreamLocator -- Attempting to locate resource 'com/asgarov/wicket/demo/counter/MyCounter_en_US.html' using finder'[classpath]'
15:32:08.056 [http-nio-8080-exec-1] DEBUG org.apache.wicket.core.util.resource.locator.ResourceStreamLocator -- Attempting to locate resource 'com/asgarov/wicket/demo/counter/MyCounter_en_US.html' using finder'[webapppath: /]'
15:32:08.056 [http-nio-8080-exec-1] DEBUG org.apache.wicket.core.util.resource.locator.ResourceStreamLocator -- Attempting to locate resource 'com/asgarov/wicket/demo/counter/MyCounter_en_US.html' using finder'[classpath: META-INF/resources/]'
15:32:08.057 [http-nio-8080-exec-1] DEBUG org.apache.wicket.core.util.resource.locator.ResourceStreamLocator -- Attempting to locate resource 'com/asgarov/wicket/demo/counter/MyCounter_en.html' using finder'[classpath]'
15:32:08.057 [http-nio-8080-exec-1] DEBUG org.apache.wicket.core.util.resource.locator.ResourceStreamLocator -- Attempting to locate resource 'com/asgarov/wicket/demo/counter/MyCounter_en.html' using finder'[webapppath: /]'
15:32:08.057 [http-nio-8080-exec-1] DEBUG org.apache.wicket.core.util.resource.locator.ResourceStreamLocator -- Attempting to locate resource 'com/asgarov/wicket/demo/counter/MyCounter_en.html' using finder'[classpath: META-INF/resources/]'
15:32:08.057 [http-nio-8080-exec-1] DEBUG org.apache.wicket.core.util.resource.locator.ResourceStreamLocator -- Attempting to locate resource 'com/asgarov/wicket/demo/counter/MyCounter.html' using finder'[classpath]'
15:32:08.064 [http-nio-8080-exec-1] DEBUG org.apache.wicket.markup.MarkupCache -- Loading markup from file:/home/asgarov1/DevTools/apache-tomcat-9.0.76/webapps/wicket_demo_war/WEB-INF/classes/com/asgarov/wicket/demo/counter/MyCounter.html
15:32:08.088 [http-nio-8080-exec-1] DEBUG org.apache.wicket.MarkupContainer -- Add _header_ to [Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 0, render count = 0]
15:32:08.090 [http-nio-8080-exec-1] DEBUG org.apache.wicket.page.DefaultPageLockManager -- 'http-nio-8080-exec-1' attempting to acquire lock to page with id '0'
15:32:08.090 [http-nio-8080-exec-1] DEBUG org.apache.wicket.page.DefaultPageLockManager -- http-nio-8080-exec-1 acquired lock to page 0
15:32:08.093 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Component -- Begin render [Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 0, render count = 1]
15:32:08.094 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Component -- Begin render [HtmlHeaderContainer [Component id = _header_]]
15:32:08.097 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Component -- internalRenderHead: [Component id = counter-link]
15:32:08.097 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Component -- internalRenderHead: [Component id = counter-label]
15:32:08.097 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Component -- internalRenderHead: [HtmlHeaderContainer [Component id = _header_]]
15:32:08.097 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Component -- internalRenderHead: [MyCounter [Component id = 0]]
15:32:08.098 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Page -- Rendered [HtmlHeaderContainer [Component id = _header_]]
15:32:08.098 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Component -- End render [HtmlHeaderContainer [Component id = _header_]]
15:32:08.098 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Component -- Begin render [Component id = counter-link]
15:32:08.098 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Page -- Rendered [Component id = counter-link]
15:32:08.098 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Component -- End render [Component id = counter-link]
15:32:08.098 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Component -- Begin render [Component id = counter-label]
15:32:08.099 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Page -- Rendered [Component id = counter-label]
15:32:08.099 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Component -- End render [Component id = counter-label]
15:32:08.099 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Page -- Rendered [Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 0, render count = 1]
15:32:08.099 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Component -- End render [Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 0, render count = 1]
15:32:08.104 [http-nio-8080-exec-1] DEBUG org.apache.wicket.Page -- ending request for page [Page class = com.asgarov.wicket.demo.counter.MyCounter, id = 0, render count = 1], request org.apache.wicket.protocol.http.servlet.ServletWebRequest@63e89a88
15:32:08.105 [http-nio-8080-exec-1] DEBUG org.apache.wicket.page.DefaultPageLockManager -- 'http-nio-8080-exec-1' released lock to page with id '0'
15:32:08.105 [http-nio-8080-exec-1] DEBUG org.apache.wicket.page.PageAccessSynchronizer -- 'http-nio-8080-exec-1' notifying blocked threads
What could be causing this, that Link element doesn't work but Label does when everything else is the same?