| com.sun.portal.providers.Provider
All known Subclasses: com.sun.portal.providers.ProviderAdapter, com.sun.portal.providers.error.ErrorProvider, com.sun.portal.providers.compass.CompassProvider, __PACKAGE__.__NAME__,
Provider | public interface Provider (Code) | | Provider defines the interface for
implementing the provider component of a channel.
Desktop channels consist of two major pieces; a provider object
and its runtime configuration.
A provider is the programmatic entity responsible for generating
channels on the desktop. There is not necessarily a one-to-one mapping
between providers and channels; a single provider can generate one or
more channels depending on how it is configured.
A provider must implement this interface. Clients of the provider
interface call these
methods to query information about or to cause an action in the provider.
Such clients include but are not limited to the Desktop servlet and
other channels (container channels).
There are essentially two types of methods in this interface;
- methods that digest and compile markup. This includes
getContent(), getEdit(), and processEdit().
- methods that query information about the content provider. This
includes all methods that begin with get-(minus the get- methods).
The digest and compile type methods are passed in the HTTP request and
response objects associated the HTTP request that caused the method to
be called on the provider object.
The semantics for the digest and compile methods are typically as
follows: getContent() is used to return the channel's default view.
The getEdit() method returns a form that allows the configuration of the
channel to be modified (the "edit" view).
Modifying this configuration will often but
not necessarily affect the default channel view. The processEdit()
method is typically used to process the form generated from the
getEdit() method. Such uses of these methods is not required.
Note: the request and response parameters are not the original
objects that are
passed by the web server to the desktop servlet. Rather, they are wrappers
for those objects. There are certain methods on these objects that are
not allowed from providers. These include:
HttpServletRequest
- getSession(boolean)
- isRequestedSessionIdFromCookie()
- isRequestedSessionIdFromUrl()
- isRequestedSessionIdValid()
- getContentLength()
- getInputStream()
- getReader()
HttpServletResponse
- encodeRedirectUrl(String)
- encodeUrl(String)
- sendError(int)
- sendError(int, String)
- setStatus(int)
- setStatus(int, String)
- getOutputStream()
- getWriter()
- setContentLength(int)
- setContentType(String)
If these methods are called, an UnsupportedOperationException is thrown.
|
Method Summary | |
public StringBuffer | getContent(HttpServletRequest request, HttpServletResponse response) Gets the provider's objects default view.
This method is called by the clients of the provider object
to request the provider's default view.
This method may return null if the provider does not implement a default
view. | public StringBuffer | getContent(Map m) Gets the provider's default view (alternate form).
The adapters for the Provider class (ProfileProviderAdapter and
ProviderAdapter) call this method by default from the other
getContent method. | public String | getDescription() Gets the description of this provider. | public StringBuffer | getEdit(HttpServletRequest request, HttpServletResponse response) Gets the edit view for the provider.
This method is called by the clients of the provider object
to request the provider's edit view. | public StringBuffer | getEdit(Map m) Gets the edit view of the provider (alternate form).
The adapters for the Provider class (ProfileProviderAdapter and
ProviderAdapter) call this method by default from the other
getEdit() method. | public int | getEditType() Gets the edit form type of the provider. | public URL | getHelp(HttpServletRequest req) Gets the help URL for this provider.
The returned help URL can be either fully-qualified URL string
or a relative path. | public String | getName() Gets the name of this provider. | public long | getRefreshTime() Gets the refresh time for this provider, in seconds. | public String | getTitle() Gets the title of this provider. | public int | getWidth() Gets the width of this provider. | public void | init(String name, HttpServletRequest req) Initializes the provider.
This method must be called by clients of the provider object
when the provider object is created (after it is constructed, or
before the object is used). | public boolean | isEditable() This method determines if the provider has an edit view. | public boolean | isPresentable(HttpServletRequest req) Determines if the provider is presentable based on the client device type.
Parameters: request - An HttpServletRequest that containsthe request the client made of the provider. | public boolean | isPresentable() Determines if the provider is presentable based on the client device type. | public URL | processEdit(HttpServletRequest request, HttpServletResponse response) Processes a form for this provider.
This method is called to process form data associated with the
provider. | public URL | processEdit(Map m) Processes the edit form for this provider (alternate form).
The adapters for the Provider class (ProfileProviderAdapter and
ProviderAdapter) call this method by default from the other
processEdit method. |
getContent | public StringBuffer getContent(HttpServletRequest request, HttpServletResponse response) throws ProviderException(Code) | | Gets the provider's objects default view.
This method is called by the clients of the provider object
to request the provider's default view.
This method may return null if the provider does not implement a default
view. In this case, the provider should return false from its
isPresentable() method.
StringBuffer holding the content. Parameters: request - An HttpServletRequest that containsinformation related to this request for content. Parameters: response - An HttpServletResponse that allows the providerto influence the overall response for the desktop page (besides generating the content). exception: ProviderException - If there was an error generating thecontent. How this exception is handled is up to the client of theprovider object. See Also: com.sun.portal.providers.ProviderException |
getContent | public StringBuffer getContent(Map m) throws ProviderException(Code) | | Gets the provider's default view (alternate form).
The adapters for the Provider class (ProfileProviderAdapter and
ProviderAdapter) call this method by default from the other
getContent method. This method preserves backward compatibility for
older providers and it offers a simpler interface than the one
that passes in the request and response.
StringBuffer holding the html content. Parameters: m - A key-value mapping of HTTP parameters passed to the desktopby the requesting browser. exception: ProviderException - If there was an error generating thecontent. how this exception is handled is up to the client of theprovider object. See Also: com.sun.portal.providers.ProviderException |
getEdit | public StringBuffer getEdit(HttpServletRequest request, HttpServletResponse response) throws ProviderException(Code) | | Gets the edit view for the provider.
This method is called by the clients of the provider object
to request the provider's edit view.
This method must generate either a complete document, or a subset,
depending on the return value of .getEditType() .
A subset document should include all code that goes between
the FORM tags. The exception is that the
submit and cancel buttons should not be
generated. A subset document is always submitted back to the
desktop servlet, where control is passed to the provider's
processEdit() method for processing the
form data.
If a complete document is returned,
there are several restrictions:
- It must be a complete, valid form.
- The form must have an encoding type of
"application/x-www-form-urlencoded".
- The form action must point back to the desktop servlet.
Typically, this is "/ps/desktop".
- The form must specify a valid action to the desktop servlet
as defined in the DesktopSerlvet javadocs.
The above restrictions only apply if the form is to be submitted
to the desktop servlet. If the form is submitted to a third-party
CGI or servlet, the format will depend on what this entity is
expecting.
This method may return null if the provider does not implement an edit
view. In this case, the provider should return false from its
isEditable() method.
StringBuffer holding the html edit form. Parameters: request - An HttpServletRequest thatcontains information related to this request for content. Parameters: response - An HttpServletResponse thatallows the provider to influence the overall response for the desktop page (besides generating the content). exception: ProviderException - If there was an error generating theedit form. How this exception is handled is up to the client of theprovider object. See Also: com.sun.portal.providers.Provider.getContent See Also: com.sun.portal.providers.Provider.isEditable See Also: com.sun.portal.providers.Provider.processEdit See Also: com.sun.portal.providers.Provider.getEditType See Also: com.sun.portal.desktop.DesktopServlet See Also: com.sun.portal.providers.ProviderException See Also: |
getEdit | public StringBuffer getEdit(Map m) throws ProviderException(Code) | | Gets the edit view of the provider (alternate form).
The adapters for the Provider class (ProfileProviderAdapter and
ProviderAdapter) call this method by default from the other
getEdit() method. This method preserves backward compatibility for
older providers and it offers a simpler interface than the one
that passes in the request and response.
StringBuffer holding the html edit form. Parameters: m - A key-value mapping of HTTP parameters passed to the desktopby the requesting browser. exception: ProviderException - If there was an error generating theedit form. How this exception is handled is up to the client of theprovider object. |
getHelp | public URL getHelp(HttpServletRequest req) throws ProviderException(Code) | | Gets the help URL for this provider.
The returned help URL can be either fully-qualified URL string
or a relative path. When it is relative path, the desktop software
will prepend the server request string, plus the document root,
plus the user locale to it to resolve the full URL.
A URL pointing to the help page for the provider. A returnvalue of null should signify that this provider does not have ahelp page. |
getName | public String getName()(Code) | | Gets the name of this provider.
The name returned from this method must match the name of the provider
that it was initialized with.
The name of this provider. |
getRefreshTime | public long getRefreshTime() throws ProviderException(Code) | | Gets the refresh time for this provider, in seconds.
Clients of the provider object should use this value to determine
if they should fetch a fresh default view for the provider.
If the return value from this method is X, they may choose to
not fetch fresh content (and use a cached copy instead) if less than
X seconds has elapsed since the last time content was fetched.
If provider content is expected to change very infrequently, this
method can return some value so that the provider's content
is not fetched every time the front page is drawn, thereby
saving significant processing time.
Clients may choose not to use this value.
>0, refresh time in number of seconds that a container shouldwait before expiring a content cache.0, container should never cache channel's content.-1, container may cache channel's content indefinitely. |
init | public void init(String name, HttpServletRequest req) throws ProviderException(Code) | | Initializes the provider.
This method must be called by clients of the provider object
when the provider object is created (after it is constructed, or
before the object is used). This method should not be called more
than once per object.
Parameters: name - Unique name identifying this provider. This valueshould always be returned from getName() . Parameters: req - The HTTP request object corresponding to the HTTP requestthat caused this provider object to be created. This request may beused to extract session or user information that could be used togain access to external resources. exception: ProviderException - If there was an error initializing theprovider. How this exception is handled is up to the client of theprovider object. See Also: com.sun.portal.providers.Provider.getName See Also: |
isPresentable | public boolean isPresentable(HttpServletRequest req)(Code) | | Determines if the provider is presentable based on the client device type.
Parameters: request - An HttpServletRequest that containsthe request the client made of the provider. true or false , indicating if theprovider is presentable to the user's client device. |
isPresentable | public boolean isPresentable()(Code) | | Determines if the provider is presentable based on the client device type.
true or false , indicating if theprovider is presentable to the user's client device. |
processEdit | public URL processEdit(HttpServletRequest request, HttpServletResponse response) throws ProviderException(Code) | | Processes a form for this provider.
This method is called to process form data associated with the
provider. Typically, this method is called to process the edit page
generated from the getEdit() method. Usually, the client calling
this method on a provider object is the desktop servlet.
Form data, passed into this method in the request, has been decoded into
Unicode.
When the desktop servlet receives a request where the action is
"process", it looks at the
parameters to identify which provider will handle the action, through
this method. The request passed in contains the parameters.
After calling this method, the desktop servlet will re-direct to the URL
returned from this method. Therefore, the result of a provider post
can be any desktop serlvet action, or the content of an arbitrary URL.
For more information on constructing desktop serlvet URLs, see
DesktopSerlvet .
The URL that the iPS desktop will re-direct to. A valueof null should indicate to the client that it should return to itsdefault view. Parameters: request - An HttpServletRequest that containsinformation related to thisrequest for content. Parameters: response - An HttpServletResponse that allows theprovider to influence the overall response for the desktop page (besides generating the content). exception: ProviderException - If there was an error processingthe edit form. How this exception is handled is up to the client of theprovider object. The URL that the iPS desktop will re-direct to. A valueof null should indicate to the client that it should return to itsdefault view. See Also: com.sun.portal.providers.Provider.getEdit See Also: com.sun.portal.providers.Provider.isEditable See Also: com.sun.portal.providers.InvalidEditFormDataException See Also: com.sun.portal.desktop.DesktopServlet |
processEdit | public URL processEdit(Map m) throws ProviderException(Code) | | Processes the edit form for this provider (alternate form).
The adapters for the Provider class (ProfileProviderAdapter and
ProviderAdapter) call this method by default from the other
processEdit method. This method preserves backward compatibility for
older providers and it offers a simpler interface than the one
that passes in the request and response.
Parameters: m - A key-value mapping of HTTP parameters passed to the desktopby the requesting browseras returned by the ServletRequest.parsePostData() method.Maps string keys to an array of strings values.For example, to access a parameter named "foo" in the map, do the following: String bob = (String[])m.get("foo")[0]; The URL that the iPS desktop will re-direct to. A valueof null should indicate to the client that it should return to itsdefault view. See Also: com.sun.portal.providers.Provider.getEdit See Also: com.sun.portal.providers.Provider.isEditable See Also: com.sun.portal.providers.InvalidEditFormDataException See Also: com.sun.portal.desktop.DesktopServlet See Also: |
|
|