Java Doc for ContentHandler.java in  » 6.0-JDK-Modules » j2me » javax » microedition » content » 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 » 6.0 JDK Modules » j2me » javax.microedition.content 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.microedition.content.ContentHandler

All known Subclasses:   com.sun.midp.content.ContentHandlerImpl,
ContentHandler
public interface ContentHandler (Code)
A ContentHandler provides the details of a content handler registration. Each ContentHandler contains the ID, content types, suffixes, actions, and action names. It provides the ID, authority, and application name and version of the content handler. The values are set when the content handler is Registry.register register ed. ContentHandler instances are immutable and thread safe. Content handlers can only be changed by re-registering which returns a new ContentHandler instance. The registered content handlers can be queried using the query methods of Registry .

Content Types

For the purposes of this API, content types are simple opaque strings that are NOT case-sensitive. All comparisons are performed using case-insensitive string comparisons. By convention, the ContentHandler.UNIVERSAL_TYPE UNIVERSAL_TYPE is used to indicate any type. A content handler that can support any type of content should include it as one of types when it is registered. Any application can get the list of universal handlers with a query for the UNIVERSAL_TYPE. Handlers with this type are only returned by Registry.findHandler or Registry.forType if the type requested is equal to UNIVERSAL_TYPE.

The most common content types are MIME types. RFC-2046 defines the Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types. It defines the general structure of the MIME media typing system and defines an initial set of media types. RFC-2048 describes the specific IANA registration procedures for MIME-related facilities. Other strings may be used as content types, but only if the type system semantics are well defined. An example of where the type system semantics are well defined is in the XML messaging schema.

Suffixes

A content handler can declare a set of suffixes that identify content it can handle based on the syntax of a URL. The suffix is a case-insensitive string that includes punctuation, for example ".png". For some URLs and content storage mechanisms, such as file systems, the content type is not readily available. To accommodate this, a mapping can be used to associate URL suffixes with content handlers. The common practice in file systems is to map filename extensions to content types. For example, a file ending in .png can be identified as content type image/png. This mapping is used if the content access mechanism does not support content typing or if the content type is not available from the content. For the http protocol, that supports a mechanism to identify the content type, the suffix matching MUST be used to identify content handlers if the type is not defined for a particular URL. RFC 2396 - Uniform Resource Identifiers (URI): Generic Syntax describes the syntax of URI's and the path component. Suffix matching consists of comparing each of the registered suffixes with the last n characters of the path component of the URL, where n is the length of the suffix. The comparison is case-insensitive and is done using the equivalent of java.lang.String.regionMatches. If multiple suffixes would match, the longest suffix that matches is used.

Actions

Each content handler registers a set of actions it supports. Actions are Java strings representing semantic functions the content handler can perform on every content type and suffix registered. Actions are case-sensitive strings. The set of actions is extensible but applications should choose from the following actions when appropriate: ContentHandler.ACTION_OPEN open , ContentHandler.ACTION_EDIT edit , ContentHandler.ACTION_NEW new , ContentHandler.ACTION_SEND send , ContentHandler.ACTION_SAVE save , ContentHandler.ACTION_EXECUTE execute , ContentHandler.ACTION_SELECT select , ContentHandler.ACTION_INSTALL install , ContentHandler.ACTION_PRINT print , and ContentHandler.ACTION_STOP stop .

The content handler application should provide localized action names for each action. The action names are used by applications that need to present the possible actions to users in locale appropriate terminology. A mapping for each action to action name should be created for each locale using the ActionNameMap.ActionNameMap ActionNameMap.ActionNameMap method. The action name maps for all the locales supported by the content handler MUST be included when the content handler is registered. The attribute Microedition-Handler-<n>-<locale> is used to declare action names in the application packaging.

Locale Strings

A locale string MUST include a language code, and may include a country code and a variant. The values are separated by a delimiter defined by the Java runtime environment. For MIDP, locale strings follow the definition of the system property microedition.locale and the delimiter MUST be a hyphen ("-" = U+002D). The values for the language, country code and variant are not validated.

Application developers should refer to ISO-639-1 for language codes and to ISO-3166-1 for country codes.



Field Summary
final public static  StringACTION_EDIT
     Action to edit the content.
final public static  StringACTION_EXECUTE
     Action to execute the content.
final public static  StringACTION_INSTALL
     Action to install the content on the device.
final public static  StringACTION_NEW
     Action to create new content.
final public static  StringACTION_OPEN
     Action to open content.
final public static  StringACTION_PRINT
     Action to print the content.
