Java Doc for MutableURI.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » netui » core » urls » 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 » Library » Apache beehive 1.0.2 src » org.apache.beehive.netui.core.urls 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.beehive.netui.core.urls.MutableURI

All known Subclasses:   org.apache.beehive.netui.core.urls.FreezableMutableURI,
MutableURI
public class MutableURI (Code)
Mutable class for creating URIs.

There is little checking that an instance of this class produces a legal URI reference as defined by RFC 2396: Uniform Resource Identifiers (URI): Generic Syntax. The minimal checking for syntax is on constructors that take a String representation or the URI, a URI , or a URL . To avoid the cost of continually checking the syntax, it is up to the user to ensure that the components are set correctly.

The setters of this class also assume that the data components are already encoded correctly for the given encoding of this URI, unless noted otherwise as in the methods to add unecoded parameters to the query. Then this class will handle the encoding. See MutableURI.addParameter(String name,String value,boolean encoded) and MutableURI.addParameters(Map newParams,boolean encoded)

There is a static convenience method in this class so callers can easily encode unencoded components before setting it in this object.



Field Summary
final public static  StringDEFAULT_ENCODING
     Value used to set the encoding as undefined.
final public static  intUNDEFINED_PORT
     Value used to set the port as undefined.

Constructor Summary
public  MutableURI()
     Constructs a MutableURI.
public  MutableURI(String uriString, boolean encoded)
     Constructs a MutableURI.
public  MutableURI(String scheme, String userInfo, String host, int port, String path, String query, String fragment)
     Constructs a MutableURI.
public  MutableURI(URI uri)
     Constructs a MutableURI.
public  MutableURI(URL url)
     Constructs a MutableURI.

This is just a convenience constructor that functions the same as MutableURI.MutableURI(URI) constructor with java.net.URL.toURI as the argument.


Method Summary
public  voidaddParameter(String name, String value, boolean encoded)
     Add a parameter for the query string.

If the encoded flag is true then this method assumes that the name and value do not need encoding or are already encoded correctly.

public  voidaddParameters(Map newParams, boolean encoded)
    

Adds all the parameters in a Map to a URI's query string.

If the encoded flag is true then this method assumes that the name and value do not need encoding or are already encoded correctly.

public static  Stringencode(String url, String encoding)
     Convenience method to encode unencoded components of a URI.
public  Stringencode(String url)
     Convenience method to encode unencoded components of a URI.
protected static  URIencodeURI(String original)
     Parse a URI reference, as a String, into its components and use java.net.URI to encode the components correctly.
public  booleanequals(Object object)
     Determines if the passed-in Object is equivalent to this MutableURI.
Parameters:
  object - the Object to test for equality.
public static  URIContextgetDefaultContext()
     Returns a default URIContext.
public  StringgetEncoding()
     Returns the character encoding that is used when adding unencoded parameters.
public  StringgetFragment()
     Returns the fragment.
public  StringgetHost()
     Returns the host.
public  StringgetParameter(String name)
     Returns the value of the parameter.
public  ListgetParameters(String name)
     Returns the values of the given parameter.
public  MapgetParameters()
     Returns an unmodifiable Map of all parameters.
public  StringgetPath()
     Returns the path.
public  intgetPort()
     Returns the port.
public  StringgetQuery(URIContext uriContext)
     Returns the query string (encoded/escaped).

The context states whether or not to use the default delimiter, usually the "&" entity, to separate the parameters. Otherwise, the "&" character is used.

public  StringgetScheme()
     Returns the protocol/scheme.
public  StringgetSchemeSpecificPart()
     Returns the scheme-specific part of this URI if it is opaque. Otherwise, this method returns null. the scheme-specific part of this URI if this URI wasexplicitly set as opaque.
public  StringgetURIString(URIContext uriContext)
     Returns a string form of this URI.
public  StringgetUserInfo()
     Returns the userInfo.
public  inthashCode()
     Returns a hash code value for the object.

Implemented in conjunction with equals() override.

protected static  intindexFirstOf(String s, String delims, int offset)
     Get the earliest index, searching for the first occurrance of any one of the given delimiters.
public  booleanisAbsolute()
     Tells whether or not this URI is absolute.

A URI is absolute if, and only if, it has a scheme component.

public  booleanisOpaque()
     Tells whether or not this URI is opaque.
public  voidremoveParameter(String name)
     Removes the given parameter.
public  voidsetEncoding(String encoding)
     Set the encoding used when adding unencoded parameters.
public  voidsetFragment(String fragment)
     Sets the fragment.
public  voidsetHost(String host)
     Sets the host.
public  voidsetOpaque(String scheme, String schemeSpecificPart)
     Sets the URI to be opaque using the given scheme and schemeSpecificPart.

From URI : "A URI is opaque if, and only if, it is absolute and its scheme-specific part does not begin with a slash character ('/').

public  voidsetPath(String path)
     Sets the path.
public  voidsetPort(int port)
     Sets the port.
public  voidsetQuery(String query)
     Sets (and resets) the query string.
public  voidsetScheme(String scheme)
     Sets the protocol/scheme.
