Java Doc for HttpScriptContext.java in  » Scripting » beanshell » javax » script » http » 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 » Scripting » beanshell » javax.script.http 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.script.http.HttpScriptContext

All known Subclasses:   javax.script.http.SimpleHttpScriptContext,
HttpScriptContext
public interface HttpScriptContext extends ScriptContext(Code)
Classes implementing the HttpScriptContext interface connect a ScriptEngine with the implicit objects from a Servlet Container.

The interface contains methods that allow a HttpScriptServlet to initialize the HttpScriptContext with the implicit objects for each request, and methods that allow a ScriptEngine to access them.

The objects may be used by internal constructs related to the web environment in the scripting languages, and are also generally exposed in the namespaces of scripts executing in the engines.



Field Summary
final public static  intAPPLICATION_SCOPE
     ApplicationScope attributes are visible during the processing of all requests belonging to a single Web Application.
final public static  intREQUEST_SCOPE
     RequestScope attributes are visible during the processing of a single request.
final public static  intSESSION_SCOPE
     SessionScope attributes are visible during the processing of all requests belonging to a single HttpSession during the lifetime of the session.


Method Summary
public  booleandisableScript()
     Return value indicates whether script execution has been disabled in the Web Application.
public  booleandisplayResults()
     Return value indicates whether a HttpScriptServlet executing in this context should display the results of script evaluations.

If true, the servlet should display the toString of the value returned by script execution using the Writer returned by the getWriter method.

The value is determined by the script-display-results initialization parameter. true unless the value of the script-display-results initialization parameter is "false".

public  voidforward(String relativePath)
     Forward the request to the resource identified by the specified relative path.
Parameters:
  relativePath - The URI to process the request.
public  String[]getAllowedLanguages()
     An array of Strings naming the languages that may be used by scripts running in this HttpScriptContext.
public  ObjectgetAttribute(String name, int scope)
     Gets the value of the attribute in the specified scope.
public  ObjectgetAttribute(String name)
     Returns the value of the attribute in the lowest scope for which the attribute is defined.
public  String[]getMethods()
     An array of Strings describing the HTTP request methods handled by HttpScriptServlets executing in this context.
public  HttpServletRequestgetRequest()
     Returns the HttpServoetRequest for the current request.
public  HttpServletResponsegetResponse()
     Returns the HttpServletResponse for the current request.
public  ReadergetScriptSource()
     Returns a Reader from which the source of the script used to execute the current request can be read.
public  ServletgetServlet()
     Returns the HttpScriptServlet using the HttpScriptContext.
public  voidinclude(String relativePath)
     Includes the resource identified by the specified relative path.
Parameters:
  relativePath - The URI to process the request.
public  voidinitialize(Servlet servlet, HttpServletRequest req, HttpServletResponse res)
     Initializes this HttpScriptContext for processing of a single request.
public  voidrelease()
     Clears any state stored in this HttpScriptContext, allowing its reuse by other requests.
public  voidsetAttribute(String name, Object value, int scope)
     Sets the value of the named attribute in the specified scope.
public  booleanuseSession()
     Return value indicates whether the HttpSession associated with the current request is exposed in the SESSION_SCOPE attributes and in the HttpScriptRequest returned by getRequest. This is determined by the value of the script-use-session Web Application initialization parameter. true unless the value of the script-use-session parameter is "false".

Field Detail
APPLICATION_SCOPE
final public static int APPLICATION_SCOPE(Code)
ApplicationScope attributes are visible during the processing of all requests belonging to a single Web Application.



REQUEST_SCOPE
final public static int REQUEST_SCOPE(Code)
RequestScope attributes are visible during the processing of a single request.



SESSION_SCOPE
final public static int SESSION_SCOPE(Code)
SessionScope attributes are visible during the processing of all requests belonging to a single HttpSession during the lifetime of the session.





Method Detail
disableScript
public boolean disableScript()(Code)
Return value indicates whether script execution has been disabled in the Web Application. This is determined by the value of the application's initialization parameter script-disable. false unless the value of that parameter is "true". Returns true in that case.



displayResults
public boolean displayResults()(Code)
Return value indicates whether a HttpScriptServlet executing in this context should display the results of script evaluations.

If true, the servlet should display the toString of the value returned by script execution using the Writer returned by the getWriter method.

The value is determined by the script-display-results initialization parameter. true unless the value of the script-display-results initialization parameter is "false". Returns false in that case.




