Java Doc for RequestUtils.java in  » Web-Framework » struts-1.3.8 » org » apache » struts » 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 Framework » struts 1.3.8 » org.apache.struts.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.struts.util.RequestUtils

RequestUtils
public class RequestUtils (Code)

General purpose utility methods related to processing a servlet request in the Struts controller framework.


version:
   $Rev: 471754 $ $Date: 2006-11-06 08:55:09 -0600 (Mon, 06 Nov 2006) $


Field Summary
protected static  Loglog
    


Method Summary
public static  URLabsoluteURL(HttpServletRequest request, String path)
    
public static  StringactionIdURL(ForwardConfig forward, HttpServletRequest request, ActionServlet servlet)
    

Returns the true path of the destination action if the specified forward is an action-aliased URL.

public static  StringactionIdURL(String originalPath, ModuleConfig moduleConfig, ActionServlet servlet)
    

Returns the true path of the destination action if the specified forward is an action-aliased URL.

public static  StringactionURL(HttpServletRequest request, ActionConfig action, String pattern)
    
public static  ClassapplicationClass(String className)
    
public static  ClassapplicationClass(String className, ClassLoader classLoader)
    
public static  ObjectapplicationInstance(String className)
    

Return a new instance of the specified fully qualified class name, after loading the class from this web application's class loader.

public static  ObjectapplicationInstance(String className, ClassLoader classLoader)
    

Return a new instance of the specified fully qualified class name, after loading the class from this web application's class loader.

public static  ActionFormcreateActionForm(HttpServletRequest request, ActionMapping mapping, ModuleConfig moduleConfig, ActionServlet servlet)
    

Create (if necessary) and return an ActionForm instance appropriate for this request.

public static  ActionFormcreateActionForm(FormBeanConfig config, ActionServlet servlet)
    
public static  StringBuffercreateServerStringBuffer(String scheme, String server, int port)
    
public static  StringBuffercreateServerUriStringBuffer(String scheme, String server, int port, String uri)
    
public static  StringforwardURL(HttpServletRequest request, ForwardConfig forward)
    

Return the context-relative URL that corresponds to the specified ForwardConfig.

public static  StringforwardURL(HttpServletRequest request, ForwardConfig forward, ModuleConfig moduleConfig)
    

Return the context-relative URL that corresponds to the specified ForwardConfig.

public static  StringgetServletMapping(ActionServlet servlet)
    
public static  LocalegetUserLocale(HttpServletRequest request, String locale)
    

Look up and return current user locale, based on the specified parameters.


Parameters:
  request - The request used to lookup the Locale
Parameters:
  locale - Name of the session attribute for our user's Locale.
public static  voidpopulate(Object bean, HttpServletRequest request)
    

Populate the properties of the specified JavaBean from the specified HTTP request, based on matching each parameter name against the corresponding JavaBeans "property setter" methods in the bean's class.

public static  voidpopulate(Object bean, String prefix, String suffix, HttpServletRequest request)
    

Populate the properties of the specified JavaBean from the specified HTTP request, based on matching each parameter name (plus an optional prefix and/or suffix) against the corresponding JavaBeans "property setter" methods in the bean's class.

public static  StringprintableURL(URL url)
    

Compute the printable representation of a URL, leaving off the scheme/host/port part if no host is specified.

public static  StringBufferrequestToServerStringBuffer(HttpServletRequest request)
    

Return StringBuffer representing the scheme, server, and port number of the current request.

public static  StringBufferrequestToServerUriStringBuffer(HttpServletRequest request)
    

Return the string representing the scheme, server, and port number of the current request.

public static  URLrequestURL(HttpServletRequest request)
    

Return the URL representing the current request.

public static  URLserverURL(HttpServletRequest request)
    

Return the URL representing the scheme, server, and port number of the current request.


Field Detail
log
protected static Log log(Code)

Commons Logging instance.






Method Detail
absoluteURL
public static URL absoluteURL(HttpServletRequest request, String path) throws MalformedURLException(Code)

