| 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:
- <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.
- <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.
- <desktopURL>?action=content&provider=foo
The last accessed channel is set to foo.
- <desktopURL>
The "provider" parameter is absent, so it is assumed to be the value of the
last accessed channel set in step #3 (foo).
- <desktopURL>?action=edit&provider=bar
Last accessed channel is NOT set to bar, since the "action" was "edit".
- <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 |
destroy | public void destroy()(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)
|
|
|