forward
public void forward(String relativePath) throws ServletException, IOException(Code)
Forward the request to the resource identified by the specified relative path.
Parameters:
  relativePath - The URI to process the request. The path is resolved according to the rules specified in the forward method of javax.servlet.jsp.PageContext.
throws:
  ServletException -



getAllowedLanguages
public String[] getAllowedLanguages()(Code)
An array of Strings naming the languages that may be used by scripts running in this HttpScriptContext. The value is obtained from the allow-languages initialization parameter. A return value of null indicates that there is no restriction on script language. An array of allowed script languages.



getAttribute
public Object getAttribute(String name, int scope)(Code)
Gets the value of the attribute in the specified scope. Initially, the REQUEST_SCOPE, SESSION_SCOPE and APPLICATION_SCOPE should be initialized using the values of the request attributes, session attributes and context attributes associated with the current request. Also, the following mappings should be included in the initial values of the REQUEST_SCOPE attributes:

NameValue
Requestreturn value of getRequest
Responsereturn value of getResponse
Servletreturn value of getServlet


Attempts to access SESSION_SCOPE attributes should return null if useSession returns false or if the current session is invalid.
Parameters:
  name - The name of the attribute to get
Parameters:
  scope - The scope used to find the attribute the value of the attribute.
throws:
  IllegalArgumentException - if scope is invalid.



getAttribute
public Object getAttribute(String name)(Code)
Returns the value of the attribute in the lowest scope for which the attribute is defined. Return null if an attribute with the given name is not defined in any scope.



getMethods
public String[] getMethods()(Code)
An array of Strings describing the HTTP request methods handled by HttpScriptServlets executing in this context. The value is determined by the value of the script-methods Web Application initialization parameter. An array of (case-insensitive) method names. The elements of the array are determined by the script-methods initialization parameter, which is a comma-delimited list of the names.



getRequest
public HttpServletRequest getRequest()(Code)
Returns the HttpServoetRequest for the current request. If the use of session state is disabled using the script-use-session initialization parameter, an adapter whose getSession method returns null must be returned. The current request



getResponse
public HttpServletResponse getResponse()(Code)
Returns the HttpServletResponse for the current request. The current response



getScriptSource
public Reader getScriptSource()(Code)
Returns a Reader from which the source of the script used to execute the current request can be read. This may be obtained from a resource in the current Web Application whose name is derived from the URI of the current request, a script directory in the filesystem specified in the configuration of the Web Application or in some implementation-defined way.



getServlet
public Servlet getServlet()(Code)
Returns the HttpScriptServlet using the HttpScriptContext. The current servlet



include
public void include(String relativePath) throws ServletException, IOException(Code)
Includes the resource identified by the specified relative path.
Parameters:
  relativePath - The URI to process the request. The path is resolved according to the rules specified in the include method of javax.servlet.jsp.PageContext.
throws:
  ServletException -



initialize
public void initialize(Servlet servlet, HttpServletRequest req, HttpServletResponse res) throws ServletException(Code)
Initializes this HttpScriptContext for processing of a single request. Implementations must initialize attributes in REQUEST_SCOPE, SESSION_SCOPE and APPLICATION_SCOPE and store servlet, request and response references for use by the ScriptEngine executing the request.
Parameters:
  servlet - The HttpScriptServlet executing the request
Parameters:
  req - The current request.
Parameters:
  res - The current response.
throws:
  ServletException - If a ScriptExcepton is thrown by the ScriptEngineduring the processing of a request.



release
public void release()(Code)
Clears any state stored in this HttpScriptContext, allowing its reuse by other requests.



setAttribute
public void setAttribute(String name, Object value, int scope)(Code)
Sets the value of the named attribute in the specified scope. Calls using REQUEST_SCOPE, SESSION_SCOPE and APPLICATION_SCOPE should set the corresponding request attribute, session attribute or context attribute for the current request.
Parameters:
  name - The name of the attribute to set.
Parameters:
  value - The value of the attribute to set.
Parameters:
  scope - The scope in which to set the attribute.
throws:
  IllegalArgumentException - if scope is invalid.
throws:
  IllegalStateException - if scope is SESSION_SCOPEand session is either invalid or disabled according to the returnvalue of useSession.



useSession
public boolean useSession()(Code)
Return value indicates whether the HttpSession associated with the current request is exposed in the SESSION_SCOPE attributes and in the HttpScriptRequest returned by getRequest. This is determined by the value of the script-use-session Web Application initialization parameter. true unless the value of the script-use-session parameter is "false". Returns false in that case.



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