protected  voidsetSchemeSpecificPart(String schemeSpecificPart)
    
public  voidsetURI(String uriString, boolean encoded)
     Set the value of the MutableURI.

This method can also be used to clear the MutableURI.

public  voidsetURI(URI uri)
     Set the value of the MutableURI.

This method can also be used to clear the MutableURI.

public  voidsetUserInfo(String userInfo)
     Sets the userInfo.

Field Detail
DEFAULT_ENCODING
final public static String DEFAULT_ENCODING(Code)
Value used to set the encoding as undefined.



UNDEFINED_PORT
final public static int UNDEFINED_PORT(Code)
Value used to set the port as undefined.




Constructor Detail
MutableURI
public MutableURI()(Code)
Constructs a MutableURI.



MutableURI
public MutableURI(String uriString, boolean encoded) throws URISyntaxException(Code)
Constructs a MutableURI.
Parameters:
  uriString - the string to be parsed into a URI
Parameters:
  encoded - Flag indicating whether the string isalready encoded.



MutableURI
public MutableURI(String scheme, String userInfo, String host, int port, String path, String query, String fragment)(Code)
Constructs a MutableURI. Assumes the individual components are already encoded and escaped.
Parameters:
  scheme - the name of the protocol to use
Parameters:
  userInfo - the username and password
Parameters:
  host - the name of the host
Parameters:
  port - the port number on the host
Parameters:
  path - the file on the host
Parameters:
  query - the query part of this URI
Parameters:
  fragment - the fragment part of this URI (internal reference in the URL)



MutableURI
public MutableURI(URI uri)(Code)
Constructs a MutableURI.
Parameters:
  uri - the initial value for this mutable URI



MutableURI
public MutableURI(URL url) throws URISyntaxException(Code)
Constructs a MutableURI.

This is just a convenience constructor that functions the same as MutableURI.MutableURI(URI) constructor with java.net.URL.toURI as the argument.

Note, any URL instance that complies with RFC 2396 can be converted to a URI. However, some URLs that are not strictly in compliance can not be converted to a URI. See java.net.URL


Parameters:
  url - the initial value for this mutable URI
exception:
  URISyntaxException - if this URL is not formatted strictlyto RFC2396 and cannot be converted to a URI.
See Also:   java.net.URL.toURI




Method Detail
addParameter
public void addParameter(String name, String value, boolean encoded)(Code)
Add a parameter for the query string.

If the encoded flag is true then this method assumes that the name and value do not need encoding or are already encoded correctly. Otherwise, it translates the name and value with the character encoding of this URI and adds them to the set of parameters for the query. If the encoding for this URI has not been set, then the default encoding used is "UTF-8".

Multiple values for the same parameter can be set by calling this method multiple times with the same name.


Parameters:
  name - name
Parameters:
  value - value
Parameters:
  encoded - Flag indicating whether the names and values arealready encoded.



addParameters
public void addParameters(Map newParams, boolean encoded)(Code)

Adds all the parameters in a Map to a URI's query string.

If the encoded flag is true then this method assumes that the name and value do not need encoding or are already encoded correctly. Otherwise, it translates the name and value with the character encoding of this URI and adds them to the set of parameters for the query. If the encoding for this URI has not been set, then the default encoding used is "UTF-8".

The query parameters are added in the order the keys of the Map.


Parameters:
  newParams - the map of new parameters to add to the URI
Parameters:
  encoded - Flag indicating whether the names and values are already encoded.



encode
public static String encode(String url, String encoding)(Code)
Convenience method to encode unencoded components of a URI.
Parameters:
  url - the string to be encoded by URLCodec
Parameters:
  encoding - the character encoding to use the encoded string



encode
public String encode(String url)(Code)
Convenience method to encode unencoded components of a URI. This implementation uses the value of the character encoding field of this instance.
Parameters:
  url - the string to be encoded by URLCodec the encoded string



encodeURI
protected static URI encodeURI(String original) throws URISyntaxException(Code)
Parse a URI reference, as a String, into its components and use java.net.URI to encode the components correctly. This comes from the parsing algorithm of the Apache Commons HttpClient code for its URI class.
Parameters:
  original - the original character sequence
throws:
  URISyntaxException - If an error occurs.



equals
public boolean equals(Object object)(Code)
Determines if the passed-in Object is equivalent to this MutableURI.
Parameters:
  object - the Object to test for equality. true if object is a MutableURI with all values equal to thisMutableURI, false otherwise



getDefaultContext
public static URIContext getDefaultContext()(Code)
Returns a default URIContext. the URIContext with default data.



getEncoding
public String getEncoding()(Code)
Returns the character encoding that is used when adding unencoded parameters. encoding



getFragment
public String getFragment()(Code)
Returns the fragment. fragment



getHost
public String getHost()(Code)
Returns the host. If no host was previously set, returns null. host



getParameter
public String getParameter(String name)(Code)
Returns the value of the parameter. If several values are associated with the given parameter name, the first value is returned.
Parameters:
  name - a name of the parameter value associated with the given parameter name



