Source Code Cross Referenced for OldFeedRequest.java in  » Blogger-System » apache-roller-3.1 » org » apache » roller » ui » rendering » velocity » deprecated » 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 » Blogger System » apache roller 3.1 » org.apache.roller.ui.rendering.velocity.deprecated 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  The ASF licenses this file to You
004:         * under the Apache License, Version 2.0 (the "License"); you may not
005:         * use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.  For additional information regarding
015:         * copyright in this work, please see the NOTICE file in the top level
016:         * directory of this distribution.
017:         */
018:
019:        package org.apache.roller.ui.rendering.velocity.deprecated;
020:
021:        import java.util.HashSet;
022:        import java.util.Set;
023:        import javax.servlet.http.HttpServletRequest;
024:        import org.apache.commons.lang.StringUtils;
025:        import org.apache.commons.logging.Log;
026:        import org.apache.commons.logging.LogFactory;
027:        import org.apache.roller.RollerException;
028:        import org.apache.roller.pojos.WeblogTemplate;
029:
030:        /**
031:         * Represents a request for an *old* Roller weblog feed.
032:         * 
033:         * any of /rss/*, /atom/*, /flavor/*
034:         *
035:         * While these urls are no longer used we do provide redirect support for them
036:         * for users who have upgraded from earlier versions.  We keep this class to
037:         * help with parsing these urls since they are fairly complex.
038:         */
039:        public class OldFeedRequest {
040:
041:            private static Log mLogger = LogFactory
042:                    .getLog(OldFeedRequest.class);
043:
044:            private static Set feedServlets = new HashSet();
045:
046:            private String context = null;
047:            private String flavor = null;
048:            private String weblogHandle = null;
049:            private String weblogCategory = null;
050:            private boolean excerpts = false;
051:
052:            static {
053:                // initialize our servlet list
054:                feedServlets.add("rss");
055:                feedServlets.add("flavor");
056:                feedServlets.add("atom");
057:            }
058:
059:            /**
060:             * Construct the WeblogFeedRequest by parsing the incoming url
061:             */
062:            public OldFeedRequest(HttpServletRequest request) throws Exception {
063:
064:                // parse the request object and figure out what we've got
065:                mLogger.debug("parsing url " + request.getRequestURL());
066:
067:                String servlet = request.getServletPath();
068:                String pathInfo = request.getPathInfo();
069:
070:                // what servlet is our destination?
071:                if (servlet != null) {
072:                    // strip off the leading slash
073:                    servlet = servlet.substring(1);
074:
075:                    if (feedServlets.contains(servlet)) {
076:                        this .context = "weblog";
077:                        this .flavor = servlet;
078:                    } else {
079:                        // not a request to a feed servlet
080:                        throw new Exception("not a weblog feed request, "
081:                                + request.getRequestURL());
082:                    }
083:                } else {
084:                    throw new Exception("not a weblog feed request, "
085:                            + request.getRequestURL());
086:                }
087:
088:                // parse the path info
089:                if (pathInfo != null && pathInfo.trim().length() > 1) {
090:                    // strip off the leading slash
091:                    pathInfo = pathInfo.substring(1);
092:                    String[] pathElements = pathInfo.split("/");
093:
094:                    if (pathElements[0].length() > 0) {
095:                        this .weblogHandle = pathElements[0];
096:                    }
097:
098:                } else {
099:
100:                    // no path info means this was a non-weblog request
101:                    // we handle a few exceptions for this which include
102:                    //   /rss - main rss feed
103:                    //   /atom - main atom feed
104:                    //   /flavor - main flavor feed
105:
106:                    this .context = "main";
107:                }
108:
109:                /* 
110:                 * parse request parameters
111:                 *
112:                 * the only params we currently care about are:
113:                 *   flavor - defines the feed type
114:                 *   catname - specifies a weblog category
115:                 *   path - specifies a weblog category
116:                 *   excerpts - specifies the feed should only include excerpts
117:                 *
118:                 */
119:                if (request.getParameter("flavor") != null) {
120:                    this .flavor = request.getParameter("flavor");
121:                }
122:
123:                if (request.getParameter("path") != null) {
124:                    this .weblogCategory = request.getParameter("path");
125:                }
126:
127:                if (request.getParameter("catname") != null) {
128:                    this .weblogCategory = request.getParameter("catname");
129:                }
130:
131:                if (request.getParameter("excerpts") != null) {
132:                    this .excerpts = Boolean.valueOf(
133:                            request.getParameter("excerpts")).booleanValue();
134:                }
135:
136:                // one small final adjustment.
137:                // if our flavor is "flavor" then that means someone is just getting
138:                // the default flavor, which is rss, so let's set that
139:                if (this .flavor.equals("flavor")) {
140:                    this .flavor = "rss";
141:                }
142:
143:            }
144:
145:            public String getContext() {
146:                return context;
147:            }
148:
149:            public String getFlavor() {
150:                return flavor;
151:            }
152:
153:            public String getWeblogHandle() {
154:                return weblogHandle;
155:            }
156:
157:            public String getWeblogCategory() {
158:                return weblogCategory;
159:            }
160:
161:            public boolean isExcerpts() {
162:                return excerpts;
163:            }
164:
165:        }
w_w_w_.__j__ava___2___s.___c_o__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.