Java Doc for TemplateLink.java in  » Web-Framework » TURBINE » org » apache » turbine » services » pull » tools » 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 Framework » TURBINE » org.apache.turbine.services.pull.tools 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.turbine.services.pull.tools.TemplateLink

TemplateLink
public class TemplateLink implements ApplicationTool(Code)
This is a pull to to be used in Templates to convert links in Templates into the correct references. The pull service might insert this tool into the Context. in templates. Here's an example of its Velocity use:

$link.setPage("index.vm").addPathInfo("hello","world") This would return: http://foo.com/Turbine/template/index.vm/hello/world

This is an application pull tool for the template system. You should not use it in a normal application!
author:
   Dave Bryson
author:
   Jon S. Stevens
author:
   Henning P. Schmiedehausen
author:
   Quinton McCombs
version:
   $Id: TemplateLink.java 544066 2007-06-04 06:21:13Z hoffmann $



Field Summary
final public static  StringTEMPLATE_LINK_PREFIX
    
final public static  booleanTEMPLATE_LINK_RELATIVE_DEFAULT
    
final public static  StringTEMPLATE_LINK_RELATIVE_KEY
     Should this tool return relative URIs or absolute? Default: Absolute.
protected  TemplateURItemplateURI
    
 booleanwantRelative
    

Constructor Summary
public  TemplateLink()
     Default constructor

The init method must be called before use.


Method Summary
public  TemplateLinkaddPathInfo(ParameterParser pp)
     Adds a name=value pair for every entry in a ParameterParser object to the path_info string.
Parameters:
  pp - A ParameterParser.
public  TemplateLinkaddPathInfo(String name, Object value)
     Adds a name=value pair to the path_info string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - An Object with the value to add.
public  TemplateLinkaddPathInfo(String name, String value)
     Adds a name=value pair to the path_info string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - A String with the value to add.
public  TemplateLinkaddPathInfo(String name, double value)
     Adds a name=value pair to the path_info string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - A double with the value to add.
public  TemplateLinkaddPathInfo(String name, int value)
     Adds a name=value pair to the path_info string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - An int with the value to add.
public  TemplateLinkaddPathInfo(String name, long value)
     Adds a name=value pair to the path_info string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - A long with the value to add.
public  TemplateLinkaddQueryData(String name, Object value)
     Adds a name=value pair to the query string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - An Object with the value to add.
public  TemplateLinkaddQueryData(String name, String value)
     Adds a name=value pair to the query string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - A String with the value to add.
public  TemplateLinkaddQueryData(String name, double value)
     Adds a name=value pair to the query string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - A double with the value to add.
public  TemplateLinkaddQueryData(String name, int value)
     Adds a name=value pair to the query string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - An int with the value to add.
public  TemplateLinkaddQueryData(String name, long value)
     Adds a name=value pair to the query string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - A long with the value to add.
public  TemplateLinkaddQueryData(ParameterParser pp)
     Adds a name=value pair for every entry in a ParameterParser object to the query string.
Parameters:
  pp - A ParameterParser.
public  StringgetAbsoluteLink()
     Builds the URL with all of the data URL-encoded as well as encoded using HttpServletResponse.encodeUrl().
public  StringgetAbsoluteURI()
     Returns the absolute URI leaving the source intact.
public  StringgetLink()
     Returns the URI.
public  StringgetPage()
     Gets the template variable used by the Template Service.
public  StringgetReference()
     Returns the current reference anchor.
public  StringgetRelativeLink()
     Builds the URL with all of the data URL-encoded as well as encoded using HttpServletResponse.encodeUrl().
public  StringgetRelativeURI()
     Returns the relative URI leaving the source intact.
public  StringgetURI()
     Returns the relative URI leaving the source intact.
public  voidinit(Object data)
     This will initialise a TemplateLink object that was constructed with the default constructor (ApplicationTool method).
public  voidrefresh()
    
public  TemplateLinkremovePathInfo()
     Removes all the path info elements.
public  TemplateLinkremovePathInfo(String name)
     Removes a name=value pair from the path info.
Parameters:
  name - A String with the name to be removed.
public  TemplateLinkremoveQueryData()
     Removes all the query string elements.
public  TemplateLinkremoveQueryData(String name)
     Removes a name=value pair from the query string.
Parameters:
  name - A String with the name to be removed.
public  TemplateLinksetAction(String action)
     Sets the action= value for this URL. By default it adds the information to the path_info instead of the query data.
Parameters:
  action - A String with the action value.