getParameters
public List getParameters(String name)(Code)
Returns the values of the given parameter.
Parameters:
  name - name of the parameter an unmodifable java.util.List of values for the given parameter name



getParameters
public Map getParameters()(Code)
Returns an unmodifiable Map of all parameters. an unmodifiable java.util.Map of names and values for all parameters



getPath
public String getPath()(Code)
Returns the path. path



getPort
public int getPort()(Code)
Returns the port. If no port was previously set, returns null. port



getQuery
public String getQuery(URIContext uriContext)(Code)
Returns the query string (encoded/escaped).

The context states whether or not to use the default delimiter, usually the "&" entity, to separate the parameters. Otherwise, the "&" character is used.


Parameters:
  uriContext - has property indicating if we use the HTML Amp entityto separate the query parameters. encoded query string.



getScheme
public String getScheme()(Code)
Returns the protocol/scheme. If no protocol was previously set, returns null. protocol/scheme



getSchemeSpecificPart
public String getSchemeSpecificPart()(Code)
Returns the scheme-specific part of this URI if it is opaque. Otherwise, this method returns null. the scheme-specific part of this URI if this URI wasexplicitly set as opaque. Otherwise, return null.



getURIString
public String getURIString(URIContext uriContext)(Code)
Returns a string form of this URI. The URIContext encapsulates the data needed to write out the string form.

E.g. Defines if the "&" entity or the '&' character should be used to separate quary parameters.


Parameters:
  uriContext - data required to write out the string form. the URI as a String



getUserInfo
public String getUserInfo()(Code)
Returns the userInfo. If no host was previously set, returns null. userInfo



hashCode
public int hashCode()(Code)
Returns a hash code value for the object.

Implemented in conjunction with equals() override.

This is a mutable class implying that we're basing the hash code on the member data that can change. Therefor it's important not to use this class as a key in a hashtable as it would still appear with an enumeration but not when calling contains. I.E. The object could get lost in the hashtable. A call for the hashcode would return a different value than when it was first placed in the hashtable.

With this in mind, we simply return the same value to support the rules of equality.

a hash code value for this object.



indexFirstOf
protected static int indexFirstOf(String s, String delims, int offset)(Code)
Get the earliest index, searching for the first occurrance of any one of the given delimiters.
Parameters:
  s - the string to be indexed
Parameters:
  delims - the delimiters used to index
Parameters:
  offset - the from index the earlier index if there are delimiters



isAbsolute
public boolean isAbsolute()(Code)
Tells whether or not this URI is absolute.

A URI is absolute if, and only if, it has a scheme component.

true if, and only if, this URI is absolute



isOpaque
public boolean isOpaque()(Code)
Tells whether or not this URI is opaque. true if this URI was explicitly set as opaque



removeParameter
public void removeParameter(String name)(Code)
Removes the given parameter.
Parameters:
  name - name



setEncoding
public void setEncoding(String encoding)(Code)
Set the encoding used when adding unencoded parameters.
Parameters:
  encoding -



setFragment
public void setFragment(String fragment)(Code)
Sets the fragment.
Parameters:
  fragment - fragment



setHost
public void setHost(String host)(Code)
Sets the host.
Parameters:
  host - host



setOpaque
public void setOpaque(String scheme, String schemeSpecificPart)(Code)
Sets the URI to be opaque using the given scheme and schemeSpecificPart.

From URI : "A URI is opaque if, and only if, it is absolute and its scheme-specific part does not begin with a slash character ('/'). An opaque URI has a scheme, a scheme-specific part, and possibly a fragment; all other components are undefined."


Parameters:
  scheme - the scheme component of this URI
Parameters:
  schemeSpecificPart - the scheme-specific part of this URI



setPath
public void setPath(String path)(Code)
Sets the path. Assumes this component is already escaped.
Parameters:
  path - path



setPort
public void setPort(int port)(Code)
Sets the port.
Parameters:
  port - port



setQuery
public void setQuery(String query)(Code)
Sets (and resets) the query string. This method assumes that the query is already encoded and escaped.
Parameters:
  query - Query string



setScheme
public void setScheme(String scheme)(Code)
Sets the protocol/scheme.
Parameters:
  scheme - protocol/scheme



setSchemeSpecificPart
protected void setSchemeSpecificPart(String schemeSpecificPart)(Code)
Set the scheme-specific part of this (opaque) URI
Parameters:
  schemeSpecificPart - the scheme-specific part of this URI



setURI
public void setURI(String uriString, boolean encoded) throws URISyntaxException(Code)
Set the value of the MutableURI.

This method can also be used to clear the MutableURI.


Parameters:
  uriString - the string to be parsed into a URI
Parameters:
  encoded - Flag indicating whether the string isalready encoded.



setURI
public void setURI(URI uri)(Code)
Set the value of the MutableURI.

This method can also be used to clear the MutableURI.


Parameters:
  uri - the URI



setUserInfo
public void setUserInfo(String userInfo)(Code)
Sets the userInfo. Assumes this component is already escaped.
Parameters:
  userInfo - userInfo



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.