Create and return an absolute URL for the specified context-relative path, based on the server and context information in the specified request.


Parameters:
  request - The servlet request we are processing
Parameters:
  path - The context-relative path (must start with '/') absolute URL based on context-relative path
throws:
  MalformedURLException - if we cannot create an absolute URL



actionIdURL
public static String actionIdURL(ForwardConfig forward, HttpServletRequest request, ActionServlet servlet)(Code)

Returns the true path of the destination action if the specified forward is an action-aliased URL. This method version forms the URL based on the current request; selecting the current module if the forward does not explicitly contain a module path.


Parameters:
  forward - the forward config
Parameters:
  request - the current request
Parameters:
  servlet - the servlet handling the current request the context-relative URL of the action if the forward has an action identifier; otherwise null.
since:
   Struts 1.3.6



actionIdURL
public static String actionIdURL(String originalPath, ModuleConfig moduleConfig, ActionServlet servlet)(Code)

Returns the true path of the destination action if the specified forward is an action-aliased URL. This method version forms the URL based on the specified module.
Parameters:
  originalPath - the action-aliased path
Parameters:
  moduleConfig - the module config for this request
Parameters:
  servlet - the servlet handling the current request the context-relative URL of the action if the path has an action identifier; otherwise null.
since:
   Struts 1.3.6




actionURL
public static String actionURL(HttpServletRequest request, ActionConfig action, String pattern)(Code)

Return the context-relative URL that corresponds to the specified ActionConfig , relative to the module associated with the current modules's ModuleConfig .


Parameters:
  request - The servlet request we are processing
Parameters:
  action - ActionConfig to be evaluated
Parameters:
  pattern - URL pattern used to map the controller servlet context-relative URL relative to the module
since:
   Struts 1.1



applicationClass
public static Class applicationClass(String className) throws ClassNotFoundException(Code)

Return the Class object for the specified fully qualified class name, from this web application's class loader.


Parameters:
  className - Fully qualified class name to be loaded Class object
throws:
  ClassNotFoundException - if the class cannot be found



applicationClass
public static Class applicationClass(String className, ClassLoader classLoader) throws ClassNotFoundException(Code)

Return the Class object for the specified fully qualified class name, from this web application's class loader.


Parameters:
  className - Fully qualified class name to be loaded
Parameters:
  classLoader - The desired classloader to use Class object
throws:
  ClassNotFoundException - if the class cannot be found



