Package com.dassault_systemes.catweb.base.net.url

   
Class PortalURL

 
Class Hierarchy
java.lang.Object
  |
  +-com.dassault_systemes.catweb.base.net.url.PortalURL
Class Location

Framework : PortalBase

Module : PLBbase

Class Description

public class PortalURL

the PortalURL includes the class java.net.URL . It exports the same mecanism provided by Java and will be able to integrate dynamically new protocols without API modification. This imply the creation of specific classes to support each protocol. These classes must inherits from URLStreamHandler. See @see java.net.URL.URL() comments in the JDK API documentation for more details. PortalURL scheme : protocol://username:password@server_name:portNumber/data_origin.data_extension?arg1=value1&arg2=value2 sample : remotefile://my_server:1570/u/users/my_user/my_file.ext?my_arg=my_value

   All Implemented Interfaces:
Transferable
Field Summary
protected static final String ampersand
public static final String ARG_WITH_MULTI_VALUE
See IR 366397 : arg=value1&arg=value2
public static final String ARG_WITH_NULL_VALUE
public static final String COMMAND_INSTANCE_NAME
Reserved argument name for command instance name: "InstanceName"
public static final String COMMAND_NAME
Reserved argument name for command class name: "Command"
protected static final int dot
public static final String EPL_NO_MIME_TYPE
Reserved argument name in order to specify to not get MIMETypes from URLConnection Usefull for http script URLs like CGIs which should not be executed several times.
public static final String MIME_TYPE
Reserved argument name for MIME Type name: "MIMEType"
public static final String NEW_INSTANCE_NAME
Reserved InstanceName in order to specify the creation of a new instance
public static final String NO_ACTIVATION
Reserved argument name in order to specify to not activate the CATlet
protected static final int questionMark

Constructor Summary
PortalURL(String portalURL)
PortalURL constructor.
PortalURL(String protocol, String hostname, int portNumber, String dataOrigin, String dataExtension, String username, String password, Hashtable argumentsTable)
PortalURL constructor.
PortalURL(PortalURL contextUrl, String subURL)
PortalURL constructor.
PortalURL(URL contextUrl, String subURL)
PortalURL constructor.

Method Summary
public boolean equals(Object obj)
Compares the equality of an object with this instance
public String[] getArgumentList()
Returns the list of all arguments contained in the URL
public String getCommandInstanceName()
Returns the instance name of the command associated with this URL the reserved argument name is : "CommandInstanceName"
public String getCommandName()
Returns the command name associated with this URL.
public String getContentType()
Returns the content of the pointed file Same method as @see java.net.URLConnection#getContentType()
public String getDataExtension()
Returns the data extension.
public String getDataOrigin()
Returns the data origin.
public String getFile()
Returns the file.
public String getHost()
Returns the hostname of the server on which reside the data Mapped to @see java.net.URL#.getHost()
public String getMIMEType()
Returns the application type associated with the data.
public String getPassword()
Returns the password used for authentication.
public int getPort()
Returns the port number used for the connection.
public String getPostData()
Returns the data that is sent to the webserver through post method, is called from EBrowserCATlet only, do not call from anywhere else It is used in the "other method" of VPM context only.
public String getProtocol()
Returns the protocol used to retreive the data (http, enovia, cdm, remotefile ...) Mapped to @see java.net.URL#getProtocol()
public String getQuery()
Returns the arguments as a query String "arg1=val1&arg2=val2"
public URL getURL()
Returns the url @link java.net.URL instance encapsulated by this PortalURL.
public String getUsername()
Returns the username used for authentication.
public String getValueOfArgument(String argument)
Returns the value associated with an argument.
public Vector getValuesOfArgument(String argument)
Returns the values associated with an argument.
protected void initPortaURLWithString(String portalURL)
public URLConnection openConnection()
Returns a URLConnection object that represents a connection to the remote object referred to by the PortalURL.
public final InputStream openStream()
Opens a connection to this URL.
public void setPostData(String PostData)
Sets the data , that is sent to the webserver through post method, intended for MenuItemWizard usage only, Do not use it from anywhere else.
public String toString()
Constructs a string representation of this PortalURL.
public String toStringWithoutSpecifiedArguments(boolean portalArgumentsFlag, String[] arguments)
Returns the string representation of the PortalURL whithout specific Portal arguments if portalArguments = true, and without the specified list of argument


Field Detail

ampersand

    protected static final String ampersand


ARG_WITH_MULTI_VALUE

    public static final String ARG_WITH_MULTI_VALUE
See IR 366397 : arg=value1&arg=value2


ARG_WITH_NULL_VALUE

    public static final String ARG_WITH_NULL_VALUE


COMMAND_INSTANCE_NAME

    public static final String COMMAND_INSTANCE_NAME
Reserved argument name for command instance name: "InstanceName"


COMMAND_NAME

    public static final String COMMAND_NAME
Reserved argument name for command class name: "Command"


dot

    protected static final int dot


EPL_NO_MIME_TYPE

    public static final String EPL_NO_MIME_TYPE
Reserved argument name in order to specify to not get MIMETypes from URLConnection Usefull for http script URLs like CGIs which should not be executed several times.


MIME_TYPE

    public static final String MIME_TYPE
Reserved argument name for MIME Type name: "MIMEType"


NEW_INSTANCE_NAME

    public static final String NEW_INSTANCE_NAME
Reserved InstanceName in order to specify the creation of a new instance


NO_ACTIVATION

    public static final String NO_ACTIVATION
Reserved argument name in order to specify to not activate the CATlet


questionMark

    protected static final int questionMark


Constructor Detail

PortalURL

    PortalURL(String portalURL)

PortalURL constructor. The url is given as a String. Throws a MalformedURLException if the given String is not a PortalURL.