public  TemplateLinksetActionEvent(String action, String event)
     Sets the action= and eventSubmit= values for this URL. By default it adds the information to the path_info instead of the query data.
Parameters:
  action - A String with the action value.
Parameters:
  event - A string with the event name.
public  TemplateLinksetEncodeURLOff()
     This will turn off the execution of res.encodeURL() by making res == null.
public  TemplateLinksetEvent(String action)
     Sets the eventSubmit_= value for this URL. By default it adds the information to the path_info instead of the query data.
Parameters:
  action - A String with the event value.
public  TemplateLinksetPage(String template)
     Sets the template variable used by the Template Service.
Parameters:
  template - A String with the template name.
public  TemplateLinksetReference(String reference)
     Sets a reference anchor (#ref).
Parameters:
  reference - A String containing the reference.
public  TemplateLinksetScreen(String screen)
     Sets the screen= value for this URL. By default it adds the information to the path_info instead of the query data.
Parameters:
  screen - A String with the screen value.
public  StringtoString()
     Same as getLink().

Field Detail
TEMPLATE_LINK_PREFIX
final public static String TEMPLATE_LINK_PREFIX(Code)
Prefix for Parameters for this tool



TEMPLATE_LINK_RELATIVE_DEFAULT
final public static boolean TEMPLATE_LINK_RELATIVE_DEFAULT(Code)
Default Value for TEMPLATE_LINK_RELATIVE_KEY



TEMPLATE_LINK_RELATIVE_KEY
final public static String TEMPLATE_LINK_RELATIVE_KEY(Code)
Should this tool return relative URIs or absolute? Default: Absolute.



templateURI
protected TemplateURI templateURI(Code)
TemplateURI used as backend for this object



wantRelative
boolean wantRelative(Code)
Do we want a relative link?




Constructor Detail
TemplateLink
public TemplateLink()(Code)
Default constructor

The init method must be called before use.





Method Detail
addPathInfo
public TemplateLink addPathInfo(ParameterParser pp)(Code)
Adds a name=value pair for every entry in a ParameterParser object to the path_info string.
Parameters:
  pp - A ParameterParser. A TemplateLink (self).



addPathInfo
public TemplateLink addPathInfo(String name, Object value)(Code)
Adds a name=value pair to the path_info string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - An Object with the value to add. A TemplateLink (self).



addPathInfo
public TemplateLink addPathInfo(String name, String value)(Code)
Adds a name=value pair to the path_info string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - A String with the value to add. A TemplateLink (self).



addPathInfo
public TemplateLink addPathInfo(String name, double value)(Code)
Adds a name=value pair to the path_info string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - A double with the value to add. A TemplateLink (self).



addPathInfo
public TemplateLink addPathInfo(String name, int value)(Code)
Adds a name=value pair to the path_info string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - An int with the value to add. A TemplateLink (self).



addPathInfo
public TemplateLink addPathInfo(String name, long value)(Code)
Adds a name=value pair to the path_info string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - A long with the value to add. A TemplateLink (self).



addQueryData
public TemplateLink addQueryData(String name, Object value)(Code)
Adds a name=value pair to the query string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - An Object with the value to add. A TemplateLink (self).



addQueryData
public TemplateLink addQueryData(String name, String value)(Code)
Adds a name=value pair to the query string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - A String with the value to add. A TemplateLink (self).



addQueryData
public TemplateLink addQueryData(String name, double value)(Code)
Adds a name=value pair to the query string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - A double with the value to add. A TemplateLink (self).



addQueryData
public TemplateLink addQueryData(String name, int value)(Code)
Adds a name=value pair to the query string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - An int with the value to add. A TemplateLink (self).



addQueryData
public TemplateLink addQueryData(String name, long value)(Code)
Adds a name=value pair to the query string.
Parameters:
  name - A String with the name to add.
Parameters:
  value - A long with the value to add. A TemplateLink (self).



addQueryData
public TemplateLink addQueryData(ParameterParser pp)(Code)
Adds a name=value pair for every entry in a ParameterParser object to the query string.
Parameters:
  pp - A ParameterParser. A TemplateLink (self).



getAbsoluteLink
public String getAbsoluteLink()(Code)
Builds the URL with all of the data URL-encoded as well as encoded using HttpServletResponse.encodeUrl(). The resulting URL is absolute; it starts with http/https...

 TemplateURI tui = new TemplateURI (data, "UserScreen");
 tui.addPathInfo("user","jon");
 tui.getAbsoluteLink();
 
The above call to absoluteLink() would return the String:

http://www.server.com/servlets/Turbine/screen/UserScreen/user/jon

After rendering the URI, it clears the pathInfo and QueryString portions of the TemplateURI. So you can use the $link reference multiple times on a page and start over with a fresh object every time. A String with the built URL.




getAbsoluteURI
public String getAbsoluteURI()(Code)
Returns the absolute URI leaving the source intact. Use this if you need the path_info and query data multiple times. This is equivalent to $link.AbsoluteLink but does not reset the path_info and query data. A String with the URI in the formhttp://foo.com/Turbine/template/index.wm/hello/world



getLink
public String getLink()(Code)
Returns the URI. After rendering the URI, it clears the pathInfo and QueryString portions of the TemplateURI. A String with the URI in the formhttp://foo.com/Turbine/template/index.wm/hello/world



getPage
public String getPage()(Code)
Gets the template variable used by the Template Service. It is only available after setPage() has been called. The template name.



getReference
public String getReference()(Code)
Returns the current reference anchor. A String containing the reference.



getRelativeLink
public String getRelativeLink()(Code)
Builds the URL with all of the data URL-encoded as well as encoded using HttpServletResponse.encodeUrl(). The resulting URL is relative to the webserver root.

 TemplateURI tui = new TemplateURI (data, "UserScreen");
 tui.addPathInfo("user","jon");
 tui.getRelativeLink();
 
The above call to absoluteLink() would return the String:

/servlets/Turbine/screen/UserScreen/user/jon

After rendering the URI, it clears the pathInfo and QueryString portions of the TemplateURI. So you can use the $link reference multiple times on a page and start over with a fresh object every time. A String with the built URL.




getRelativeURI
public String getRelativeURI()(Code)
Returns the relative URI leaving the source intact. Use this if you need the path_info and query data multiple times. This is equivalent to $link.RelativeLink but does not reset the path_info and query data. A String with the URI in the formhttp://foo.com/Turbine/template/index.wm/hello/world



getURI
public String getURI()(Code)
Returns the relative URI leaving the source intact. Use this if you need the path_info and query data multiple times. This is equivalent to $link.Link or just $link, but does not reset the path_info and query data. A String with the URI in the formhttp://foo.com/Turbine/template/index.wm/hello/world



init
public void init(Object data)(Code)
This will initialise a TemplateLink object that was constructed with the default constructor (ApplicationTool method).
Parameters:
  data - assumed to be a RunData object



refresh
public void refresh()(Code)
Refresh method - does nothing



removePathInfo
public TemplateLink removePathInfo()(Code)
Removes all the path info elements. A TemplateLink (self).



removePathInfo
public TemplateLink removePathInfo(String name)(Code)
Removes a name=value pair from the path info.
Parameters:
  name - A String with the name to be removed. A TemplateLink (self).



removeQueryData
public TemplateLink removeQueryData()(Code)
Removes all the query string elements. A TemplateLink (self).



removeQueryData
public TemplateLink removeQueryData(String name)(Code)
Removes a name=value pair from the query string.
Parameters:
  name - A String with the name to be removed. A TemplateLink (self).



setAction
public TemplateLink setAction(String action)(Code)
Sets the action= value for this URL. By default it adds the information to the path_info instead of the query data.
Parameters:
  action - A String with the action value. A TemplateLink (self).



setActionEvent
public TemplateLink setActionEvent(String action, String event)(Code)
Sets the action= and eventSubmit= values for this URL. By default it adds the information to the path_info instead of the query data.
Parameters:
  action - A String with the action value.
Parameters:
  event - A string with the event name. A TemplateLink (self).



setEncodeURLOff
public TemplateLink setEncodeURLOff()(Code)
This will turn off the execution of res.encodeURL() by making res == null. This is a hack for cases where you don't want to see the session information A TemplateLink (self).



setEvent
public TemplateLink setEvent(String action)(Code)
Sets the eventSubmit_= value for this URL. By default it adds the information to the path_info instead of the query data.
Parameters:
  action - A String with the event value. A TemplateLink (self).



setPage
public TemplateLink setPage(String template)(Code)
Sets the template variable used by the Template Service.
Parameters:
  template - A String with the template name. A TemplateLink.



setReference
public TemplateLink setReference(String reference)(Code)
Sets a reference anchor (#ref).
Parameters:
  reference - A String containing the reference. A TemplateLink (self).



setScreen
public TemplateLink setScreen(String screen)(Code)
Sets the screen= value for this URL. By default it adds the information to the path_info instead of the query data.
Parameters:
  screen - A String with the screen value. A TemplateLink (self).



toString
public String toString()(Code)
Same as getLink(). A String with the URI represented by this object.



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.