Java Doc for Template.java in  » Web-Services » restlet-1.0.8 » org » restlet » 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 » Web Services » restlet 1.0.8 » org.restlet.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.restlet.util.Template

Template
public class Template (Code)
String template with a model is based on a request. Supports both formatting and parsing. The template variables can be inserted using the "{name}" syntax and described using the modifiable map of variable descriptors. When no descriptor is found for a given variable, the template logic uses its default variable property initialized using the default Variable constructor.
Model property Variable name Content type
request.confidential c boolean (true|false)
request.clientInfo.address cia String
request.clientInfo.agent cig String
request.challengeResponse.identifier cri String
request.challengeResponse.scheme crs String
request.entity.characterSet ecs String
response.entity.characterSet ECS String
request.entity.encoding ee String
response.entity.encoding EE String
request.entity.expirationDate eed Date (HTTP format)
response.entity.expirationDate EED Date (HTTP format)
request.entity.language el String
response.entity.language EL String
request.entity.modificationDate emd Date (HTTP format)
response.entity.modificationDate EMD Date (HTTP format)
request.entity.mediaType emt String
response.entity.mediaType EMT String
request.entity.size es Integer
response.entity.size ES Integer
request.entity.tag et String
response.entity.tag ET String
request.referrerRef f* Reference (see table below variable name sub-parts)
request.hostRef h* Reference (see table below variable name sub-parts)
request.method m String
request.rootRef o* Reference (see table below variable name sub-parts)
request.protocol p String
request.resourceRef r* Reference (see table below variable name sub-parts)
response.redirectRef R* Reference (see table below variable name sub-parts)
response.status S Integer
response.serverInfo.address SIA String
response.serverInfo.agent SIG String
response.serverInfo.port SIP Integer

Below is the list of name sub-parts, for Reference variables, that can replace the asterix in the variable names above:

Reference property Sub-part name Content type
authority a String
baseRef b* Reference
relativePart e String
fragment f String
hostIdentifier h String
identifier i String
path p String
query q String
remainingPart r String

See Also:    URI Template * specification
author:
   Jerome Louvel (contact@noelios.com)


Field Summary
final public static  intMODE_EQUALS
    
final public static  intMODE_STARTS_WITH
    

Constructor Summary
public  Template(Logger logger, String pattern)
     Default constructor.
public  Template(Logger logger, String pattern, int matchingMode)
     Constructor.
public  Template(Logger logger, String pattern, int matchingMode, int defaultType, String defaultDefaultValue, boolean defaultRequired, boolean defaultFixed)
     Constructor.

Method Summary
public  Stringformat(Request request, Response response)
     Creates a formatted string based on the given request.
Parameters:
  request - The request to use as a model.
Parameters:
  response - The response to use as a model.
public  Stringformat(Map<String, Object> variables)
     Creates a formatted string based on the given request.
Parameters:
  variables - The variables to use when formatting.
public  VariablegetDefaultVariable()
     Returns the default variable.
public  LoggergetLogger()
     Returns the logger to use.
public  intgetMatchingMode()
     Returns the matching mode to use when parsing a formatted reference.
public  StringgetPattern()
     Returns the pattern to use for formatting or parsing.
public  Map<String, Variable>getVariables()
     Returns the modifiable map of variables.
public  intmatch(String formattedString)
     Indicates if the current pattern matches the given formatted string.
Parameters:
  formattedString - The formatted string to match.
public  intparse(String formattedString, Request request)
     Attempts to parse a formatted reference.
public  intparse(String formattedString, Map<String, Object> variables)
     Attempts to parse a formatted reference.
public  voidsetMatchingMode(int matchingMode)
     Sets the matching mode to use when parsing a formatted reference.
public  voidsetPattern(String pattern)
     Sets the pattern to use for formatting or parsing.

Field Detail
MODE_EQUALS
final public static int MODE_EQUALS(Code)



MODE_STARTS_WITH
final public static int MODE_STARTS_WITH(Code)




Constructor Detail
Template
public Template(Logger logger, String pattern)(Code)
Default constructor. Each variable matches any sequence of characters by default. When parsing, the template will attempt to match the whole template. When formatting, the variable are replaced by an empty string if they don't exist in the model.
Parameters:
  logger - The logger to use.
Parameters:
  pattern - The pattern to use for formatting or parsing.



Template
public Template(Logger logger, String pattern, int matchingMode)(Code)
Constructor.
Parameters:
  logger - The logger to use.
Parameters:
  pattern - The pattern to use for formatting or parsing.
Parameters:
  matchingMode - The matching mode to use when parsing a formattedreference.



Template
public Template(Logger logger, String pattern, int matchingMode, int defaultType, String defaultDefaultValue, boolean defaultRequired, boolean defaultFixed)(Code)
Constructor.
Parameters:
  logger - The logger to use.
Parameters:
  pattern - The pattern to use for formatting or parsing.
Parameters:
  matchingMode - The matching mode to use when parsing a formattedreference.
Parameters:
  defaultType - The default type of variables with no descriptor.
Parameters:
  defaultDefaultValue - The default value for null variables with no descriptor.
Parameters:
  defaultRequired - The default required flag for variables with nodescriptor.
Parameters:
  defaultFixed - The default fixed value for variables with no descriptor.




Method Detail
format
public String format(Request request, Response response)(Code)
Creates a formatted string based on the given request.
Parameters:
  request - The request to use as a model.
Parameters:
  response - The response to use as a model. The formatted string.



format
public String format(Map<String, Object> variables)(Code)
Creates a formatted string based on the given request.
Parameters:
  variables - The variables to use when formatting. The formatted string.



getDefaultVariable
public Variable getDefaultVariable()(Code)
Returns the default variable. The default variable.



getLogger
public Logger getLogger()(Code)
Returns the logger to use. The logger to use.



getMatchingMode
public int getMatchingMode()(Code)
Returns the matching mode to use when parsing a formatted reference. The matching mode to use when parsing a formatted reference.



getPattern
public String getPattern()(Code)
Returns the pattern to use for formatting or parsing. The pattern to use for formatting or parsing.



getVariables
public Map<String, Variable> getVariables()(Code)
Returns the modifiable map of variables. The modifiable map of variables.



match
public int match(String formattedString)(Code)
Indicates if the current pattern matches the given formatted string.
Parameters:
  formattedString - The formatted string to match. The number of matched characters or -1 if the match failed.



parse
public int parse(String formattedString, Request request)(Code)
Attempts to parse a formatted reference. If the parsing succeeds, the given request's attributes are updated.
Note that the values parsed are directly extracted from the formatted reference and are therefore not percent-decoded.
See Also:   Reference.decode(String)
Parameters:
  formattedString - The string to parse.
Parameters:
  request - The request to update. The number of matched characters or -1 if no character matched.



parse
public int parse(String formattedString, Map<String, Object> variables)(Code)
Attempts to parse a formatted reference. If the parsing succeeds, the given request's attributes are updated.
Note that the values parsed are directly extracted from the formatted reference and are therefore not percent-decoded.
See Also:   Reference.decode(String)
Parameters:
  formattedString - The string to parse.
Parameters:
  variables - The map of variables to update. The number of matched characters or -1 if no character matched.



setMatchingMode
public void setMatchingMode(int matchingMode)(Code)
Sets the matching mode to use when parsing a formatted reference.
Parameters:
  matchingMode - The matching mode to use when parsing a formattedreference.



setPattern
public void setPattern(String pattern)(Code)
Sets the pattern to use for formatting or parsing.
Parameters:
  pattern - The pattern to use for formatting or parsing.



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.