Parameters:
portalURL
- the string representation of the url.
Throws:
java.net.MalformedURLException -

PortalURL

    PortalURL(String protocol, String hostname, int portNumber, String dataOrigin, String dataExtension, String username, String password, Hashtable argumentsTable)

PortalURL constructor. The url is given element by element. In some cases, some elements mais be null or -1 (for port number : default port taken) The password, if specified, is given encrypted.

Parameters:
protocol
- the name of the protocol
hostname
- the name of the host
portNumber
- the port number (-1 for default port)
dataOrigin
- the data origin of data specified by the url
dataExtension
- the extension of the data specified by the url
username
- the user name for protocol with authentication
password
- the encrypted password protocol with authentication
argumentsTable
- the arguments of the query of the url
Throws:
java.net.MalformedURLException -

PortalURL

    PortalURL(PortalURL contextUrl, String subURL)

PortalURL constructor. Creates a URL by parsing the specification subURL within a specified context. If the contextUrl argument is not null and the subURL argument is a partial URL specification, then any of the strings missing components are inherited from the contextUrl argument.

Parameters:
contextUrl
- the PortalURL use for missing argument of the subURL
subURL
- the string representation of the PortalURL to create
Throws:
java.net.MalformedURLException -

PortalURL

    PortalURL(URL contextUrl, String subURL)

PortalURL constructor. Creates a URL by parsing the specification subURL within a specified context. If the contextUrl argument is not null and the subURL argument is a partial URL specification, then any of the strings missing components are inherited from the contextUrl argument.

Parameters:
contextUrl
- the PURL use for missing argument of the subURL
subURL
- the string representation of the PortalURL to create
Throws:
java.net.MalformedURLException -

Method Detail

equals

    public boolean equals(Object obj)

Compares the equality of an object with this instance

Parameters:
obj
- the PortalURL to compare with this instance

getArgumentList

    public String[] getArgumentList()

Returns the list of all arguments contained in the URL


getCommandInstanceName

    public String getCommandInstanceName()

Returns the instance name of the command associated with this URL the reserved argument name is : "CommandInstanceName"


getCommandName

    public String getCommandName()

Returns the command name associated with this URL. the reserved argument name is : "CommandName"


getContentType

    public String getContentType()

Returns the content of the pointed file Same method as @see java.net.URLConnection#getContentType()


getDataExtension

    public String getDataExtension()

Returns the data extension.


getDataOrigin

    public String getDataOrigin()

Returns the data origin. In some cases, the data origin may also contains the data extension.


getFile

    public String getFile()

Returns the file. (DataOrigin.DataExtension) Same method as @see java.net.URL#getFile()


getHost

    public String getHost()

Returns the hostname of the server on which reside the data Mapped to @see java.net.URL#.getHost()


getMIMEType

    public String getMIMEType()

Returns the application type associated with the data. If possible, it is based on the URL content type normally returned by the server. If this content type is not available, the mime type is resolved from the data extension. If the MIME type is specified in the query, it is returned.


getPassword

    public String getPassword()

Returns the password used for authentication. The password is not encrypted


getPort

    public int getPort()

Returns the port number used for the connection. Mapped to @see java.net.URL#getPort()


getPostData

    public String getPostData()

Returns the data that is sent to the webserver through post method, is called from EBrowserCATlet only, do not call from anywhere else It is used in the "other method" of VPM context only.


getProtocol

    public String getProtocol()

Returns the protocol used to retreive the data (http, enovia, cdm, remotefile ...) Mapped to @see java.net.URL#getProtocol()


getQuery

    public String getQuery()

Returns the arguments as a query String "arg1=val1&arg2=val2"


getURL

    public URL getURL()

Returns the url @link java.net.URL instance encapsulated by this PortalURL. This url may be null especially when running inside a browser and using other protocols than "file" or "http".


getUsername

    public String getUsername()

Returns the username used for authentication. May be null.


getValueOfArgument

    public String getValueOfArgument(String argument)

Returns the value associated with an argument. Returns null if the argument is not present inside the URL.

Parameters:
argument
- the argument name.

getValuesOfArgument

    public Vector getValuesOfArgument(String argument)

Returns the values associated with an argument. Returns null if the argument is not present inside the URL.

Parameters:
argument
- the argument name.

initPortaURLWithString

    protected void initPortaURLWithString(String portalURL)


openConnection

    public URLConnection openConnection()

Returns a URLConnection object that represents a connection to the remote object referred to by the PortalURL.

If there is not already an open connection, the connection is opened by calling the openConnection method of the protocol handler for this PortalURL.

Return:
a URLConnection to the PortalURL.
Throws:
IOException - if an I/O exception occurs.

openStream

    public final InputStream openStream()

Opens a connection to this URL. For some protocol, always throws an IOException as there are no meaning or no way to retreive the data on the client (enovia protocol essentially) Mapped to @see java.net.URL#openStream()

Throws:
java.io.IOException -

setPostData

    public void setPostData(String PostData)

Sets the data , that is sent to the webserver through post method, intended for MenuItemWizard usage only, Do not use it from anywhere else.

Parameters:
PostData
- post data that portal url should carry to the handler.

toString

    public String toString()

Constructs a string representation of this PortalURL.


toStringWithoutSpecifiedArguments

    public String toStringWithoutSpecifiedArguments(boolean portalArgumentsFlag, String[] arguments)

Returns the string representation of the PortalURL whithout specific Portal arguments if portalArguments = true, and without the specified list of argument

Parameters:
portalArgumentsFlag
- boolean flag in order to remove specific Portal arguments
arguments
- the list of argument to remove from the url string


Copyright © 2000, Dassault Systèmes. All rights reserved