applicationInstance
public static Object applicationInstance(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException(Code)

Return a new instance of the specified fully qualified class name, after loading the class from this web application's class loader. The specified class MUST have a public zero-arguments constructor.


Parameters:
  className - Fully qualified class name to use new instance of class
throws:
  ClassNotFoundException - if the class cannot be found
throws:
  IllegalAccessException - if the class or its constructor is notaccessible
throws:
  InstantiationException - if this class represents an abstractclass, an interface, an array class, aprimitive type, or void
throws:
  InstantiationException - if this class has no zero-argumentsconstructor



applicationInstance
public static Object applicationInstance(String className, ClassLoader classLoader) throws ClassNotFoundException, IllegalAccessException, InstantiationException(Code)

Return a new instance of the specified fully qualified class name, after loading the class from this web application's class loader. The specified class MUST have a public zero-arguments constructor.


Parameters:
  className - Fully qualified class name to use
Parameters:
  classLoader - The desired classloader to use new instance of class
throws:
  ClassNotFoundException - if the class cannot be found
throws:
  IllegalAccessException - if the class or its constructor is notaccessible
throws:
  InstantiationException - if this class represents an abstractclass, an interface, an array class, aprimitive type, or void
throws:
  InstantiationException - if this class has no zero-argumentsconstructor



createActionForm
public static ActionForm createActionForm(HttpServletRequest request, ActionMapping mapping, ModuleConfig moduleConfig, ActionServlet servlet)(Code)

Create (if necessary) and return an ActionForm instance appropriate for this request. If no ActionForm instance is required, return null.


Parameters:
  request - The servlet request we are processing
Parameters:
  mapping - The action mapping for this request
Parameters:
  moduleConfig - The configuration for this module
Parameters:
  servlet - The action servlet ActionForm instance associated with this request



createActionForm
public static ActionForm createActionForm(FormBeanConfig config, ActionServlet servlet)(Code)

Create and return an ActionForm instance appropriate to the information in config.

Does not perform any checks to see if an existing ActionForm exists which could be reused.


Parameters:
  config - The configuration for the Form bean which is to becreated.
Parameters:
  servlet - The action servlet ActionForm instance associated with this request



createServerStringBuffer
public static StringBuffer createServerStringBuffer(String scheme, String server, int port)(Code)

Return StringBuffer representing the scheme, server, and port number of the current request.


Parameters:
  scheme - The scheme name to use
Parameters:
  server - The server name to use
Parameters:
  port - The port value to use StringBuffer in the form scheme: server: port
since:
   Struts 1.2.0



createServerUriStringBuffer
public static StringBuffer createServerUriStringBuffer(String scheme, String server, int port, String uri)(Code)

Return StringBuffer representing the scheme, server, and port number of the current request.


Parameters:
  scheme - The scheme name to use
Parameters:
  server - The server name to use
Parameters:
  port - The port value to use
Parameters:
  uri - The uri value to use StringBuffer in the form scheme: server: port
since:
   Struts 1.2.0



forwardURL
public static String forwardURL(HttpServletRequest request, ForwardConfig forward)(Code)

Return the context-relative URL that corresponds to the specified ForwardConfig. The URL is calculated based on the properties of the ForwardConfig instance as follows:

  • If the contextRelative property is set, it is assumed that the path property contains a path that is already context-relative:
    • If the path property value starts with a slash, it is returned unmodified.
    • If the path property value does not start with a slash, a slash is prepended.
  • Acquire the forwardPattern property from the ControllerConfig for the application module used to process this request. If no pattern was configured, default to a pattern of $M$P, which is compatible with the hard-coded mapping behavior in Struts 1.0.
  • Process the acquired forwardPattern, performing the following substitutions:
    • $M - Replaced by the module prefix for the application module processing this request.
    • $P - Replaced by the path property of the specified ForwardConfig , prepended with a slash if it does not start with one.
    • $$ - Replaced by a single dollar sign character.
    • $x (where "x" is any charater not listed above) - Silently omit these two characters from the result value. (This has the side effect of causing all other $+letter combinations to be reserved.)

Parameters:
  request - The servlet request we are processing
Parameters:
  forward - ForwardConfig to be evaluated context-relative URL
since:
   Struts 1.1



forwardURL
public static String forwardURL(HttpServletRequest request, ForwardConfig forward, ModuleConfig moduleConfig)(Code)

Return the context-relative URL that corresponds to the specified ForwardConfig. The URL is calculated based on the properties of the ForwardConfig instance as follows:

  • If the contextRelative property is set, it is assumed that the path property contains a path that is already context-relative:
    • If the path property value starts with a slash, it is returned unmodified.
    • If the path property value does not start with a slash, a slash is prepended.
  • Acquire the forwardPattern property from the ControllerConfig for the application module used to process this request. If no pattern was configured, default to a pattern of $M$P, which is compatible with the hard-coded mapping behavior in Struts 1.0.
  • Process the acquired forwardPattern, performing the following substitutions:
    • $M - Replaced by the module prefix for the application module processing this request.
    • $P - Replaced by the path property of the specified ForwardConfig , prepended with a slash if it does not start with one.
    • $$ - Replaced by a single dollar sign character.
    • $x (where "x" is any charater not listed above) - Silently omit these two characters from the result value. (This has the side effect of causing all other $+letter combinations to be reserved.)

Parameters:
  request - The servlet request we are processing
Parameters:
  forward - ForwardConfig to be evaluated
Parameters:
  moduleConfig - Base forward on this module config. context-relative URL
since:
   Struts 1.2



getServletMapping
public static String getServletMapping(ActionServlet servlet)(Code)

Retrieves the servlet mapping pattern for the specified ActionServlet .

the servlet mapping
See Also:   Globals.SERVLET_KEY
since:
   Struts 1.3.6



getUserLocale
public static Locale getUserLocale(HttpServletRequest request, String locale)(Code)

Look up and return current user locale, based on the specified parameters.


Parameters:
  request - The request used to lookup the Locale
Parameters:
  locale - Name of the session attribute for our user's Locale. Ifthis is null, the default locale key isused for the lookup. current user locale
since:
   Struts 1.2



populate
public static void populate(Object bean, HttpServletRequest request) throws ServletException(Code)

Populate the properties of the specified JavaBean from the specified HTTP request, based on matching each parameter name against the corresponding JavaBeans "property setter" methods in the bean's class. Suitable conversion is done for argument types as described under convert().


Parameters:
  bean - The JavaBean whose properties are to be set
Parameters:
  request - The HTTP request whose parameters are to be used topopulate bean properties
throws:
  ServletException - if an exception is thrown while settingproperty values



populate
public static void populate(Object bean, String prefix, String suffix, HttpServletRequest request) throws ServletException(Code)

Populate the properties of the specified JavaBean from the specified HTTP request, based on matching each parameter name (plus an optional prefix and/or suffix) against the corresponding JavaBeans "property setter" methods in the bean's class. Suitable conversion is done for argument types as described under setProperties.

If you specify a non-null prefix and a non-null suffix, the parameter name must match both conditions for its value(s) to be used in populating bean properties. If the request's content type is "multipart/form-data" and the method is "POST", the HttpServletRequest object will be wrapped in a MultipartRequestWrapper
Parameters:
  bean - The JavaBean whose properties are to be set
Parameters:
  prefix - The prefix (if any) to be prepend to bean property nameswhen looking for matching parameters
Parameters:
  suffix - The suffix (if any) to be appended to bean propertynames when looking for matching parameters
Parameters:
  request - The HTTP request whose parameters are to be used topopulate bean properties
throws:
  ServletException - if an exception is thrown while settingproperty values




printableURL
public static String printableURL(URL url)(Code)

Compute the printable representation of a URL, leaving off the scheme/host/port part if no host is specified. This will typically be the case for URLs that were originally created from relative or context-relative URIs.


Parameters:
  url - URL to render in a printable representation printable representation of a URL



requestToServerStringBuffer
public static StringBuffer requestToServerStringBuffer(HttpServletRequest request)(Code)

Return StringBuffer representing the scheme, server, and port number of the current request. Server-relative URLs can be created by simply appending the server-relative path (starting with '/') to this.


Parameters:
  request - The servlet request we are processing URL representing the scheme, server, and port number of thecurrent request
since:
   Struts 1.2.0



requestToServerUriStringBuffer
public static StringBuffer requestToServerUriStringBuffer(HttpServletRequest request)(Code)

Return the string representing the scheme, server, and port number of the current request. Server-relative URLs can be created by simply appending the server-relative path (starting with '/') to this.


Parameters:
  request - The servlet request we are processing URL representing the scheme, server, and port number of thecurrent request
since:
   Struts 1.2.0



requestURL
public static URL requestURL(HttpServletRequest request) throws MalformedURLException(Code)

Return the URL representing the current request. This is equivalent to HttpServletRequest.getRequestURL in Servlet 2.3.


Parameters:
  request - The servlet request we are processing URL representing the current request
throws:
  MalformedURLException - if a URL cannot be created



serverURL
public static URL serverURL(HttpServletRequest request) throws MalformedURLException(Code)

Return the URL representing the scheme, server, and port number of the current request. Server-relative URLs can be created by simply appending the server-relative path (starting with '/') to this.


Parameters:
  request - The servlet request we are processing URL representing the scheme, server, and port number of thecurrent request
throws:
  MalformedURLException - if a URL cannot be created



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.