Java Doc for DesktopServlet.java in  » Portal » Open-Portal » com » sun » portal » desktop » 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 » Portal » Open Portal » com.sun.portal.desktop 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.servlet.http.HttpServlet
   com.sun.portal.desktop.DesktopServlet

DesktopServlet
public class DesktopServlet extends HttpServlet implements ProviderEditTypes(Code)
The Desktop Servlet is a router of request. It catches request for content and processing and passes them on to the specific provider object.

Desktop Servlet understands several actions. Every action has an associated channel name to perform the action on. Actions understood by the Desktop servlet are:

  • content - get the named channel's main content
  • edit - get the named channel's edit content
  • process - allow the named channel to process form data
  • logout - end the user session

Actions are passed to the servlet via GET or POST parameters. The associated channel name is also passed as a parameter. For example, to perform the content action on the channel name foo, pass in the following parameters to the servlet:

[url to servlet]?action=content&provider=foo

The content, edit, and process actions map directly to method calls into the Provider API (PAPI). For example, for an action equal to process and a channel name equal to foo, the Desktop servlet will get a handle to the provider object associated with the channel name foo, and call the Provider.processEdit() method.

For such desktop actions that map to PAPI method calls, the servlet passes an HTTP request and response object to the respective Provider method. These objects are not the same objects passed into the servlet. The request and response objects passed to provider objects from the servlet are wrappers around the original request and response passed into the servlet. This is because there is certain functionality that is available from request and response objects that is not applicable to a provider. See the Javadocs for the class Provider for more information.

The HTTP parameters in the original request object are processed before they are copied to the "wrapper" servlet request and response objects. As part of this processing, the parameters are decoded from the character set encoding used to represent the page into Unicode that is used in Java String objects. Therefore, the parameters that are passed to the providers are all stored as Unicode, and the provider does not have to do any decoding of its own related to the character encoding for the page.However, the Unicode Strings passed into a query string have to be encoded by the provider using ProviderContext.encodeURLParameter() method.

The servlet also keeps track of the last top-level container/channel that is accessed. It does it as following:
If the "provider" parameter is absent in the request, the servlet assumes it is equal to the value of the last request where the "action" parameter's value was "content". If there is no such last request, then a default channel is assumed. Specifying the parameter "action=content" causes the servlet to set the last accessed channel name to the value of the "provider" parameter. This can be overriden by additionally specifying the parameter "last" in the request. When set to false, the servlet will not set the last channel to the value of the "provider" parameter. If not specified, the default setting is "last=true", and the last accessed channel is set to the value of the "provider" parameter. Note: This only applies when the "action" parameter is equal to "content"; the last accessed channel is only set when the "action" parameter is equal to "content".

Various scenarios:

  1. <desktopURL> (= <desktopURL>?provider=<default channel>)

    No last accessed channel set. The "provider" parameter is assumed to be the default channel. The last accessed channel is set to the name of the default channel.

  2. <desktopURL> (= <desktopURL>?provider=<last acccessed channel>)

    The "provider" parameter is absent, so it is assumed to be the value of the last accecssed channel set in step #1.

  3. <desktopURL>?action=content&provider=foo

    The last accessed channel is set to foo.

  4. <desktopURL>

    The "provider" parameter is absent, so it is assumed to be the value of the last accessed channel set in step #3 (foo).

  5. <desktopURL>?action=edit&provider=bar

    Last accessed channel is NOT set to bar, since the "action" was "edit".

  6. <desktopURL>?action=process OR <desktopURL>?action=edit

    Invalid, must specify a "provider" parameter. Default or last accessed channel is not assumed when "action" equals "edit" or "process".

This class also creates a single instance of error provider object, that is used by all the providers. Whenever a provider throws an exception it is populated all the way up to the DesktopServlet which in turn invokes the error provider which displays a generic error template. The stack trace can also be viewed by looking at the source of the error template (it is defined as a markup but commented out so that it does not appear on the browser).


See Also:   com.sun.portal.providers.Provider




Method Summary
public  voiddestroy()
    
public  voiddoGet(HttpServletRequest req, HttpServletResponse res)
    
public  voiddoPost(HttpServletRequest req, HttpServletResponse res)
    
protected static  StringgetCharset(HttpServletRequest req)
    
protected  DesktopContextgetDesktopContext(HttpServletRequest req)
    
protected static  DesktopContextFactorygetDesktopContextFactory(ServletConfig sc)
    
public  voidhandleCommunity(HttpServletRequest request, HttpServletResponse response)
    
public  voidinit(ServletConfig config)
    
public static  voidprintConfigAttributes(ServletContext sc)
    
protected  voidservice(HttpServletRequest req, HttpServletResponse res)
     Overriden to check for valid session.
protected static  voidsetCacheHeaders(HttpServletResponse res)
    



Method Detail
destroy
public void destroy()(Code)



doGet
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException(Code)



doPost
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException(Code)



getCharset
protected static String getCharset(HttpServletRequest req)(Code)



getDesktopContext
protected DesktopContext getDesktopContext(HttpServletRequest req) throws DesktopException(Code)



getDesktopContextFactory
protected static DesktopContextFactory getDesktopContextFactory(ServletConfig sc)(Code)



handleCommunity
public void handleCommunity(HttpServletRequest request, HttpServletResponse response) throws DesktopException, IOException, ServletException(Code)
handle community access - set default community provider type if not specified - go to the named community, or to the community home page if community is "" - redirect to login page if user is not logged in and is trying to access a named community



init
public void init(ServletConfig config) throws ServletException(Code)



printConfigAttributes
public static void printConfigAttributes(ServletContext sc)(Code)



service
protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException(Code)
Overriden to check for valid session.



setCacheHeaders
protected static void setCacheHeaders(HttpServletResponse res)(Code)



Methods inherited from javax.servlet.http.HttpServlet
protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc)
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc)
protected void doHead(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc)
protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc)
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc)
protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc)
protected void doTrace(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc)
protected long getLastModified(HttpServletRequest req)(Code)(Java Doc)
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc)
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException(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.