Source Code Cross Referenced for AbstractURI.java in  » Portal » Open-Portal » com » sun » portal » rewriter » util » uri » 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 » Portal » Open Portal » com.sun.portal.rewriter.util.uri 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
004:         */
005:        package com.sun.portal.rewriter.util.uri;
006:
007:        import com.sun.portal.rewriter.util.StringHelper;
008:
009:        import java.net.MalformedURLException;
010:        import java.util.Map;
011:
012:        public abstract class AbstractURI implements  URIIntf {
013:            protected final String uriString;
014:
015:            private boolean valid = false;
016:            private String fileURI;
017:            private String dirURI;
018:            private String fileName;
019:            private String fileExtension;
020:
021:            protected AbstractURI(final String aURIString) {
022:                uriString = StringHelper.normalize(aURIString);
023:            }//constructor
024:
025:            public final int getDefaultPort() {
026:                return URIHelper.getDefaultPort(getProtocol());
027:            }//getDefaultPort()
028:
029:            private Map getQueryMap() {
030:                return URIHelper.parseQueryString(getQuery());
031:            }//getQueryMap()
032:
033:            public final String getParameterValue(final String aParamName) {
034:                final Object value = getQueryMap().get(aParamName);
035:
036:                if (value == null) {
037:                    return "";
038:                }
039:
040:                //As URI Get param can be array, get the last value rather
041:                //than the first
042:                String[] lValueArray = (String[]) value;
043:                return lValueArray[lValueArray.length - 1];
044:            }//getParameterValue()
045:
046:            public final String getFileURI() {
047:                if (fileURI == null) {
048:                    fileURI = getPath();
049:                    if (fileURI.length() == 0 && uriString.length() != 0) {
050:                        fileURI = "/";
051:                    }
052:                }
053:
054:                return fileURI;
055:            }//getFileURI()
056:
057:            public final String getDirURI() {
058:                if (dirURI == null) {
059:                    String temp = getFileURI();
060:                    if (URIHelper.needsToAppendDirectorySeperator(temp)) {
061:                        temp = temp + "/";
062:                    }
063:
064:                    int i = temp.lastIndexOf("/");
065:                    if (i != -1) {
066:                        dirURI = getFileURI().substring(0, i + 1);
067:                    } else {
068:                        dirURI = temp;
069:                    }
070:                }
071:
072:                return dirURI;
073:            }//getDirURI()
074:
075:            public final String getFileName() {
076:                if (fileName == null) {
077:                    String lPath = getFileURI();
078:                    fileName = lPath.substring(getDirURI().length());
079:                }
080:
081:                return fileName;
082:            }//getFileName()
083:
084:            public final String getFileExtension() {
085:                if (fileExtension == null) {
086:                    String bFileName = getFileName();
087:                    int i = bFileName.lastIndexOf('.');
088:                    if (i != -1) {
089:                        fileExtension = bFileName.substring(i + 1);
090:                    } else {
091:                        fileExtension = "";
092:                    }
093:                }
094:
095:                return fileExtension;
096:            }//getFileExtension()
097:
098:            public final String getInputString() {
099:                return uriString;
100:            }//getInputString()
101:
102:            public final String toExternalForm() {
103:                if (!isValid() & !isAbsolute()) {
104:                    return uriString;
105:                }
106:
107:                return getProtocol()
108:                        + ((getProtocol().length() != 0) ? "://" : "")
109:                        + ((getUserInfo().equals("")) ? "" : getUserInfo()
110:                                + "@")
111:                        + getHost()
112:                        + ((getPort() != -1) ? (":" + getPort()) : "")
113:                        + getPath()
114:                        + ((getQuery().equals("")) ? "" : "?" + getQuery())
115:                        + ((getReference().equals("")) ? "" : "#"
116:                                + getReference());
117:            }//toExternalForm()
118:
119:            protected final void setValid(final boolean aBool) {
120:                valid = aBool;
121:            }//setValid()
122:
123:            public final boolean isValid() {
124:                return valid;
125:            }//isValid()
126:
127:            public static final String appendParams(final String aURI,
128:                    final Map aParams) {
129:                return URIHelper.parameterize(aURI, aParams);
130:            }//appendParams()
131:
132:            public static URIIntf[] getAvailableURIImpl(final String aURIString)
133:                    throws MalformedURLException {
134:                return new URIIntf[] { new StandardURI(aURIString) };
135:            }//getAvailableURIImpl()
136:        }//AbstactURI
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.