diff --git a/pom.xml b/pom.xml
index 1e8429d..b663258 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
net.ftlines.wicket-source
wicket-source-parent
- 1.5.0.7-SNAPSHOT
+ 1.3.7.0-SNAPSHOT
pom
Wicket-source displays component instantiation location in an html attribute, speeding the modification of existing wicket pages. The only module required for maven dependency in your app is wicket-source itself, although a demo app is included.
Wicket Source With Plugins
diff --git a/wicket-source-demo/pom.xml b/wicket-source-demo/pom.xml
index 654cac9..f0cecc4 100644
--- a/wicket-source-demo/pom.xml
+++ b/wicket-source-demo/pom.xml
@@ -3,17 +3,16 @@
net.ftlines.wicket-source
wicket-source-parent
- 1.5.0.7-SNAPSHOT
+ 1.3.7.0-SNAPSHOT
../pom.xml
- net.ftlines.wicket-source
wicket-source-demo
war
Wicket Source Demo
Wicket Quick-Start project demonstrating use of Wicket-Source
- 1.5.0
- 7.5.0.v20110901
+ 1.3.7
+ 6.1.25
@@ -26,7 +25,7 @@
org.apache.wicket
- wicket-core
+ wicket
${wicket.version}
@@ -39,12 +38,12 @@
org.slf4j
slf4j-log4j12
- 1.6.2
+ 1.4.2
log4j
log4j
- 1.2.16
+ 1.2.14
@@ -56,12 +55,25 @@
-
- org.eclipse.jetty.aggregate
- jetty-all-server
- ${jetty.version}
- provided
-
+
+ org.mortbay.jetty
+ jetty
+ ${jetty.version}
+ provided
+
+
+ org.mortbay.jetty
+ jetty-util
+ ${jetty.version}
+ provided
+
+
+ org.mortbay.jetty
+ jetty-management
+ ${jetty.version}
+ provided
+
+
diff --git a/wicket-source-demo/src/main/java/net/ftlines/wicketsource/demo/HomePage.java b/wicket-source-demo/src/main/java/net/ftlines/wicketsource/demo/HomePage.java
index c44fb78..630c555 100644
--- a/wicket-source-demo/src/main/java/net/ftlines/wicketsource/demo/HomePage.java
+++ b/wicket-source-demo/src/main/java/net/ftlines/wicketsource/demo/HomePage.java
@@ -6,6 +6,7 @@
import net.ftlines.wicketsource.demo.BookDataTable.BookDataProvider;
import org.apache.wicket.Component;
+import org.apache.wicket.PageParameters;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
@@ -20,7 +21,6 @@
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
/**
* The main home page of this application
@@ -99,7 +99,7 @@ public LinkedTitlePanel(String id, IModel> rowModel) {
ExternalLink link = new ExternalLink("link",
new PropertyModel(rowModel, "url"),
- new PropertyModel(rowModel, "title"));
+ new PropertyModel(rowModel, "title"));
add(link);
}
diff --git a/wicket-source-demo/src/test/java/net/ftlines/wicketsource/demo/Start.java b/wicket-source-demo/src/test/java/net/ftlines/wicketsource/demo/Start.java
index 16e7c89..c63e6c9 100644
--- a/wicket-source-demo/src/test/java/net/ftlines/wicketsource/demo/Start.java
+++ b/wicket-source-demo/src/test/java/net/ftlines/wicketsource/demo/Start.java
@@ -1,76 +1,49 @@
package net.ftlines.wicketsource.demo;
-import org.apache.wicket.util.time.Duration;
-import org.eclipse.jetty.http.ssl.SslContextFactory;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.bio.SocketConnector;
-import org.eclipse.jetty.server.ssl.SslSocketConnector;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.webapp.WebAppContext;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.bio.SocketConnector;
+import org.mortbay.jetty.webapp.WebAppContext;
-public class Start {
- public static void main(String[] args) throws Exception {
- int timeout = (int) Duration.ONE_HOUR.getMilliseconds();
-
- Server server = new Server();
- SocketConnector connector = new SocketConnector();
-
- // Set some timeout options to make debugging easier.
- connector.setMaxIdleTime(timeout);
- connector.setSoLingerTime(-1);
- connector.setPort(8080);
- server.addConnector(connector);
-
- // check if a keystore for a SSL certificate is available, and
- // if so, start a SSL connector on port 8443. By default, the
- // quickstart comes with a Apache Wicket Quickstart Certificate
- // that expires about half way september 2021. Do not use this
- // certificate anywhere important as the passwords are available
- // in the source.
-
- Resource keystore = Resource.newClassPathResource("/keystore");
- if (keystore != null && keystore.exists()) {
- connector.setConfidentialPort(8443);
-
- SslContextFactory factory = new SslContextFactory();
- factory.setKeyStoreResource(keystore);
- factory.setKeyStorePassword("wicket");
- factory.setTrustStore(keystore);
- factory.setKeyManagerPassword("wicket");
- SslSocketConnector sslConnector = new SslSocketConnector(factory);
- sslConnector.setMaxIdleTime(timeout);
- sslConnector.setPort(8443);
- sslConnector.setAcceptors(4);
- server.addConnector(sslConnector);
- System.out.println("SSL access to the quickstart has been enabled on port 8443");
- System.out.println("You can access the application using SSL on https://localhost:8443");
- System.out.println();
- }
-
- 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);
+public class Start {
- try {
- System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP");
- server.start();
- System.in.read();
- System.out.println(">>> STOPPING EMBEDDED JETTY SERVER");
- server.stop();
- server.join();
- } catch (Exception e) {
- e.printStackTrace();
- System.exit(1);
+ public static void main(String[] args) throws Exception {
+ Server server = new Server();
+ SocketConnector connector = new SocketConnector();
+
+ // Set some timeout options to make debugging easier.
+ connector.setMaxIdleTime(1000 * 60 * 60);
+ connector.setSoLingerTime(-1);
+ connector.setPort(8080);
+ server.setConnectors(new Connector[] { connector });
+
+ 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.addHandler(bb);
+
+ try {
+ System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP");
+ server.start();
+ System.in.read();
+ System.out.println(">>> STOPPING EMBEDDED JETTY SERVER");
+ // while (System.in.available() == 0) {
+ // Thread.sleep(5000);
+ // }
+ server.stop();
+ server.join();
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.exit(100);
+ }
}
- }
}
diff --git a/wicket-source/pom.xml b/wicket-source/pom.xml
index 31b10e8..7e030e3 100644
--- a/wicket-source/pom.xml
+++ b/wicket-source/pom.xml
@@ -3,7 +3,7 @@
net.ftlines.wicket-source
wicket-source-parent
- 1.5.0.7-SNAPSHOT
+ 1.3.7.0-SNAPSHOT
../pom.xml
wicket-source
@@ -20,7 +20,7 @@
- 1.5.0
+ 1.3.7
UTF-8
@@ -29,7 +29,7 @@
org.apache.wicket
wicket
${wicket.version}
- pom
+ jar
@@ -38,7 +38,7 @@
org.apache.maven.plugins
maven-source-plugin
- 2.1.2
+ 2.1.2
attach-sources
@@ -48,6 +48,7 @@
+
diff --git a/wicket-source/src/main/java/net/ftlines/wicketsource/AttributeModifyingComponentVisitor.java b/wicket-source/src/main/java/net/ftlines/wicketsource/AttributeModifyingComponentVisitor.java
index ce17b84..c2679d3 100644
--- a/wicket-source/src/main/java/net/ftlines/wicketsource/AttributeModifyingComponentVisitor.java
+++ b/wicket-source/src/main/java/net/ftlines/wicketsource/AttributeModifyingComponentVisitor.java
@@ -7,25 +7,27 @@
import org.apache.wicket.application.IComponentOnBeforeRenderListener;
/**
- * Sticks the wicket component name into an html attribute on the tag, which
+ * Sticks the wicket component name into an html attribute on the tag, which
* makes it easier to find using the Firebug or Chrome Dev Tools
* "Inspect Element" menu item.
*
- * This outputs more than just container classes (such as panels); it also
+ * This outputs more than just container classes (such as panels); it also
* tags images, labels, and links. Some of that is noise but some may be useful
* in locating a component in the source.
- *
+ *
* @author Jenny Brown
*
*/
public class AttributeModifyingComponentVisitor implements Serializable, IComponentOnBeforeRenderListener {
+ private static final long serialVersionUID = 1L;
+
private final AttributeModifier wicketSourceAttribute;
/**
* Creates a visitor
*/
public AttributeModifyingComponentVisitor() {
- wicketSourceAttribute = new AttributeModifier("wicketSource", new SourceModel());
+ wicketSourceAttribute = new AttributeModifier("wicketSource", true, new SourceModel());
}
/**
@@ -35,7 +37,7 @@ public void onBeforeRender(Component component)
{
component.add(wicketSourceAttribute);
}
-
-
-
+
+
+
}
diff --git a/wicket-source/src/main/java/net/ftlines/wicketsource/AttributeModifyingInstantiationListener.java b/wicket-source/src/main/java/net/ftlines/wicketsource/AttributeModifyingInstantiationListener.java
index 7e05e88..dd24c2c 100644
--- a/wicket-source/src/main/java/net/ftlines/wicketsource/AttributeModifyingInstantiationListener.java
+++ b/wicket-source/src/main/java/net/ftlines/wicketsource/AttributeModifyingInstantiationListener.java
@@ -9,10 +9,10 @@
* Notes the creation location of components and saves that metadata in the component metadata area.
* This is the precursor step to using a {@link AttributeModifyingComponentVisitor} for writing out an
* HTML wicketsource="net.simsa.photo.web.MainMenuPanel:35" style of attribute.
- *
- * This uses a similar approach to line-precise-reporting-on-new-component and is likely to be
+ *
+ * This uses a similar approach to line-precise-reporting-on-new-component and is likely to be
* equally slow, so turn it on only in debug/development mode, not production.
- *
+ *
* @author Jenny Brown
*
*/
@@ -21,24 +21,24 @@ public class AttributeModifyingInstantiationListener implements IComponentInstan
* This is an alternative to Component.CONSTRUCTED_AT_KEY which is package-private and thus internal to wicket.
* If wicket eventually exposes the markup exception from creation time, we can use that directly instead.
*/
- static MetaDataKey CONSTRUCTED_AT_KEY = new MetaDataKey() {
+ static MetaDataKey CONSTRUCTED_AT_KEY = new MetaDataKey(InstantiationLocation.class) {
private static final long serialVersionUID = 1L;
};
-
+
/**
* Indicates that the component's source location could not be determined,
* probably because this is an internal wicket enclosure or similar
* automatically generated component.
- *
+ *
* @author Jenny Brown
- *
+ *
*/
static class UnsupportedComponentException extends Exception {
public UnsupportedComponentException(String message) {
super(message);
}
- }
-
+ }
+
/**
* When a component is instantiated, record the source location as part of its metadata.
*/
@@ -47,7 +47,7 @@ public void onInstantiation(Component component)
if (component instanceof org.apache.wicket.markup.html.internal.Enclosure) {
return; // nothing to see here; bail out early to save time.
}
-
+
try {
component.setMetaData(CONSTRUCTED_AT_KEY, new InstantiationLocation(component));
} catch (UnsupportedComponentException ie) {
diff --git a/wicket-source/src/main/java/net/ftlines/wicketsource/SourceModel.java b/wicket-source/src/main/java/net/ftlines/wicketsource/SourceModel.java
index 5627b3e..70e6282 100644
--- a/wicket-source/src/main/java/net/ftlines/wicketsource/SourceModel.java
+++ b/wicket-source/src/main/java/net/ftlines/wicketsource/SourceModel.java
@@ -8,15 +8,17 @@
* @author Jenny Brown
*
*/
-public class SourceModel extends ComponentModel
+public class SourceModel extends ComponentModel
{
+ private static final long serialVersionUID = 1L;
+
/**
* @return package:file.java:lineNumber from InstantiationLocation.generateSourceLocationAttribute as a String
*/
@Override
protected String getObject(Component component)
{
- InstantiationLocation loc = component.getMetaData(AttributeModifyingInstantiationListener.CONSTRUCTED_AT_KEY);
+ InstantiationLocation loc = (InstantiationLocation) component.getMetaData(AttributeModifyingInstantiationListener.CONSTRUCTED_AT_KEY);
return loc == null ? null : loc.generateSourceLocationAttribute();
}
}
diff --git a/wicket-source/src/main/java/net/ftlines/wicketsource/WicketSource.java b/wicket-source/src/main/java/net/ftlines/wicketsource/WicketSource.java
index bcd0f3f..25af3c1 100644
--- a/wicket-source/src/main/java/net/ftlines/wicketsource/WicketSource.java
+++ b/wicket-source/src/main/java/net/ftlines/wicketsource/WicketSource.java
@@ -3,7 +3,7 @@
import org.apache.wicket.Application;
/**
- * Preferred entry point for app-developer use in initializing WicketSource, as
+ * Preferred entry point for app-developer use in initializing WicketSource, as
* compatibility can be maintained across wicket versions.
* @author Jenny Brown
*
@@ -16,8 +16,11 @@ public class WicketSource {
*/
public static void configure(Application application)
{
- application.getComponentInstantiationListeners().add(new AttributeModifyingInstantiationListener());
- application.getComponentPostOnBeforeRenderListeners().add(new AttributeModifyingComponentVisitor());
+ application.addComponentInstantiationListener(new AttributeModifyingInstantiationListener());
+ application.addComponentOnBeforeRenderListener(new AttributeModifyingComponentVisitor());
+// Below is 1.5 syntax for diff convenience.
+// application.getComponentInstantiationListeners().add(new AttributeModifyingInstantiationListener());
+// application.getComponentPostOnBeforeRenderListeners().add(new AttributeModifyingComponentVisitor());
}
-
+
}
diff --git a/wicket-source/src/main/java/net/ftlines/wicketsource/WicketSourceFilter.java b/wicket-source/src/main/java/net/ftlines/wicketsource/WicketSourceFilter.java
index 67eb81e..c70c1c8 100644
--- a/wicket-source/src/main/java/net/ftlines/wicketsource/WicketSourceFilter.java
+++ b/wicket-source/src/main/java/net/ftlines/wicketsource/WicketSourceFilter.java
@@ -16,7 +16,8 @@
public class WicketSourceFilter {
/** The notification method where instantiation listeners are called. */
- private static final String NOTIFY_COMPONENT_INSTANTIATION_LISTENERS = "org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation";
+ private static final String NOTIFY_COMPONENT_INSTANTIATION_LISTENERS = "org.apache.wicket.Application.notifyComponentInstantiationListeners";
+// private static final String NOTIFY_COMPONENT_INSTANTIATION_LISTENERS = "org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation";
/** When we hit this as the component origin, we know we won't get anything useful out of it. */
private static final String WICKET_PAGE_ON_RENDER = "org.apache.wicket.Page.onRender";
/** When we hit this as the component origin, we know we won't get anything useful out of it. */