Java Doc for ParsedURL.java in  » IDE-Netbeans » visualweb.api.designer » org » apache » batik » util » 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 » IDE Netbeans » visualweb.api.designer » org.apache.batik.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.batik.util.ParsedURL

ParsedURL
public class ParsedURL (Code)
This class is used as a replacement for java.net.URL. This is done for several reasons. First unlike java.net.URL this class will accept and parse as much of a URL as possible, without throwing a MalformedURL exception. This makes it extreamly useful for simply parsing a URL string (hence it's name). Second it allows for extension of the protocols supported by the URL parser. Batik uses this to support the 'Data' protocol. Third by default it checks the streams that it opens to see if they are GZIP compressed, if so it automatically uncompresses them (avoiding opening the stream twice in the processes). It is worth noting that most real work is defered to the ParsedURLData class to which most methods are forwarded. This is done because it allows a constructor interface to ParsedURL (mostly for compatability with core URL), in spite of the fact that the real implemenation uses the protocol handlers as factories for protocol specific instances of the ParsedURLData class.
author:
   Thomas DeWeese
version:
   $Id$


Field Summary
 ParsedURLDatadata
     The data class we defer most things to.
 StringuserAgent
    

Constructor Summary
public  ParsedURL(String urlStr)
     Construct a ParsedURL from the given url string.
public  ParsedURL(URL url)
     Construct a ParsedURL from the given java.net.URL instance. This is useful if you already have a valid java.net.URL instance.
public  ParsedURL(String baseStr, String urlStr)
     Construct a sub URL from two strings.
Parameters:
  baseStr - The 'parent' URL.
public  ParsedURL(URL baseURL, String urlStr)
     Construct a sub URL from a base URL and a string for the sub url.
public  ParsedURL(ParsedURL baseURL, String urlStr)
     Construct a sub URL from a base ParsedURL and a string for the sub url.

Method Summary
public static  InputStreamcheckGZIP(InputStream is)
     This is a utility function others can call that checks if is is a GZIP stream if so it returns a GZIPInputStream that will decode the contents, otherwise it returns (or a buffered version of is) untouched.
public  booleancomplete()
     Returns true if the URL looks well formed and complete.
public  booleanequals(Object obj)
     Implement Object.equals.
public  StringgetContentEncoding()
     Returns the content encoding if available.
public  StringgetContentType()
     Returns the content type if available.
public static  StringgetGlobalUserAgent()
    
public static synchronized  ParsedURLProtocolHandlergetHandler(String protocol)
     Returns the handler for a particular protocol.
public  StringgetHost()
     Returns the host for this URL, if any, null if there isn't one or it doesn't make sense for the protocol.
public  StringgetPath()
     Returns the path for this URL, if any (where appropriate for the protocol this also includes the file, not just directory).
public  intgetPort()
     Returns the port on the host to connect to, if it was specified in the url that was parsed, otherwise returns -1.
public  StringgetPortStr()
     Returns the URL up to and include the port number on the host.
public  StringgetProtocol()
     Returns the protocol for this URL.
protected static  StringgetProtocol(String urlStr)
     Parse out the protocol from a url string.
public  StringgetRef()
     Returns the 'fragment' reference in the URL.
public  StringgetUserAgent()
     Return the user agent current associated with this url (or null if none).
public  inthashCode()
     Implement Object.hashCode.
public  InputStreamopenStream()
     Attempt to open the stream checking for common compression types, and automatically decompressing them if found.
public  InputStreamopenStream(String mimeType)
     Attempt to open the stream checking for common compression types, and automatically decompressing them if found.
public  InputStreamopenStream(String[] mimeTypes)
     Attempt to open the stream checking for common compression types, and automatically decompressing them if found.
public  InputStreamopenStream(Iterator mimeTypes)
     Attempt to open the stream checking for common compression types, and automatically decompressing them if found.
Parameters:
  mimeTypes - The expected mime types of the content in the returned InputStream (mapped to Http acceptheader among other possabilities).
public  InputStreamopenStreamRaw()
     Attempt to open the stream, does no checking for compression types.
public  InputStreamopenStreamRaw(String mimeType)
     Attempt to open the stream, does no checking for compression types.
public  InputStreamopenStreamRaw(String[] mimeTypes)
     Attempt to open the stream, does no checking for comression types.
public  InputStreamopenStreamRaw(Iterator mimeTypes)
     Attempt to open the stream, does no checking for comression types.
Parameters:
  mimeTypes - The expected mime types of the content in the returned InputStream (mapped to Http acceptheader among other possabilities).
public static  ParsedURLDataparseURL(String urlStr)
    
public static  ParsedURLDataparseURL(String baseStr, String urlStr)
     Factory method to construct an appropriate subclass of ParsedURLData, for a sub url.
public static  ParsedURLDataparseURL(ParsedURL baseURL, String urlStr)
     Factory method to construct an appropriate subclass of ParsedURLData, for a sub url.
public static synchronized  voidregisterHandler(ParsedURLProtocolHandler handler)
     Registers a Protocol handler by adding it to the handlers map.
public  booleansameFile(ParsedURL other)
    
public static  voidsetGlobalUserAgent(String userAgent)
    
public  voidsetUserAgent(String userAgent)
     Sets the user agent associated with this url (null clears any associated user agent).
public  StringtoString()
     Return a string rep of the URL (can be passed back into the constructor if desired).

Field Detail
data
ParsedURLData data(Code)
The data class we defer most things to.



userAgent
String userAgent(Code)
The user agent to associate with this URL




Constructor Detail
ParsedURL
public ParsedURL(String urlStr)(Code)
Construct a ParsedURL from the given url string.
Parameters:
  urlStr - The string to try and parse as a URL



ParsedURL
public ParsedURL(URL url)(Code)
Construct a ParsedURL from the given java.net.URL instance. This is useful if you already have a valid java.net.URL instance. This bypasses most of the parsing and hence is quicker and less prone to reinterpretation than converting the URL to a string before construction.
Parameters:
  url - The URL to "mimic".



ParsedURL
public ParsedURL(String baseStr, String urlStr)(Code)
Construct a sub URL from two strings.
Parameters:
  baseStr - The 'parent' URL. Should be complete.
Parameters:
  urlStr - The 'sub' URL may be complete or partial.the missing pieces will be taken from the baseStr.



ParsedURL
public ParsedURL(URL baseURL, String urlStr)(Code)
Construct a sub URL from a base URL and a string for the sub url.
Parameters:
  baseURL - The 'parent' URL.
Parameters:
  urlStr - The 'sub' URL may be complete or partial.the missing pieces will be taken from the baseURL.



ParsedURL
public ParsedURL(ParsedURL baseURL, String urlStr)(Code)
Construct a sub URL from a base ParsedURL and a string for the sub url.
Parameters:
  baseURL - The 'parent' URL.
Parameters:
  urlStr - The 'sub' URL may be complete or partial.the missing pieces will be taken from the baseURL.




Method Detail
checkGZIP
public static InputStream checkGZIP(InputStream is) throws IOException(Code)
This is a utility function others can call that checks if is is a GZIP stream if so it returns a GZIPInputStream that will decode the contents, otherwise it returns (or a buffered version of is) untouched.
Parameters:
  is - Stream that may potentially be a GZIP stream.



complete
public boolean complete()(Code)
Returns true if the URL looks well formed and complete. This does not garuntee that the stream can be opened but is a good indication that things aren't totally messed up.



equals
public boolean equals(Object obj)(Code)
Implement Object.equals. Relies heavily on the contained ParsedURLData's implementation of equals.



getContentEncoding
public String getContentEncoding()(Code)
Returns the content encoding if available. This is only available for some protocols.



getContentType
public String getContentType()(Code)
Returns the content type if available. This is only available for some protocols.



getGlobalUserAgent
public static String getGlobalUserAgent()(Code)



getHandler
public static synchronized ParsedURLProtocolHandler getHandler(String protocol)(Code)
Returns the handler for a particular protocol. If protocol is null or no match is found in the handlers map it returns the default protocol handler.
Parameters:
  protocol - The protocol to get a handler for.



getHost
public String getHost()(Code)
Returns the host for this URL, if any, null if there isn't one or it doesn't make sense for the protocol.



getPath
public String getPath()(Code)
Returns the path for this URL, if any (where appropriate for the protocol this also includes the file, not just directory). Note that getPath appears in JDK 1.3 as a synonym for getFile from JDK 1.2.



getPort
public int getPort()(Code)
Returns the port on the host to connect to, if it was specified in the url that was parsed, otherwise returns -1.



getPortStr
public String getPortStr()(Code)
Returns the URL up to and include the port number on the host. Does not include the path or fragment pieces.



getProtocol
public String getProtocol()(Code)
Returns the protocol for this URL. The protocol is everything upto the first ':'.



getProtocol
protected static String getProtocol(String urlStr)(Code)
Parse out the protocol from a url string. Used internally to select the proper handler, all other parsing is done by the selected protocol handler.



getRef
public String getRef()(Code)
Returns the 'fragment' reference in the URL.



getUserAgent
public String getUserAgent()(Code)
Return the user agent current associated with this url (or null if none).



hashCode
public int hashCode()(Code)
Implement Object.hashCode. Relies on the contained ParsedURLData's implementation of hashCode.



openStream
public InputStream openStream() throws IOException(Code)
Attempt to open the stream checking for common compression types, and automatically decompressing them if found.



openStream
public InputStream openStream(String mimeType) throws IOException(Code)
Attempt to open the stream checking for common compression types, and automatically decompressing them if found.
Parameters:
  mimeType - The expected mime type of the content in the returned InputStream (mapped to Http acceptheader among other possabilities).



openStream
public InputStream openStream(String[] mimeTypes) throws IOException(Code)
Attempt to open the stream checking for common compression types, and automatically decompressing them if found.
Parameters:
  mimeTypes - The expected mime types of the content in the returned InputStream (mapped to Http acceptheader among other possabilities).



openStream
public InputStream openStream(Iterator mimeTypes) throws IOException(Code)
Attempt to open the stream checking for common compression types, and automatically decompressing them if found.
Parameters:
  mimeTypes - The expected mime types of the content in the returned InputStream (mapped to Http acceptheader among other possabilities). The elements ofthe iterator must be strings.



openStreamRaw
public InputStream openStreamRaw() throws IOException(Code)
Attempt to open the stream, does no checking for compression types.



openStreamRaw
public InputStream openStreamRaw(String mimeType) throws IOException(Code)
Attempt to open the stream, does no checking for compression types.
Parameters:
  mimeType - The expected mime type of the content in the returned InputStream (mapped to Http acceptheader among other possabilities).



openStreamRaw
public InputStream openStreamRaw(String[] mimeTypes) throws IOException(Code)
Attempt to open the stream, does no checking for comression types.
Parameters:
  mimeTypes - The expected mime types of the content in the returned InputStream (mapped to Http acceptheader among other possabilities).



openStreamRaw
public InputStream openStreamRaw(Iterator mimeTypes) throws IOException(Code)
Attempt to open the stream, does no checking for comression types.
Parameters:
  mimeTypes - The expected mime types of the content in the returned InputStream (mapped to Http acceptheader among other possabilities). The elements ofthe iterator must be strings.



parseURL
public static ParsedURLData parseURL(String urlStr)(Code)
Factory method to construct an appropriate subclass of ParsedURLData
Parameters:
  urlStr - the string to parse.



parseURL
public static ParsedURLData parseURL(String baseStr, String urlStr)(Code)
Factory method to construct an appropriate subclass of ParsedURLData, for a sub url.
Parameters:
  baseStr - The base URL string to parse.
Parameters:
  urlStr - the sub URL string to parse.



parseURL
public static ParsedURLData parseURL(ParsedURL baseURL, String urlStr)(Code)
Factory method to construct an appropriate subclass of ParsedURLData, for a sub url.
Parameters:
  baseURL - The base ParsedURL to parse.
Parameters:
  urlStr - the sub URL string to parse.



registerHandler
public static synchronized void registerHandler(ParsedURLProtocolHandler handler)(Code)
Registers a Protocol handler by adding it to the handlers map. If the given protocol handler returns null as it's supported protocol then it is registered as the default protocol handler.
Parameters:
  handler - the new Protocol Handler to register



sameFile
public boolean sameFile(ParsedURL other)(Code)



setGlobalUserAgent
public static void setGlobalUserAgent(String userAgent)(Code)



setUserAgent
public void setUserAgent(String userAgent)(Code)
Sets the user agent associated with this url (null clears any associated user agent).



toString
public String toString()(Code)
Return a string rep of the URL (can be passed back into the constructor if desired).



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.