Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/URLCompressor.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/URLCompressor.java?view=diff&rev=506990&r1=506989&r2=506990
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/URLCompressor.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/URLCompressor.java
Tue Feb 13 04:54:05 2007
@@ -14,206 +14,206 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package wicket.protocol.http.request.urlcompressing;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.WeakReference;
-import java.util.Iterator;
-
-import wicket.Component;
-import wicket.request.compound.CompoundRequestCycleProcessor;
-import wicket.util.collections.IntHashMap;
-import wicket.util.collections.IntHashMap.Entry;
-
-/**
- * This class generates UID for Component/Interface combinations when used in
- * conjunction with [EMAIL PROTECTED] WebURLCompressingCodingStrategy} and
- * [EMAIL PROTECTED] WebURLCompressingTargetResolverStrategy}
- *
- * To use the 2 strategies you have to create your own
- * [EMAIL PROTECTED] CompoundRequestCycleProcessor} in your
- * application's newRequestCycleProcessor() method, which should be overridden
- * and implemented like this:
- *
- * <pre>
- * protected IRequestCycleProcessor newRequestCycleProcessor()
- * {
- * return new CompoundRequestCycleProcessor(new
WebURLCompressingCodingStrategy(),
- * new WebURLCompressingTargetResolverStrategy(), null,
null, null);
- * }
- * </pre>
- *
- * @since 1.2
- *
- * @see WebURLCompressingCodingStrategy
- * @see WebURLCompressingTargetResolverStrategy
- *
- * @author jcompagner
- */
-public class URLCompressor implements Serializable
-{
- private static final long serialVersionUID = 1L;
-
- private transient ReferenceQueue queue = new ReferenceQueue();
-
- private transient IntHashMap directComponentRefs = new IntHashMap(); //
uid->component/interface
-
- private int uid = 1;
-
- private void readObject(java.io.ObjectInputStream s) throws
IOException, ClassNotFoundException
- {
- s.defaultReadObject();
-
- int size = s.readInt();
- queue = new ReferenceQueue();
- directComponentRefs = new IntHashMap((int)(size * 1.25));
-
- while (--size >= 0)
- {
- int uid = s.readInt();
- Component component = (Component)s.readObject();
- String interfaceName = s.readUTF();
-
- IntKeyWeakReference ref = new IntKeyWeakReference(uid,
component, queue);
- directComponentRefs.put(uid, new
ComponentAndInterface(ref, interfaceName));
- }
-
- }
-
- private void writeObject(java.io.ObjectOutputStream s) throws
IOException
- {
- IntKeyWeakReference ref = null;
- while ((ref = (IntKeyWeakReference)queue.poll()) != null)
- {
- directComponentRefs.remove(ref.uid);
- }
-
- s.defaultWriteObject();
-
- s.writeInt(directComponentRefs.size());
-
- Iterator it = directComponentRefs.entrySet().iterator();
- while (it.hasNext())
- {
- IntHashMap.Entry entry = (Entry)it.next();
-
- s.writeInt(entry.getKey());
- ComponentAndInterface cai =
(ComponentAndInterface)entry.getValue();
- s.writeObject(cai.getComponent());
- s.writeUTF(cai.getInterfaceName());
- }
- }
-
- /**
- * @return the next uid for this url compressor
- */
- public int getNewUID()
- {
- return uid++;
- }
-
- /**
- * Returns a uid for the combination component and the to call
interface.
- * Will return the same uid if it was already called for this specific
- * combination.
- *
- * @param component
- * The Component
- * @param interfaceName
- * The interface name
- * @return int The uid for the component/interfaceName combination
- */
- public int getUIDForComponentAndInterface(Component component, String
interfaceName)
- {
- int uid = 0;
- Iterator it = directComponentRefs.entrySet().iterator();
- while (it.hasNext())
- {
- IntHashMap.Entry entry = (IntHashMap.Entry)it.next();
- ComponentAndInterface cai =
(ComponentAndInterface)entry.getValue();
- if (cai.getInterfaceName().equals(interfaceName) &&
cai.getComponent() == component)
- {
- uid = entry.getKey();
- break;
- }
- }
- if (uid == 0)
- {
- uid = getNewUID();
- IntKeyWeakReference ref = new IntKeyWeakReference(uid,
component, queue);
- directComponentRefs.put(uid, new
ComponentAndInterface(ref, interfaceName));
- }
- return uid;
- }
-
- /**
- * Gets the combination
- *
- * @param uidString
- * @return ComponentAndInterface
- */
- public ComponentAndInterface getComponentAndInterfaceForUID(String
uidString)
- {
- IntKeyWeakReference ref = null;
- while ((ref = (IntKeyWeakReference)queue.poll()) != null)
- {
- directComponentRefs.remove(ref.uid);
- }
- int uid = Integer.parseInt(uidString);
- ComponentAndInterface cai =
(ComponentAndInterface)directComponentRefs.get(uid);
- return cai;
- }
-
- /**
- * @author jcompagner
- */
- public static class ComponentAndInterface
- {
- private static final long serialVersionUID = 1L;
-
- private final IntKeyWeakReference ref;
- private final String interfaceName;
-
- private ComponentAndInterface(IntKeyWeakReference ref, String
interfaceName)
- {
- this.ref = ref;
- this.interfaceName = interfaceName;
- }
-
- /**
- * @return Component The component that should be used to call
the
- * interface
- */
- public Component getComponent()
- {
- return (Component)ref.get();
- }
-
- /**
- * @return String The interface name which should be called on
the
- * component
- */
- public String getInterfaceName()
- {
- return interfaceName;
- }
- }
-
- private static class IntKeyWeakReference extends WeakReference
- {
- private int uid;
-
- /**
- * @param uid
- * @param referent
- * @param q
- */
- public IntKeyWeakReference(int uid, Object referent,
ReferenceQueue q)
- {
- super(referent, q);
- this.uid = uid;
- }
- }
-}
+package wicket.protocol.http.request.urlcompressing;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.util.Iterator;
+
+import wicket.Component;
+import wicket.request.compound.CompoundRequestCycleProcessor;
+import wicket.util.collections.IntHashMap;
+import wicket.util.collections.IntHashMap.Entry;
+
+/**
+ * This class generates UID for Component/Interface combinations when used in
+ * conjunction with [EMAIL PROTECTED] WebURLCompressingCodingStrategy} and
+ * [EMAIL PROTECTED] WebURLCompressingTargetResolverStrategy}
+ *
+ * To use the 2 strategies you have to create your own
+ * [EMAIL PROTECTED] CompoundRequestCycleProcessor} in your
+ * application's newRequestCycleProcessor() method, which should be overridden
+ * and implemented like this:
+ *
+ * <pre>
+ * protected IRequestCycleProcessor newRequestCycleProcessor()
+ * {
+ * return new CompoundRequestCycleProcessor(new
WebURLCompressingCodingStrategy(),
+ * new WebURLCompressingTargetResolverStrategy(), null,
null, null);
+ * }
+ * </pre>
+ *
+ * @since 1.2
+ *
+ * @see WebURLCompressingCodingStrategy
+ * @see WebURLCompressingTargetResolverStrategy
+ *
+ * @author jcompagner
+ */
+public class URLCompressor implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private transient ReferenceQueue queue = new ReferenceQueue();
+
+ private transient IntHashMap directComponentRefs = new IntHashMap(); //
uid->component/interface
+
+ private int uid = 1;
+
+ private void readObject(java.io.ObjectInputStream s) throws
IOException, ClassNotFoundException
+ {
+ s.defaultReadObject();
+
+ int size = s.readInt();
+ queue = new ReferenceQueue();
+ directComponentRefs = new IntHashMap((int)(size * 1.25));
+
+ while (--size >= 0)
+ {
+ int uid = s.readInt();
+ Component component = (Component)s.readObject();
+ String interfaceName = s.readUTF();
+
+ IntKeyWeakReference ref = new IntKeyWeakReference(uid,
component, queue);
+ directComponentRefs.put(uid, new
ComponentAndInterface(ref, interfaceName));
+ }
+
+ }
+
+ private void writeObject(java.io.ObjectOutputStream s) throws
IOException
+ {
+ IntKeyWeakReference ref = null;
+ while ((ref = (IntKeyWeakReference)queue.poll()) != null)
+ {
+ directComponentRefs.remove(ref.uid);
+ }
+
+ s.defaultWriteObject();
+
+ s.writeInt(directComponentRefs.size());
+
+ Iterator it = directComponentRefs.entrySet().iterator();
+ while (it.hasNext())
+ {
+ IntHashMap.Entry entry = (Entry)it.next();
+
+ s.writeInt(entry.getKey());
+ ComponentAndInterface cai =
(ComponentAndInterface)entry.getValue();
+ s.writeObject(cai.getComponent());
+ s.writeUTF(cai.getInterfaceName());
+ }
+ }
+
+ /**
+ * @return the next uid for this url compressor
+ */
+ public int getNewUID()
+ {
+ return uid++;
+ }
+
+ /**
+ * Returns a uid for the combination component and the to call
interface.
+ * Will return the same uid if it was already called for this specific
+ * combination.
+ *
+ * @param component
+ * The Component
+ * @param interfaceName
+ * The interface name
+ * @return int The uid for the component/interfaceName combination
+ */
+ public int getUIDForComponentAndInterface(Component component, String
interfaceName)
+ {
+ int uid = 0;
+ Iterator it = directComponentRefs.entrySet().iterator();
+ while (it.hasNext())
+ {
+ IntHashMap.Entry entry = (IntHashMap.Entry)it.next();
+ ComponentAndInterface cai =
(ComponentAndInterface)entry.getValue();
+ if (cai.getInterfaceName().equals(interfaceName) &&
cai.getComponent() == component)
+ {
+ uid = entry.getKey();
+ break;
+ }
+ }
+ if (uid == 0)
+ {
+ uid = getNewUID();
+ IntKeyWeakReference ref = new IntKeyWeakReference(uid,
component, queue);
+ directComponentRefs.put(uid, new
ComponentAndInterface(ref, interfaceName));
+ }
+ return uid;
+ }
+
+ /**
+ * Gets the combination
+ *
+ * @param uidString
+ * @return ComponentAndInterface
+ */
+ public ComponentAndInterface getComponentAndInterfaceForUID(String
uidString)
+ {
+ IntKeyWeakReference ref = null;
+ while ((ref = (IntKeyWeakReference)queue.poll()) != null)
+ {
+ directComponentRefs.remove(ref.uid);
+ }
+ int uid = Integer.parseInt(uidString);
+ ComponentAndInterface cai =
(ComponentAndInterface)directComponentRefs.get(uid);
+ return cai;
+ }
+
+ /**
+ * @author jcompagner
+ */
+ public static class ComponentAndInterface
+ {
+ private static final long serialVersionUID = 1L;
+
+ private final IntKeyWeakReference ref;
+ private final String interfaceName;
+
+ private ComponentAndInterface(IntKeyWeakReference ref, String
interfaceName)
+ {
+ this.ref = ref;
+ this.interfaceName = interfaceName;
+ }
+
+ /**
+ * @return Component The component that should be used to call
the
+ * interface
+ */
+ public Component getComponent()
+ {
+ return (Component)ref.get();
+ }
+
+ /**
+ * @return String The interface name which should be called on
the
+ * component
+ */
+ public String getInterfaceName()
+ {
+ return interfaceName;
+ }
+ }
+
+ private static class IntKeyWeakReference extends WeakReference
+ {
+ private int uid;
+
+ /**
+ * @param uid
+ * @param referent
+ * @param q
+ */
+ public IntKeyWeakReference(int uid, Object referent,
ReferenceQueue q)
+ {
+ super(referent, q);
+ this.uid = uid;
+ }
+ }
+}
Propchange:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/URLCompressor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/WebURLCompressingCodingStrategy.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/WebURLCompressingCodingStrategy.java?view=diff&rev=506990&r1=506989&r2=506990
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/WebURLCompressingCodingStrategy.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/WebURLCompressingCodingStrategy.java
Tue Feb 13 04:54:05 2007
@@ -14,107 +14,107 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package wicket.protocol.http.request.urlcompressing;
-
-import wicket.Component;
+package wicket.protocol.http.request.urlcompressing;
+
+import wicket.Component;
import wicket.IPageMap;
-import wicket.IRedirectListener;
-import wicket.Page;
-import wicket.RequestCycle;
-import wicket.RequestListenerInterface;
-import wicket.markup.html.WebPage;
-import wicket.protocol.http.WebApplication;
-import wicket.protocol.http.request.WebRequestCodingStrategy;
+import wicket.IRedirectListener;
+import wicket.Page;
+import wicket.RequestCycle;
+import wicket.RequestListenerInterface;
+import wicket.markup.html.WebPage;
+import wicket.protocol.http.WebApplication;
+import wicket.protocol.http.request.WebRequestCodingStrategy;
import wicket.request.RequestParameters;
-import
wicket.request.target.component.listener.IListenerInterfaceRequestTarget;
-import wicket.util.string.AppendingStringBuffer;
-
-
-/**
- * Use this CodingStategy with the [EMAIL PROTECTED]
WebURLCompressingTargetResolverStrategy} to
- * minimize the wicket:interface urls. The component path and the interface
name
- * will be removed from the url and only an uid will be inserted into the url.
- *
- * To use this url compressing behaviour you must override the
- * [EMAIL PROTECTED] WebApplication}'s newRequestCycleProcessor() method. To
make a request cycle
- * processor with this CodingStrategy and the [EMAIL PROTECTED]
WebURLCompressingTargetResolverStrategy}
- *
- * <pre>
- * protected IRequestCycleProcessor newRequestCycleProcessor()
- * {
- * return new CompoundRequestCycleProcessor(new
WebURLCompressingCodingStrategy(),new
WebURLCompressingTargetResolverStrategy(),null,null,null);
- * }
- * </pre>
- *
- * @author jcompagner
- *
- * @since 1.2
- */
-public class WebURLCompressingCodingStrategy extends WebRequestCodingStrategy
-{
- /**
- * Encode a listener interface target.
- *
- * @param requestCycle
- * the current request cycle
- * @param requestTarget
- * the target to encode
- * @return the encoded url
- */
- protected CharSequence encode(RequestCycle requestCycle,
- IListenerInterfaceRequestTarget requestTarget)
- {
- final RequestListenerInterface rli =
requestTarget.getRequestListenerInterface();
-
- // Start string buffer for url
- final AppendingStringBuffer url = new AppendingStringBuffer(64);
- url.append('?');
- url.append(INTERFACE_PARAMETER_NAME);
- url.append('=');
-
- // Get component and page for request target
- final Component component = requestTarget.getTarget();
- final Page page = component.getPage();
-
- // Add pagemap
- final IPageMap pageMap = page.getPageMap();
- if (!pageMap.isDefault())
- {
- url.append(pageMap.getName());
- }
- url.append(Component.PATH_SEPARATOR);
-
- String listenerName = rli.getName();
- // Add path to component
- if (page instanceof WebPage &&
!"IResourceListener".equals(listenerName))
- {
- url.append(page.getId());
- url.append(Component.PATH_SEPARATOR);
-
url.append(((WebPage)page).getUrlCompressor().getUIDForComponentAndInterface(component,listenerName));
- listenerName = null;
- }
- else
- {
- url.append(component.getPath());
- }
- url.append(Component.PATH_SEPARATOR);
-
- // Add version
- final int versionNumber =
component.getPage().getCurrentVersionNumber();
- if (!rli.getRecordsPageVersion())
- {
- url.append(Page.LATEST_VERSION);
- }
- else if (versionNumber > 0)
- {
- url.append(versionNumber);
- }
- url.append(Component.PATH_SEPARATOR);
-
- // Add listener interface
- if (listenerName != null &&
!IRedirectListener.INTERFACE.getName().equals(listenerName))
- {
- url.append(listenerName);
+import
wicket.request.target.component.listener.IListenerInterfaceRequestTarget;
+import wicket.util.string.AppendingStringBuffer;
+
+
+/**
+ * Use this CodingStategy with the [EMAIL PROTECTED]
WebURLCompressingTargetResolverStrategy} to
+ * minimize the wicket:interface urls. The component path and the interface
name
+ * will be removed from the url and only an uid will be inserted into the url.
+ *
+ * To use this url compressing behaviour you must override the
+ * [EMAIL PROTECTED] WebApplication}'s newRequestCycleProcessor() method. To
make a request cycle
+ * processor with this CodingStrategy and the [EMAIL PROTECTED]
WebURLCompressingTargetResolverStrategy}
+ *
+ * <pre>
+ * protected IRequestCycleProcessor newRequestCycleProcessor()
+ * {
+ * return new CompoundRequestCycleProcessor(new
WebURLCompressingCodingStrategy(),new
WebURLCompressingTargetResolverStrategy(),null,null,null);
+ * }
+ * </pre>
+ *
+ * @author jcompagner
+ *
+ * @since 1.2
+ */
+public class WebURLCompressingCodingStrategy extends WebRequestCodingStrategy
+{
+ /**
+ * Encode a listener interface target.
+ *
+ * @param requestCycle
+ * the current request cycle
+ * @param requestTarget
+ * the target to encode
+ * @return the encoded url
+ */
+ protected CharSequence encode(RequestCycle requestCycle,
+ IListenerInterfaceRequestTarget requestTarget)
+ {
+ final RequestListenerInterface rli =
requestTarget.getRequestListenerInterface();
+
+ // Start string buffer for url
+ final AppendingStringBuffer url = new AppendingStringBuffer(64);
+ url.append('?');
+ url.append(INTERFACE_PARAMETER_NAME);
+ url.append('=');
+
+ // Get component and page for request target
+ final Component component = requestTarget.getTarget();
+ final Page page = component.getPage();
+
+ // Add pagemap
+ final IPageMap pageMap = page.getPageMap();
+ if (!pageMap.isDefault())
+ {
+ url.append(pageMap.getName());
+ }
+ url.append(Component.PATH_SEPARATOR);
+
+ String listenerName = rli.getName();
+ // Add path to component
+ if (page instanceof WebPage &&
!"IResourceListener".equals(listenerName))
+ {
+ url.append(page.getId());
+ url.append(Component.PATH_SEPARATOR);
+
url.append(((WebPage)page).getUrlCompressor().getUIDForComponentAndInterface(component,listenerName));
+ listenerName = null;
+ }
+ else
+ {
+ url.append(component.getPath());
+ }
+ url.append(Component.PATH_SEPARATOR);
+
+ // Add version
+ final int versionNumber =
component.getPage().getCurrentVersionNumber();
+ if (!rli.getRecordsPageVersion())
+ {
+ url.append(Page.LATEST_VERSION);
+ }
+ else if (versionNumber > 0)
+ {
+ url.append(versionNumber);
+ }
+ url.append(Component.PATH_SEPARATOR);
+
+ // Add listener interface
+ if (listenerName != null &&
!IRedirectListener.INTERFACE.getName().equals(listenerName))
+ {
+ url.append(listenerName);
}
url.append(Component.PATH_SEPARATOR);
@@ -124,7 +124,7 @@
if (params != null && params.getBehaviorId() != null)
{
url.append(params.getBehaviorId());
- }
- return requestCycle.getOriginalResponse().encodeURL(url);
- }
-}
+ }
+ return requestCycle.getOriginalResponse().encodeURL(url);
+ }
+}
Propchange:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/WebURLCompressingCodingStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/WebURLCompressingTargetResolverStrategy.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/WebURLCompressingTargetResolverStrategy.java?view=diff&rev=506990&r1=506989&r2=506990
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/WebURLCompressingTargetResolverStrategy.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/WebURLCompressingTargetResolverStrategy.java
Tue Feb 13 04:54:05 2007
@@ -14,125 +14,125 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package wicket.protocol.http.request.urlcompressing;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import wicket.Component;
-import wicket.IRedirectListener;
-import wicket.IRequestTarget;
-import wicket.Page;
-import wicket.RequestCycle;
-import wicket.RequestListenerInterface;
-import wicket.WicketRuntimeException;
-import wicket.authorization.UnauthorizedActionException;
-import wicket.markup.html.INewBrowserWindowListener;
-import wicket.markup.html.WebPage;
-import wicket.protocol.http.WebApplication;
-import
wicket.protocol.http.request.urlcompressing.URLCompressor.ComponentAndInterface;
-import wicket.request.RequestParameters;
-import wicket.request.compound.DefaultRequestTargetResolverStrategy;
-import wicket.request.target.component.listener.RedirectPageRequestTarget;
-import wicket.util.string.Strings;
-
-
-/**
- * Use this ResolverStrategy with the [EMAIL PROTECTED]
WebURLCompressingCodingStrategy} to
- * minimize the wicket:interface urls. The component path and the interface
name
- * will be removed from the url and only an uid will be inserted into the url.
- *
- * To use this url compressing behaviour you must override the
- * [EMAIL PROTECTED] WebApplication} newRequestCycleProcessor() method. To
make a request cycle
- * processor with this ResolverStrategy and the [EMAIL PROTECTED]
WebURLCompressingCodingStrategy}
- *
- * <pre>
- * protected IRequestCycleProcessor newRequestCycleProcessor()
- * {
- * return new CompoundRequestCycleProcessor(new
WebURLCompressingCodingStrategy(),new
WebURLCompressingTargetResolverStrategy(),null,null,null);
- * }
- * </pre>
- *
- * @author jcompagner
- *
- * @since 1.2
- */
-public class WebURLCompressingTargetResolverStrategy extends
DefaultRequestTargetResolverStrategy
-{
- /** log. */
- private static final Log log =
LogFactory.getLog(WebURLCompressingTargetResolverStrategy.class);
-
- /**
- * Resolves the RequestTarget for the given interface. This method can
be
- * overriden if some special interface needs to resolve to its own
target.
- *
- * @param requestCycle
- * The current RequestCycle object
- * @param page
- * The page object which holds the component for which this
- * interface is called on.
- * @param componentPath
- * The component path for looking up the component in the
page.
- * @param interfaceName
- * The interface to resolve.
- * @param requestParameters
- * @return The RequestTarget that was resolved
- */
- protected IRequestTarget resolveListenerInterfaceTarget(final
RequestCycle requestCycle,
- final Page page, final String componentPath, String
interfaceName,
- final RequestParameters requestParameters)
- {
- String pageRelativeComponentPath =
Strings.afterFirstPathComponent(componentPath, Component.PATH_SEPARATOR);
- Component component = null;
- if (page instanceof WebPage &&
!"IResourceListener".equals(interfaceName))
- {
- ComponentAndInterface cai =
((WebPage)page).getUrlCompressor().getComponentAndInterfaceForUID(pageRelativeComponentPath);
- if(cai != null)
- {
- interfaceName = cai.getInterfaceName();
- component = cai.getComponent();
- }
- }
-
- if (interfaceName.equals(IRedirectListener.INTERFACE.getName()))
- {
- return new RedirectPageRequestTarget(page);
- }
- else
if(interfaceName.equals(INewBrowserWindowListener.INTERFACE.getName()))
- {
- return
INewBrowserWindowListener.INTERFACE.newRequestTarget(page,
page,INewBrowserWindowListener.INTERFACE, requestParameters);
- }
- else
- {
- // Get the listener interface we need to call
- final RequestListenerInterface listener =
RequestListenerInterface
- .forName(interfaceName);
- if (listener == null)
- {
- throw new WicketRuntimeException(
- "Attempt to access unknown
request listener interface " + interfaceName);
- }
-
- // Get component
- if (component == null)
- {
- if (Strings.isEmpty(pageRelativeComponentPath))
- {
- // We have an interface that is not a
redirect, but no
- // component... that must be wrong
- throw new WicketRuntimeException("When
trying to call " + listener
- + ", a component must
be provided");
- }
- component = page.get(pageRelativeComponentPath);
- }
-
- if (!component.isEnableAllowed())
- {
- throw new
UnauthorizedActionException(component,Component.ENABLE);
- }
-
- // Ask the request listener interface object to create
a request target
- return listener.newRequestTarget(page, component,
listener, requestParameters);
- }
- }
-}
+package wicket.protocol.http.request.urlcompressing;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import wicket.Component;
+import wicket.IRedirectListener;
+import wicket.IRequestTarget;
+import wicket.Page;
+import wicket.RequestCycle;
+import wicket.RequestListenerInterface;
+import wicket.WicketRuntimeException;
+import wicket.authorization.UnauthorizedActionException;
+import wicket.markup.html.INewBrowserWindowListener;
+import wicket.markup.html.WebPage;
+import wicket.protocol.http.WebApplication;
+import
wicket.protocol.http.request.urlcompressing.URLCompressor.ComponentAndInterface;
+import wicket.request.RequestParameters;
+import wicket.request.compound.DefaultRequestTargetResolverStrategy;
+import wicket.request.target.component.listener.RedirectPageRequestTarget;
+import wicket.util.string.Strings;
+
+
+/**
+ * Use this ResolverStrategy with the [EMAIL PROTECTED]
WebURLCompressingCodingStrategy} to
+ * minimize the wicket:interface urls. The component path and the interface
name
+ * will be removed from the url and only an uid will be inserted into the url.
+ *
+ * To use this url compressing behaviour you must override the
+ * [EMAIL PROTECTED] WebApplication} newRequestCycleProcessor() method. To
make a request cycle
+ * processor with this ResolverStrategy and the [EMAIL PROTECTED]
WebURLCompressingCodingStrategy}
+ *
+ * <pre>
+ * protected IRequestCycleProcessor newRequestCycleProcessor()
+ * {
+ * return new CompoundRequestCycleProcessor(new
WebURLCompressingCodingStrategy(),new
WebURLCompressingTargetResolverStrategy(),null,null,null);
+ * }
+ * </pre>
+ *
+ * @author jcompagner
+ *
+ * @since 1.2
+ */
+public class WebURLCompressingTargetResolverStrategy extends
DefaultRequestTargetResolverStrategy
+{
+ /** log. */
+ private static final Log log =
LogFactory.getLog(WebURLCompressingTargetResolverStrategy.class);
+
+ /**
+ * Resolves the RequestTarget for the given interface. This method can
be
+ * overriden if some special interface needs to resolve to its own
target.
+ *
+ * @param requestCycle
+ * The current RequestCycle object
+ * @param page
+ * The page object which holds the component for which this
+ * interface is called on.
+ * @param componentPath
+ * The component path for looking up the component in the
page.
+ * @param interfaceName
+ * The interface to resolve.
+ * @param requestParameters
+ * @return The RequestTarget that was resolved
+ */
+ protected IRequestTarget resolveListenerInterfaceTarget(final
RequestCycle requestCycle,
+ final Page page, final String componentPath, String
interfaceName,
+ final RequestParameters requestParameters)
+ {
+ String pageRelativeComponentPath =
Strings.afterFirstPathComponent(componentPath, Component.PATH_SEPARATOR);
+ Component component = null;
+ if (page instanceof WebPage &&
!"IResourceListener".equals(interfaceName))
+ {
+ ComponentAndInterface cai =
((WebPage)page).getUrlCompressor().getComponentAndInterfaceForUID(pageRelativeComponentPath);
+ if(cai != null)
+ {
+ interfaceName = cai.getInterfaceName();
+ component = cai.getComponent();
+ }
+ }
+
+ if (interfaceName.equals(IRedirectListener.INTERFACE.getName()))
+ {
+ return new RedirectPageRequestTarget(page);
+ }
+ else
if(interfaceName.equals(INewBrowserWindowListener.INTERFACE.getName()))
+ {
+ return
INewBrowserWindowListener.INTERFACE.newRequestTarget(page,
page,INewBrowserWindowListener.INTERFACE, requestParameters);
+ }
+ else
+ {
+ // Get the listener interface we need to call
+ final RequestListenerInterface listener =
RequestListenerInterface
+ .forName(interfaceName);
+ if (listener == null)
+ {
+ throw new WicketRuntimeException(
+ "Attempt to access unknown
request listener interface " + interfaceName);
+ }
+
+ // Get component
+ if (component == null)
+ {
+ if (Strings.isEmpty(pageRelativeComponentPath))
+ {
+ // We have an interface that is not a
redirect, but no
+ // component... that must be wrong
+ throw new WicketRuntimeException("When
trying to call " + listener
+ + ", a component must
be provided");
+ }
+ component = page.get(pageRelativeComponentPath);
+ }
+
+ if (!component.isEnableAllowed())
+ {
+ throw new
UnauthorizedActionException(component,Component.ENABLE);
+ }
+
+ // Ask the request listener interface object to create
a request target
+ return listener.newRequestTarget(page, component,
listener, requestParameters);
+ }
+ }
+}
Propchange:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/urlcompressing/WebURLCompressingTargetResolverStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/servlet/AbortWithHttpStatusException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/servlet/AbortWithWebErrorCodeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/IRequestTargetMountsInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/session/ISessionStore.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IAjaxSettings.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IAjaxSettings.java?view=diff&rev=506990&r1=506989&r2=506990
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IAjaxSettings.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IAjaxSettings.java
Tue Feb 13 04:54:05 2007
@@ -14,29 +14,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package wicket.settings;
-
-/**
- * Ajax settings
- * <p>
- * Ajax debug mode setting: when enabled allows a user to monitor ajax events
- * from the browser
- *
- * @author Igor Vaynberg (ivaynberg)
- *
- * @deprecated use IDebugSettings instead
- */
-public interface IAjaxSettings
-{
- /**
- * @return true if ajax debug mode is enabled, false otherwise
- */
- boolean isAjaxDebugModeEnabled();
-
- /**
- * Enables or disables ajax debug mode.
- *
- * @param enable
- */
- void setAjaxDebugModeEnabled(boolean enable);
-}
+package wicket.settings;
+
+/**
+ * Ajax settings
+ * <p>
+ * Ajax debug mode setting: when enabled allows a user to monitor ajax events
+ * from the browser
+ *
+ * @author Igor Vaynberg (ivaynberg)
+ *
+ * @deprecated use IDebugSettings instead
+ */
+public interface IAjaxSettings
+{
+ /**
+ * @return true if ajax debug mode is enabled, false otherwise
+ */
+ boolean isAjaxDebugModeEnabled();
+
+ /**
+ * Enables or disables ajax debug mode.
+ *
+ * @param enable
+ */
+ void setAjaxDebugModeEnabled(boolean enable);
+}
Propchange:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IAjaxSettings.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IFrameworkSettings.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IRequestLoggerSettings.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IRequestLoggerSettings.java?view=diff&rev=506990&r1=506989&r2=506990
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IRequestLoggerSettings.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IRequestLoggerSettings.java
Tue Feb 13 04:54:05 2007
@@ -14,50 +14,50 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package wicket.settings;
-
-/**
- * @author jcompagner
- */
-public interface IRequestLoggerSettings
-{
- /**
- * Enable/Disable the request logger.
- *
- * @param enable boolean.
- */
- void setRequestLoggerEnabled(boolean enable);
-
-
- /**
- * @return true if the request Logger is enabled. (default false)
- */
- boolean isRequestLoggerEnabled();
-
- /**
- * Enable/Disable the recording of the session size
- * for every request.
- *
- * @param record
- */
- void setRecordSessionSize(boolean record);
-
- /**
- * @return true if the session size is recorded. (default true)
- */
- boolean getRecordSessionSize();
-
- /**
- * Set the window of all the requests that is kept in memory
- * for viewing. Default is 2000, You can set this to 0 then
- * only Sessions data is recorded (number of request, total time,
latest size)
- *
- * @param size
- */
- void setRequestsWindowSize(int size);
-
- /**
- * @return The window size of the recorded requests. (default 2000)
- */
- int getRequestsWindowSize();
-}
+package wicket.settings;
+
+/**
+ * @author jcompagner
+ */
+public interface IRequestLoggerSettings
+{
+ /**
+ * Enable/Disable the request logger.
+ *
+ * @param enable boolean.
+ */
+ void setRequestLoggerEnabled(boolean enable);
+
+
+ /**
+ * @return true if the request Logger is enabled. (default false)
+ */
+ boolean isRequestLoggerEnabled();
+
+ /**
+ * Enable/Disable the recording of the session size
+ * for every request.
+ *
+ * @param record
+ */
+ void setRecordSessionSize(boolean record);
+
+ /**
+ * @return true if the session size is recorded. (default true)
+ */
+ boolean getRecordSessionSize();
+
+ /**
+ * Set the window of all the requests that is kept in memory
+ * for viewing. Default is 2000, You can set this to 0 then
+ * only Sessions data is recorded (number of request, total time,
latest size)
+ *
+ * @param size
+ */
+ void setRequestsWindowSize(int size);
+
+ /**
+ * @return The window size of the recorded requests. (default 2000)
+ */
+ int getRequestsWindowSize();
+}
Propchange:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IRequestLoggerSettings.java
------------------------------------------------------------------------------
svn:eol-style = native