final public static  StringACTION_SAVE
     Action to save the content.
final public static  StringACTION_SELECT
     Action to select a value from the content, usually with user input, and return its value.
final public static  StringACTION_SEND
     Action to send the content via email or messaging.
final public  StringACTION_STOP
     Action to request a content handler to stop processing the content identified by the URL, ID, and arguments.
final public static  StringUNIVERSAL_TYPE
     The universal type; a handler supporting this type can handle any type of content.


Method Summary
public  StringgetAction(int index)
     Gets the action supported by the content handler at the specified index. The action returned for each index must be the equal to the action at the same index in the actions array passed to Registry.register Registry.register .
public  intgetActionCount()
     Gets the number of actions supported by the content handler.
public  ActionNameMapgetActionNameMap()
     Gets the mapping of actions to action names for the current locale supported by this content handler.
public  ActionNameMapgetActionNameMap(String locale)
     Gets the mapping of actions to action names for the requested locale supported by this content handler. The locale is matched against the available ActionNameMaps. If a match is found it is used.
public  ActionNameMapgetActionNameMap(int index)
     Gets the ActionNameMap supported by the content handler at the specified index. The ActionNameMap returned for each index must be the equal to the ActionNameMap at the same index in the actionnames array passed to Registry.register Registry.register .
public  intgetActionNameMapCount()
     Gets the number of action name maps supported by the content handler.
public  StringgetAppName()
     Gets the user-friendly application name of this content handler.
public  StringgetAuthority()
     Gets the authority that authenticated this application.
public  StringgetID()
     Gets the content handler application ID.
public  StringgetSuffix(int index)
     Gets the suffix supported by the content handler at the specified index. The suffix returned for each index must be the equal to the suffix at the same index in the suffixes array passed to Registry.register Registry.register .
public  intgetSuffixCount()
     Gets the number of suffixes supported by the content handler.
public  StringgetType(int index)
     Gets the type supported by the content handler at the specified index. The type returned for each index must be the equal to the type at the same index in the types array passed to Registry.register Registry.register .
public  intgetTypeCount()
     Gets the number of types supported by the content handler.
public  StringgetVersion()
     Gets the version of this content handler.
public  booleanhasAction(String action)
     Determines if an action is supported by the content handler.
public  booleanhasSuffix(String suffix)
     Determines if a suffix is supported by the content handler.
public  booleanhasType(String type)
     Determines if a type is supported by the content handler.

Field Detail
ACTION_EDIT
final public static String ACTION_EDIT(Code)
Action to edit the content.



ACTION_EXECUTE
final public static String ACTION_EXECUTE(Code)
Action to execute the content.



ACTION_INSTALL
final public static String ACTION_INSTALL(Code)
Action to install the content on the device.



ACTION_NEW
final public static String ACTION_NEW(Code)
Action to create new content.



ACTION_OPEN
final public static String ACTION_OPEN(Code)
Action to open content.



ACTION_PRINT
final public static String ACTION_PRINT(Code)
Action to print the content.



ACTION_SAVE
final public static String ACTION_SAVE(Code)
Action to save the content.



ACTION_SELECT
final public static String ACTION_SELECT(Code)
Action to select a value from the content, usually with user input, and return its value. For example, if the content were a URL of an address book, then the user would be asked to choose an entry or entries to return. The format of the return value depends on the content handler and the content, but if appropriate it should take the form of a URL.



ACTION_SEND
final public static String ACTION_SEND(Code)
Action to send the content via email or messaging.



ACTION_STOP
final public String ACTION_STOP(Code)
Action to request a content handler to stop processing the content identified by the URL, ID, and arguments. If stopping a previous request, these values should match the corresponding values in that request.



UNIVERSAL_TYPE
final public static String UNIVERSAL_TYPE(Code)
The universal type; a handler supporting this type can handle any type of content.





Method Detail
getAction
public String getAction(int index)(Code)
Gets the action supported by the content handler at the specified index. The action returned for each index must be the equal to the action at the same index in the actions array passed to Registry.register Registry.register .
Parameters:
  index - the index of the action the action at the specified index
exception:
  IndexOutOfBoundsException - if index is less than zero orgreater than or equal to the value of theContentHandler.getActionCount getActionCount method.



getActionCount
public int getActionCount()(Code)
Gets the number of actions supported by the content handler. The number of actions must be equal to the length of the array of actions passed to Registry.register Registry.register . the number of actions



