Source Code Cross Referenced for WebURLCompressingTargetResolverStrategy.java in  » J2EE » wicket » wicket » protocol » http » request » urlcompressing » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » wicket » wicket.protocol.http.request.urlcompressing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: org.eclipse.jdt.ui.prefs 5004 2006-03-17 20:47:08 -0800 (Fri, 17 Mar 2006) eelco12 $
003:         * $Revision: 5004 $
004:         * $Date: 2006-03-17 20:47:08 -0800 (Fri, 17 Mar 2006) $
005:         * 
006:         * ==============================================================================
007:         * Licensed under the Apache License, Version 2.0 (the "License"); you may not
008:         * use this file except in compliance with the License. You may obtain a copy of
009:         * the License at
010:         * 
011:         * http://www.apache.org/licenses/LICENSE-2.0
012:         * 
013:         * Unless required by applicable law or agreed to in writing, software
014:         * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
015:         * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
016:         * License for the specific language governing permissions and limitations under
017:         * the License.
018:         */
019:        package wicket.protocol.http.request.urlcompressing;
020:
021:        import org.apache.commons.logging.Log;
022:        import org.apache.commons.logging.LogFactory;
023:
024:        import wicket.Component;
025:        import wicket.IRedirectListener;
026:        import wicket.IRequestTarget;
027:        import wicket.Page;
028:        import wicket.RequestCycle;
029:        import wicket.RequestListenerInterface;
030:        import wicket.WicketRuntimeException;
031:        import wicket.authorization.UnauthorizedActionException;
032:        import wicket.markup.html.INewBrowserWindowListener;
033:        import wicket.markup.html.WebPage;
034:        import wicket.protocol.http.WebApplication;
035:        import wicket.protocol.http.request.urlcompressing.URLCompressor.ComponentAndInterface;
036:        import wicket.request.RequestParameters;
037:        import wicket.request.compound.DefaultRequestTargetResolverStrategy;
038:        import wicket.request.target.component.listener.RedirectPageRequestTarget;
039:        import wicket.util.string.Strings;
040:
041:        /**
042:         * Use this ResolverStrategy with the {@link WebURLCompressingCodingStrategy} to 
043:         * minimize the wicket:interface urls. The component path and the interface name
044:         * will be removed from the url and only an uid will be inserted into the url.
045:         * 
046:         * To use this url compressing behaviour you must override the 
047:         * {@link WebApplication} newRequestCycleProcessor() method. To make a request cycle
048:         * processor with this ResolverStrategy and the {@link WebURLCompressingCodingStrategy}
049:         * 
050:         * <pre>
051:         * protected IRequestCycleProcessor newRequestCycleProcessor()
052:         * {
053:         *   return new CompoundRequestCycleProcessor(new WebURLCompressingCodingStrategy(),new WebURLCompressingTargetResolverStrategy(),null,null,null);
054:         * }
055:         * </pre>
056:         * 
057:         * @author jcompagner
058:         * 
059:         * @since 1.2
060:         */
061:        public class WebURLCompressingTargetResolverStrategy extends
062:                DefaultRequestTargetResolverStrategy {
063:            /** log. */
064:            private static final Log log = LogFactory
065:                    .getLog(WebURLCompressingTargetResolverStrategy.class);
066:
067:            /**
068:             * Resolves the RequestTarget for the given interface. This method can be
069:             * overriden if some special interface needs to resolve to its own target.
070:             * 
071:             * @param requestCycle
072:             *            The current RequestCycle object
073:             * @param page
074:             *            The page object which holds the component for which this
075:             *            interface is called on.
076:             * @param componentPath
077:             *            The component path for looking up the component in the page.
078:             * @param interfaceName
079:             *            The interface to resolve.
080:             * @param requestParameters
081:             * @return The RequestTarget that was resolved
082:             */
083:            protected IRequestTarget resolveListenerInterfaceTarget(
084:                    final RequestCycle requestCycle, final Page page,
085:                    final String componentPath, String interfaceName,
086:                    final RequestParameters requestParameters) {
087:                String pageRelativeComponentPath = Strings
088:                        .afterFirstPathComponent(componentPath,
089:                                Component.PATH_SEPARATOR);
090:                Component component = null;
091:                if (page instanceof  WebPage
092:                        && !"IResourceListener".equals(interfaceName)) {
093:                    ComponentAndInterface cai = ((WebPage) page)
094:                            .getUrlCompressor().getComponentAndInterfaceForUID(
095:                                    pageRelativeComponentPath);
096:                    if (cai != null) {
097:                        interfaceName = cai.getInterfaceName();
098:                        component = cai.getComponent();
099:                    }
100:                }
101:
102:                if (interfaceName.equals(IRedirectListener.INTERFACE.getName())) {
103:                    return new RedirectPageRequestTarget(page);
104:                } else if (interfaceName
105:                        .equals(INewBrowserWindowListener.INTERFACE.getName())) {
106:                    return INewBrowserWindowListener.INTERFACE
107:                            .newRequestTarget(page, page,
108:                                    INewBrowserWindowListener.INTERFACE,
109:                                    requestParameters);
110:                } else {
111:                    // Get the listener interface we need to call
112:                    final RequestListenerInterface listener = RequestListenerInterface
113:                            .forName(interfaceName);
114:                    if (listener == null) {
115:                        throw new WicketRuntimeException(
116:                                "Attempt to access unknown request listener interface "
117:                                        + interfaceName);
118:                    }
119:
120:                    // Get component
121:                    if (component == null) {
122:                        if (Strings.isEmpty(pageRelativeComponentPath)) {
123:                            // We have an interface that is not a redirect, but no
124:                            // component... that must be wrong
125:                            throw new WicketRuntimeException(
126:                                    "When trying to call " + listener
127:                                            + ", a component must be provided");
128:                        }
129:                        component = page.get(pageRelativeComponentPath);
130:                    }
131:                    if (!component.isEnableAllowed()) {
132:                        throw new UnauthorizedActionException(component,
133:                                Component.ENABLE);
134:                    }
135:
136:                    // Ask the request listener interface object to create a request target
137:                    return listener.newRequestTarget(page, component, listener,
138:                            requestParameters);
139:                }
140:            }
141:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.