getActionNameMap
public ActionNameMap getActionNameMap()(Code)
Gets the mapping of actions to action names for the current locale supported by this content handler. The behavior is the same as invoking ContentHandler.getActionNameMap getActionNameMap(String) with the current locale. an ActionNameMap; if there is no map available for thecurrent locale or if the locale is null or empty,then it MUST be null



getActionNameMap
public ActionNameMap getActionNameMap(String locale)(Code)
Gets the mapping of actions to action names for the requested locale supported by this content handler. The locale is matched against the available ActionNameMaps. If a match is found it is used. If an exact match is not found, then the locale string is shortened and retried if a delimiter is present. For MIDP, the delimiter is ("-" = U+002D). The locale is shortened by retaining only the characters up to but not including the last occurrence of the delimiter. The shortening and matching is repeated as long as the string contains a delimiter. Effectively, this will try the full locale and then try without the variant and then without the country code, if present.
Parameters:
  locale - for which to find an ActionNameMap;MUST NOT be null an ActionNameMap; if there is no map available for thelocale, then it MUST be null
exception:
  NullPointerException - if the localeis null



getActionNameMap
public ActionNameMap getActionNameMap(int index)(Code)
Gets the ActionNameMap supported by the content handler at the specified index. The ActionNameMap returned for each index must be the equal to the ActionNameMap at the same index in the actionnames array passed to Registry.register Registry.register .
Parameters:
  index - the index of the locale the ActionNameMap at the specified index
exception:
  IndexOutOfBoundsException - if index is less than zero orgreater than or equal to the value of theContentHandler.getActionNameMapCount getActionNameMapCount method.



getActionNameMapCount
public int getActionNameMapCount()(Code)
Gets the number of action name maps supported by the content handler. The number of action name maps must be equal to the length of the array of action name maps passed to Registry.register Registry.register . the number of action name maps



getAppName
public String getAppName()(Code)
Gets the user-friendly application name of this content handler. The value is extracted from the normal installation information about the content handler application. the user-friendly name of the application;it MUST NOT be null



getAuthority
public String getAuthority()(Code)
Gets the authority that authenticated this application. This value MUST be null unless the device has been able to authenticate this application. If non-null, it is the string identifying the authority. The authority is determined by the security mechanisms and policy of the Java runtime environment. For signed MIDP applications, it is the subject of the signing certificate. the authority; may be null



getID
public String getID()(Code)
Gets the content handler application ID. The ID uniquely identifies the content handler with the value provided to the Registry.register register method, if one was supplied, otherwise a unique ID. This information has been authenticated only if getAuthority is non-null. the ID; MUST NOT be null



getSuffix
public String getSuffix(int index)(Code)
Gets the suffix supported by the content handler at the specified index. The suffix returned for each index must be the equal to the suffix at the same index in the suffixes array passed to Registry.register Registry.register .
Parameters:
  index - the index of the suffix the suffix at the specified index
exception:
  IndexOutOfBoundsException - if index is less than zero orgreater than or equal to the value of theContentHandler.getSuffixCount method.



getSuffixCount
public int getSuffixCount()(Code)
Gets the number of suffixes supported by the content handler. The number of suffixes must be equal to the length of the array of suffixes passed to Registry.register Registry.register . the number of suffixes



getType
public String getType(int index)(Code)
Gets the type supported by the content handler at the specified index. The type returned for each index must be the equal to the type at the same index in the types array passed to Registry.register Registry.register .
Parameters:
  index - the index of the type the type at the specified index
exception:
  IndexOutOfBoundsException - if index is less than zero orgreater than or equal to the value of theContentHandler.getTypeCount getTypeCount method.



getTypeCount
public int getTypeCount()(Code)
Gets the number of types supported by the content handler. The number of types must be equal to the length of the array of types passed to Registry.register Registry.register . the number of types



getVersion
public String getVersion()(Code)
Gets the version of this content handler. The value is extracted from the normal installation information about the content handler application. the version of the application;MAY be null



hasAction
public boolean hasAction(String action)(Code)
Determines if an action is supported by the content handler.
Parameters:
  action - the action to check for true if the action is supported;false otherwise
exception:
  NullPointerException - if actionis null



hasSuffix
public boolean hasSuffix(String suffix)(Code)
Determines if a suffix is supported by the content handler.
Parameters:
  suffix - the suffix to check for true if the suffix is supported;false otherwise
exception:
  NullPointerException - if suffixis null



hasType
public boolean hasType(String type)(Code)
Determines if a type is supported by the content handler.
Parameters:
  type - the type to check for true if the type is supported;false otherwise
exception:
  NullPointerException - if typeis null



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