使用文件附件

news2024/9/20 5:49:52

文件附件在peoplesoft中非常常见

This chapter provides an overview of the file attachment functions and discusses:

  • Developing applications that use file attachment functions.

  • Application development considerations.

  • Application deployment and system configuration considerations.

  • Debugging file attachment problems.

理解文件附件函数

This section provides an overview of:

  • PeopleCode built-in file attachment functions.

  • File attachment architecture.

  • File attachment storage locations.

  • Storage location URLs.

Click to jump to top of page

Click to jump to parent topic

PeopleCode Built-in File Attachment Functions

All file attachments are performed using PeopleCode built-in functions, such as AddAttachment, ViewAttachment, GetAttachment, and so on. These functions operate on and transfer files to and from supported storage locations: database tables, FTP sites, and HTTP repositories.

PeopleCode provides eight built-in file attachment functions that are organized into three categories:

  • End user upload/download:

    • AddAttachment

      Use the AddAttachment function to upload one file from an end user machine to a specified storage location.

      See AddAttachment.

    • AddAttachment

      Use the MAddAttachment function to upload one or more files from an end-user machine to a specified storage location.

      See MAddAttachment.

    • DetachAttachment

      Use the DetachAttachment function to download a file from its source storage location and save it locally on the end user machine. The file is sent to the browser with appropriate HTTP headers to cause the browser to display a save as dialog box to the user.

      See DetachAttachment.

    • ViewAttachment

      Use the ViewAttachment function to download a file from its source storage location and open it locally on the end user machine.

      See ViewAttachment.

  • Application server upload/download:

    • PutAttachment

      Use the PutAttachment function to upload a file from the file system of the application server to the specified storage location.

      See PutAttachment.

    • GetAttachment

      Use the GetAttachment function to download a file from its source storage location to the file system of the application server.

      See GetAttachment.

  • Storage location maintenance:

    • CleanAttachments

      Use the CleanAttachments function to remove orphan files (files with no corresponding file reference) from specified tables used as storage locations in the current database.

      See CleanAttachments.

    • CopyAttachments

      Use the CopyAttachments function to copy all files with file references from one storage location to another. The files to be copied can be limited to those referenced in specific file reference tables.

      See CopyAttachments.

    • DeleteAttachment

      Use the DeleteAttachment function to delete a file from the specified storage location.

      See DeleteAttachment.

The following diagram illustrates the operation of these PeopleCode file attachment functions:

PeopleCode file attachment functions

Because these functions abstract the storage of the attachments, you can use any defined storage location. The location to be used is determined by the URL passed as the first parameter to the invoked attachment function.

See Also

Understanding File Attachment Storage Locations

Understanding URL Strings Versus URL Objects

Click to jump to top of page

Click to jump to parent topic

Understanding the File Attachment Architecture

File attachments are supported by using PeopleCode built-in functions that implement the transfer of a file to or from a storage location. Using the PeopleCode functions, files can be transferred back and forth from the end user machine to the storage location (by way of the web server and application server) or transferred back and forth from the application server file system to the storage location.

The following steps depict the process of transferring a file with the AddAttachment function:

  1. The file is streamed from the browser to the servlet on the web server using a standard HTML form construct.

    Optionally, if virus scan is enabled, the stream in the HTTP servlet request is scanned by the virus scan engine.

    See Setting Up Virus Scanning.

    Note. This transfer can be performed securely in an encrypted fashion if the web server uses Secure Sockets Layer (SSL) to communicate to the browser.

    Note. When the user selects a file for uploading, file size is not checked until after the file is transferred to the web server. Once the file gets to the web server the file size is compared to the value of the AddAttachment function's MaxSize parameter. The transfer is terminated if the file size exceeds this parameter.

  2. After the file is received at the web server, the file is streamed from the web server to the application server in one-megabyte chunks.

    Note. The one-megabyte transfer chunk size between web server and application server cannot be customized.

    Note. The web server-to-application server transfer is performed by using Oracle Jolt, which is securely encrypted. Because this transfer is done using the standard Oracle Jolt mechanism, no additional settings to the firewall are required (you do not need to open additional ports).

  3. The file chunks from the web server are transferred by the application server to a temporary table in the database. The chunk size for this temporary storage depends on the ultimate storage location.

    For database tables, the chunk size is governed by the value of the Maximum Attachment Chunk Size field on the PeopleTools Options page. The chunk size in temporary storage can vary, but it never exceeds this maximum attachment chunk size limit. For all other storage locations, the chunk size in the temporary storage table is 16 KB.

  4. Then, the application server transfers the file in chunks from the temporary database table to its ultimate storage location.

    Once the entire file is transferred, the application server deletes the temporary copy from the PeopleTools table in the database.

    Note. If the storage location is a database table, then the chunk size is exactly as specified by the value of the Maximum Attachment Chunk Size field (except for the last chunk written, which can be smaller than the maximum).

    See File Attachment Chunk Size.

    Note. If the storage location is an FTP site or an HTTP repository, the file is reassembled into a whole file at the destination.

Note. The file transfer process for MAddAttachment is, in general, similar to the process for AddAttachment. With a call to MAddAttachment, the files are streamed from the browser to the web server in bulk but from the web server through to the storage location one file at a time. Moreover, virus scanning cannot currently be performed on files uploaded with MAddAttachment.

The following diagram depicts this process of transferring a file with the AddAttachment function:

AddAttachment file transfer process

The file attachment architecture is designed for use in the frame template or the iframe template only. It is not supported in a pagelet or an HTML template. When content is rendered in a pagelet or HTML template, the user interaction is managed through the PeopleSoft portal servlet. For the file attachment architecture to work, the browser must communicate directly with the PeopleSoft content servlet, which requires the use of the frame or iframe template.

See Also

Understanding Portal Templates

Understanding Template Types

Click to jump to top of page

Click to jump to parent topic

Understanding File Attachment Storage Locations

PeopleTools supports three types of storage locations: database tables, FTP sites, and HTTP repositories. Except for the CleanAttachments function, all PeopleCode file attachment functions support all three storage locations. The CleanAttachments function operates only on database tables as storage locations.

This section provides an overview of the following:

  • Database storage considerations

  • FTP site considerations

  • HTTP repository considerations

Database Storage Considerations

To store file attachments in the database, you must create a target table to store the attachments themselves. The record definition associated with this target table must include the FILE_ATTDET_SBR subrecord and no other fields.

This chapter contains additional information on how to create the target table.

See Application Development Process Overview.

When the storage location is a database table, the URL parameter of the invoked file attachment function can be specified in one of two ways:

  • A URL string in the form of:

     

    record://MYRECORD

    In this case, MYRECORD is the record definition associated with the target table.

  • A URL identifier in the form of:

     

    URL.URL_ID

    In this case, the URL identifier refers to the URL object named URL_ID.

FTP Site Considerations

When the storage location is an FTP site, the URL can be defined in one of two ways:

  • A URL string in the form of:

     

    ftp://FTP_user:FTP_pwd@FTP_site/path

    Important! FTPS and SFTP require that a URL object be used and do not support URL strings. This form of URL string is for use with the FTP protocol only.

  • A URL identifier in the form of:

     

    URL.URL_ID

    In this case, the URL identifier refers to the URL object named URL_ID.

When specifying a URL for an FTP site, specify the FTP server's name or its IP address. Specify a path on the FTP server relative to the directory specified as the FTP server's home directory. The default FTP port is 21. If you want to use a different port, you must specify it in the URL, as part of the FTP server address. For example:

 

ftp://ftpserver.peoplesoft.com:6000/

Note. If the specified subdirectories do not exist the PeopleCode function tries to create them.

The following limitations apply to FTP URLs:

  • The FTP user name to is limited to 30 characters.

  • The FTP password to is limited to 16 characters.

HTTP Repository Considerations

When the storage location is an HTTP repository, the URL parameter of the invoked file attachment function must be specified as a URL identifier in the form of:

 

URL.URL_ID

In this case, the URL identifier refers to the URL object named URL_ID.

An HTTP repository can reside on a PeopleSoft web server, or on a different web server environment. If the HTTP repository resides on a PeopleSoft web server, then the psfiletransfer servlet has been provided to manage the file transfers to and from the storage location. If the HTTP repository resides on a non-PeopleSoft web server, then you need to ensure that the web server can handle file transfer security and requests.

Additional configuration is required to set up a PeopleSoft web server as an HTTP repository. See the “Working with HTTP/HTTPS” section in the PeopleTools 8.52: System and Server Administration PeopleBook.

See URL Maintenance.

Click to jump to top of page

Click to jump to parent topic

Understanding URL Strings Versus URL Objects

The URL parameter of the invoked file attachment function includes both the protocol to be used and the address for a storage location. These URLs can be specified as ad hoc strings at run time in certain limited cases. Alternatively, they can be defined and maintained as URL objects, which include an identifier, the URL itself, and additional URL properties. Oracle recommends that you always use URL objects since that approach gives you the flexibility of later changing the storage location of your files without having to modify your PeopleCode or the contents of any file reference tables used. Moreover, the FILE_EXT_LIST property of a URL object allows you to specify a file extension list, which is the most straightforward way to restrict the file types that can be uploaded to or downloaded from your PeopleSoft system. File extension lists cannot be applied to ad hoc URL strings.

See Restricting the File Types That Can Be Uploaded or Downloaded.

URL objects are created and maintained using the URL Maintenance page (PeopleTools, Administration, Utilities, URLs). The length of the full URL is limited to 254 characters. Certain protocols—specifically, FTPS, SFTP, HTTP, and HTTPS—require the use of URL objects because other information in addition to the URL itself are required. This additional information is defined as URL properties on the associated URL Properties page.

Note. For database tables and the FTP protocol only, the storage location can be specified as an ad hoc string at run time because these file transfer methods do not require additional URL properties.

The PeopleTools 8.52: System and Server Administration PeopleBook contains detailed information on creating and maintaining URL objects.

See URL Maintenance.

The following are examples of some valid storage location URLs:

 

record://MYAPP_ATT_CNTNT ftp://user01:password@ftpserver.peoplesoft.com/myfiles ftps://ftp_user:usr_pwd@ftps.oracle.com:6000/images sftp://usr10:pwd@ftp.mycompany.com/attachments http://www.peoplesoft.com:8080/psfiletransfer/ps/docs https://www.peoplesoft.com:8090/psfiletransfer/empl/docs

Click to jump to parent topic

Developing Applications that Use File Attachment Functions

This section provides an overview of the application development process and discusses:

  • Delivered record definitions.

  • Managing entries in file reference tables.

  • Using the PeopleTools Test Utilities page.

Click to jump to top of page

Click to jump to parent topic

Application Development Process Overview

Follow these steps to develop an application that uses file attachments:

  1. Create an application-specific, default storage location.

    Oracle recommends that you use a database table as the default storage location so that it is available to you during application development, and to customers as a default when the application is installed. You must include the FILE_ATTDET_SBR subrecord in the record definition associated with this target table; the record definition must have no other fields.

    Create a storage location that is unique to your application. (Specifically, to avoid potential file name conflicts and unintended file overwrites, do not share storage locations among applications.) For example, create a record definition named MYAPP_ATT_CNTNT and build the associated database table. If you need to store other information, store it as part of the file reference, as described in the step 3, or create another record and use it in the component.

  2. Create a URL object that corresponds to your default storage location.

    See Understanding URL Strings Versus URL Objects.

  3. Create an application-specific record definition to define the table that will store file reference information and any additional information about the file attachments. You must include the FILE_ATTACH_SBR subrecord in this new record definition.

    For example, create a new record called MYAPP_ATT_REF. Add fields for any other information related to the transaction you want to store. Your application must populate the fields in this file reference table with the system file name, user file name, and any information about the file that will be needed for later use.

    Note. Create a file reference record that is specific to your application. In addition, you should consider whether to create a separate file reference record for each storage location. Doing so can prevent file name conflicts, eliminates the need to store the URL string or URL identifier with each file reference, and can ease the use of the CopyAttachments function.

    See Considerations When Using CopyAttachments.

  4. Clone the FILE_ATTACH_WRK record to create an application-specific derived/work record with a unique name. Save the PeopleCode with the new record.

    For example, create a record named MYAPP_ATT_WRK by cloning FILE_ATTACH_WRK. You can use this copy of the sample PeopleCode as the basis for your own application.

    Important! The FILE_ATTACH_WRK record is delivered as a sample only. It is not intended for direct use as part of an application running in production. Instead an application-specific clone of it must be used. Oracle can change the delivered sample PeopleCode in future releases. Any application that directly uses the FILE_ATTACH_WRK record might fail. Using application-specific PeopleCode makes it easier to manage during upgrades and your PeopleCode can be reused in other components that use file attachment functionality.

    You must also implement the PeopleCode to manage the data in your file reference table (or tables).

  5. Use the records you created in the previous steps to create the file attachment component and page.

    The derived/work record has fields with FieldChange PeopleCode that you can use for Add, Delete, Detach, and View buttons.

    Add PeopleCode—probably at the component record field level—to invoke the underlying functions in the application-specific derived/work record when the user clicks on one of the buttons.

Click to jump to top of page

Click to jump to parent topic

Delivered Record Definitions

The following table summarizes the delivered record definitions for use in a file attachment application:

Record

Example

Description

FILE_ATTDET_SBR

MYAPP_ATT_CNTNT

Insert this subrecord in any record definition for target tables that will store attached files. Do not add other fields to this record.

FILE_ATTACH_SBR

MYAPP_ATT_REF

Insert this subrecord in any application-specific record for tables that will store references to attached files. The fields in this subrecord store the system file name and the user file name.

FILE_ATTACH_WRK

MYAPP_ATT_WRK

Clone this derived/work record to create your own application-specific derived/work record. In your application-specific derived/work record, you can modify your copy of the delivered sample code to meet your file attachment requirements and manage your file reference table (or tables).

FILE_ATTDET_SBR Subrecord

To use a database table as a storage location, you must create an application-specific record definition associated with the target table that will receive the attachments. You must include the FILE_ATTDET_SBR subrecord in your application-specific record, and it can contain no additional fields.

The FILE_ATTDET_SBR subrecord has the following fields:

Field

Description

ATTACHSYSFILENAME

The system file name, which must be unique to the storage location in order to avoid unintended file overwrites. Furthermore, if the file reference table to be used will contain references to file stored at more than one storage location, then the system file name must also be unique to that table.

The value of the ATTACHSYSFILENAME field in the corresponding row of the file reference table must be identical to this value.

FILE_SEQ

The file sequence number (to support file chunking).

VERSION

Version number.

FILE_SIZE

The physical size of the file chunk.

LASTUPDDTTM

Last update date and time.

LASTUPDOPRID

The user ID of the last user to update the attachment.

FILE_DATA

The data of the file chunk.

PeopleTools maintains the values in this table. Therefore, do not reuse the fields in this table to store incomplete or nonstandard versions of the file name or other data.

FILE_ATTACH_SBR Subrecord

You must insert the FILE_ATTACH_SBR subrecord in the application-specific record definition to be associated with the table that will store references to the attached files. The fields in this subrecord store the system file name and the user file name.

The FILE_ATTACH_SBR subrecord contains the following fields:

Field

Description

ATTACHSYSFILENAME

The system file name (the name of the file as it exists at the storage location).

Among other things, this means that if the file is stored in a database table, then the value in this field must be identical to the value of the ATTACHSYSFILENAME field in the rows that correspond to the file chunks in the database table.

ATTACHUSERFILE

The user file name (the name that the end user associates with the file).

Your application must populate these fields with the system file name, user file name, and any information about the file that will be needed for later use.

See Managing Entries in File Reference Tables.

FILE_ATTACH_WRK Derived/Work Record

The FILE_ATTACH_WRK derived/work record provides sample PeopleCode programs that demonstrate how to use the file attachment PeopleCode built-in functions. Clone this derived/work record so that you can customize the programs to suit your application's needs.

The FILE_ATTACH_WRK derived/work record contains the following fields:

Field

Description

ATTACHADD

Contains a PeopleCode program used for uploading an attachment from an end-user machine to the specified storage location (via the AddAttachment built-in function).

ATTACHDET

Contains a PeopleCode program used for downloading an attachment from the specified storage location to be saved on the end-user machine (via the DetachAttachment built-in function).

ATTACHDELETE

Contains a PeopleCode program used for deleting an attachment from the specified storage location (via the DeleteAttachment built-in function).

ATTACHUTIL

Contains a user-defined PeopleCode function that can be called to determine (by file name extension) whether the attachment operation will be permitted on a file. In this function, an array of file name extensions identifies which types of files will be regarded as impermissible.

Note. The sample PeopleCode programs included in the FILE_ATTACH_WRK derived/work record invoke this user-defined PeopleCode function.

ATTACHVIEW

Contains a PeopleCode program used for downloading an attachment from the specified storage location to be viewed on the end-user machine (via the ViewAttachment built-in function).

The PeopleTools Test Utilities page demonstrates a sample application that makes use of the PeopleCode programs in the FILE_ATTACH_WRK derived/work record.

See Using the PeopleTools Test Utilities Page.

Click to jump to top of page

Click to jump to parent topic

Managing Entries in File Reference Tables

When you create a file attachment application, you create an application-specific record to be associated with the table that will store file reference information and any additional information about the file attachments. You must include the FILE_ATTACH_SBR subrecord in this new record. For example, you might create a new record called MYAPP_ATT_REF. Then, you would add fields for any other information related to the transaction you want to store.

Your application must populate these fields with the system file name, user file name, and any information about the file that will be needed for later use. Your application should use the fields in file reference tables as follows:

  • When your application is uploading files (for example, with AddAttachment):

    • ATTACHSYSFILENAME – Save the system file name in the ATTACHSYSFILENAME field. This is the name of the file as it exists at the storage location and is also a key field of your file reference table.

    • ATTACHUSERFILE – Save the user file name, which is the value returned by AddAttachment in its UserFile parameter. This is essentially the base name of file selected by the end user for uploading and would be used to allow end users to identify the file in other file attachment operations (such as viewing, downloading, or deleting).

  • When your application is downloading or deleting files (for example, with ViewAttachment, DetachAttachment, or DeleteAttachment):

    • ATTACHUSERFILE – Use the ATTACHUSERFILE field to present a list of available files for end user selection. This field is also passed as a parameter to some of the built-in PeopleCode functions.

    • ATTACHSYSFILENAME – Use the ATTACHSYSFILENAME field (along with the ATTACHUSERFILE field, for some of the built-in PeopleCode functions) to construct the parameters to be passed to the built-in PeopleCode functions.

See Also

FILE_ATTACH_SBR Subrecord

Click to jump to top of page

Click to jump to parent topic

Using the PeopleTools Test Utilities Page

Access the PeopleTools Test Utilities page (PeopleTools, Utilities, Debug, PeopleTools Test Utilities).

The PeopleTools Test Utilities page contains a sample file attachment application that allows you to upload (Attach button), save (Detach button), delete (Delete button), and open (View button) a file attachment. The page allows you to specify a storage location as a URL identifier or as an ad hoc string. After clicking the Attach button, you are prompted to select a file to upload to the storage location. Once the selected file has been successfully uploaded, buttons appear that allow you to open, save, or delete that file from its storage location.

Note. This demonstration application permits the user to enter a URL of up to 120 characters only.

The actual page definition involved, PSTESTUTIL, contains buttons that execute FieldChange PeopleCode programs in the FILE_ATTACH_WRK derived/work record definition. These programs are provided as working examples of how to use the following file attachment functions: AddAttachment, DeleteAttachment, DetachAttachment, and ViewAttachment. If you are developing a file attachment application, you can clone the FILE_ATTACH_WRK derived/work record definition and modify the copied programs to fit your application’s file processing requirements.

Important! Do not modify the delivered FILE_ATTACH_WRK record definition or the PeopleCode programs it contains. In addition, do not directly call these PeopleCode programs from any PeopleCode programs you implement. Oracle might modify these sample programs in a future release of PeopleTools.

See FILE_ATTACH_WRK Derived/Work Record.

The FILE_ATTACH_WRK derived/work record definition also demonstrates a programmatic methodology for restricting file types. The IsLegalAttachmentType function compares a given file to an internally defined array of illegal file extensions. This programmatic methodology can be contrasted with restricting file types through the use of file extension lists. File extension lists can be provide an easier, more flexible, and more manageable approach to restricting file types than a programmatic method.

Important! Do not combine these two methodologies in the same application.

See Restricting the File Types That Can Be Uploaded or Downloaded.

Click to jump to parent topic

Application Development Considerations

This section discusses:

  • File name considerations.

  • Restrictions on invoking functions in certain PeopleCode events.

  • Converting file names for files uploaded by PutAttachment.

  • Considerations when using CopyAttachments.

Click to jump to top of page

Click to jump to parent topic

File Name Considerations

If the source file name specified using one of the file attachment. contains any of the following characters, the invoking function will be stopped and an error (%Attachment_Failed) is returned. The actual error message can be found in the logs.

  • * (asterisk)

  • : (colon)

  • " (quotation mark)

  • < (less than symbol)

  • > (greater than symbol)

  • ? (question mark)

When the file is uploaded to or downloaded from a storage location, the following characters are replaced with an underscore:

  • (space)

  • @ (at sign)

  • ; (semicolon)

  • + (plus sign)

  • % (percent sign)

  • & (ampersand)

  • ' (apostrophe)

  • ! (exclamation point)

  • # (pound sign)

  • $ (dollar sign)

Note. In general, you should exercise caution when using an @ or : character in the name of a file selected for uploading. In FTP URLs, the : character must to be used as a delimiter between the FTP user ID and the FTP password or just before the FTP port number (if one is specified). In addition, in FTP URLs, the @ character must be used as a delimiter between the FTP password and the FTP server address.

Click to jump to top of page

Click to jump to parent topic

Restrictions on Invoking Functions in Certain PeopleCode Events

Because AddAttachment, DetachAttachment, MAddAttachment, and ViewAttachment are interactive, they are known as “think-time” functions. This means that these functions should not be used in any of the following PeopleCode events:

  • SavePreChange

  • SavePostChange

  • Workflow

  • RowSelect

  • Any PeopleCode event that initiates as a result of a Select or SelectNew method, or any of the ScrollSelect functions.

If you want to transfer files in a non-interactive mode with functions that aren't think-time functions, see GetAttachment and PutAttachment.

See Also

Select

SelectNew

Think-Time Functions

Click to jump to top of page

Click to jump to parent topic

Converting File Names for Files Uploaded by PutAttachment

Generally, a PeopleCode program that calls PutAttachment will also need to save (for later use) the name of each uploaded file as it ended up actually being named at the specified storage location. However, the destination file name (which may have been converted as described in “File Name Considerations”) is not passed back to the PutAttachment function. So, the only way for your PeopleCode program to ensure that it is saving the correct name is to either avoid using special characters in the destination file name or to simulate the conversion process in something like the following example:

 

&ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, " ", "_"); &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, ";", "_"); &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "+", "_"); &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "%", "_"); &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "&", "_"); &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "'", "_"); &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "!", "_"); &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "@", "_"); &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "#", "_"); &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "$", "_");

Note. Unlike the PutAttachment function, the AddAttachment function automatically returns the converted file name for reference and later use. For example, the file name My Resume.doc is returned through the AddAttachment function as My_Resume.doc, with the space converted to an underscore.

See Also

File Name Considerations

Click to jump to top of page

Click to jump to parent topic

Considerations When Using CopyAttachments

CopyAttachments does not modify the contents of any of the associated file reference tables. You must design your application in such a way that using CopyAttachments does not, by itself, require any subsequent changes to the contents of any of the associated file reference tables.

Click to jump to parent topic

Application Deployment and System Configuration Considerations

This section discusses:

  • File attachment functions in an environment with multiple application server domains.

  • Configuring the web server to support additional MIME types.

  • Restricting the file types that can be uploaded or downloaded.

  • Setting up virus scanning.

  • Considerations when attaching text files.

  • File attachment chunk size.

  • Using the Copy File Attachments page.

The topics in this section are of interest primarily to customers deploying file processing applications, and secondarily to application developers.

Click to jump to top of page

Click to jump to parent topic

File Attachment Functions in an Environment with Multiple Application Server Domains

In an environment involving multiple application server domains, a call to one of the PeopleCode file attachment functions must not be passed a parameter designating a file that is located on the file system of a particular application server domain. The problem is that at the time of the call, the application server domain currently in use (as a consequence of load-balancing) might not be the application server domain that has the file in question. In this case, a file-not-found error would result. For example, this may be an issue for a call to PutAttachment, or this might cause a call to GetAttachment to result in the file being downloaded to an unexpected location (the file system of the wrong application server domain) or to fail entirely if the specified destination directory does not exist on the application server domain currently in use. Therefore, the path to the local file must be specified with this in mind by creating directories that can be comparably accessed regardless of which application server domain actually services the request at runtime.

Click to jump to top of page

Click to jump to parent topic

Configuring the Web Server to Support Additional MIME Types

When a browser attempts to open a file attachment, the browser invokes a viewer based on the MIME (Multipurpose Internet Mail Extensions) type sent in the response header from the web server. For example, if the user tried to view an MP3 file, the response header sent to the browser by the web server would indicate the audio/MPEG content type:

 

HTTP/1.1 200 OK Server: Microsoft-IIS/5.0 Date: Mon, 01 Oct 2001 21:25:51 GMT ​Content-Type: audio/mpeg ​Accept-Ranges: bytes Last-Modified: Mon, 01 Oct 2001 21:00:26 GMT ETag: "78e21918bc4ac11:cc8" Content-Length: 60

Notice that the content-type is audio/mpeg. The browser uses this MIME type to determine that the viewer for audio/MPEG is the appropriate application to open this attachment. If the web server did not send this content-type header, the browser would not be able to determine the nature of the file being transmitted, and it would be unable to invoke the correct viewer application. The browser would try to display the file as text/plain, which is often the wrong behavior.

The web server maps file extensions to MIME types through entries in a web.xml configuration file. A copy of web.xml is deployed to each web server instance when it is installed. After a web server instance is created, edit its deployed copy to add any additional MIME types.

The location of the deployment copies varies depending on the web server:

Web Server

Location of Deployment Copy

WebLogic

PS_HOME/webserv/web_server/applications/peoplesoft/PORTAL.war/WEB-INF/web.xml

WebSphere

PS_HOME/webserv/profile_name/installedApps/app_nameNodeCell/app_name.ear/PORTAL.war/WEB-INF/web.xml

See your web server documentation for the name and location of the master copy of this configuration file.

This file contains definitions similar to the following:

 

<mime-mapping> <extension> doc </extension> <mime-type> application/msword </mime-type> </mime-mapping> <mime-mapping> <extension> xls </extension> <mime-type> application/vnd.ms-excel </mime-type> </mime-mapping>

Let's say you want to add a mapping that causes .log files to be interpreted as regular text files. To determine the correct MIME type, check RFC (Request for Comments) documents 2045, 2046, 2047, 2048, and 2077, which discuss internet media types and the internet media type registry.

After checking the RFCs, you determine that the correct MIME type is text/plain. The following is an example of code you would add to the previous section of the configuration file:

 

<mime-mapping> <extension> log </extension> <mime-type> text/plain </mime-type> </mime-mapping> ​

Once you save the file, the .log extension is associated with the content type of text/plain.

Note. You must restart your web server before these changes are recognized.

Note. When trying to view the objects, the extension must exactly match what is set up in the web.xml file. This value is case-sensitive. Therefore, if the PreserveCase parameter has been used when uploading files, it will be necessary to add a MIME type entry for each case-permutation of the file extension in question. If the object view appears garbled, chances are that either the extension is not set up in the web.xml file or there is a case mismatch.

See Also

Documentation for your web server

Click to jump to top of page

Click to jump to parent topic

Restricting the File Types That Can Be Uploaded or Downloaded

You can restrict the file types that can be uploaded to or downloaded from your PeopleSoft system. The file type restrictions apply to the AddAttachment, DetachAttachment, MAddAttachment, and ViewAttachment functions. Allowable or disallowed file extensions are managed through a file extension list and through the FILE_EXT_LIST property of the URL object.

Note. File extension lists cannot be applied to ad hoc URL strings.

The PeopleTools 8.52: System and Server Administration PeopleBook contains detailed information on creating and maintaining file extension lists.

See File Extension List.

Click to jump to top of page

Click to jump to parent topic

Setting Up Virus Scanning

This section discusses:

  • Enabling virus scanning.

  • Configuring VirusScan.xml.

  • Logging virus scans.

  • Virus scan errors and return codes.

Virus scanning can be performed on all files uploaded with the AddAttachment function only.

Warning! Virus scanning cannot currently be performed on files uploaded with the MAddAttachment function.

Enabling Virus Scanning

To enable virus scanning, open the file VirusScan.xml and set the value of disableAll to "False". By default, disableAll is "True".

 

<Providers disableAll="False" logFile="./servers/PIA/logs/VirusScan%u.log">

The location of VirusScan.xml on your system depends on which web server you use.

Oracle WebLogic Server:

 

PS_HOME/webserv/web_server/applications/peoplesoft/PORTAL.war/WEB-INF/classes/⇒ psft/pt8/virusscan

IBM WebSphere:

 

PS_HOME/webserv/profile_name/installedApps/app_nameNodeCell/⇒ ​app_name.ear/PORTAL.war/WEB-INF/classes/psft/pt8/virusscan

Configuring VirusScan.xml

These tags are mandatory in VirusScan.xml:

Tag

Description

Example Value for Scan Engine

<class>

Provider class of the scan engine

Default provider class is:

 

psft.pt8.virusscan.provider. GenericVirusScanProviderImpl

 

psft.pt8.virusscan.provider. GenericVirusScanProviderImpl

<icapversion>

ICAP version

ICAP/1.0

<service-name>

Service name for the scan engine host.

/SYMCScanResp-AV

<policycommand>

Policy command used by the Scan Engine. Only SCAN is supported.

?action=SCAN

<address>

IP address of Scan Engine host.

IP address of the machine where the scan engine is running

<port>

IP port of Scan Engine host.

Port where the scan engine is running

See PeopleTools 8.52: MultiChannel Framework PeopleBook for complete details on configuring VirusScan.xml.

See Enabling Virus Scanning.

Logging Virus Scans

Detailed logging is configured in the logging.properties file on the web server.

Oracle WebLogic:

 

PS_HOME/webserv/web_server/applications/peoplesoft/logging.properties

IBM WebSphere:

 

PS_HOME/webserv/profile_name/installedApps/app_nameNodeCell/app_name.ear/⇒ logging.properties

Set the location of the log file in VirusScan.xml.

 

<Providers disableAll="False" logFile="./servers/PIA/logs/VirusScan%u.log">

The following results are logged with the date and the file name that was scanned:

  • CLEAN, INFECTED, and SCANERROR

    The results for these statuses is logged in this form:

     

    filename = ​result ​

    For example:

     

    finance.xls = INFECTED

  • CONNECTERROR and CONFIGERROR

    The results for these statuses is logged in this form:

     

    Unable to connect to the Scan engine: REASON = ​result ​

    For example:

     

    Unable to connect to the Scan engine: REASON = CONFIGERROR

Virus Scan Errors and Return Codes

If the file is uploaded successfully and no problems are found in the virus scan, AddAttachment returns %Attachment_Succeeded.

If a problem is found, AddAttachment returns one the following return codes:

Numeric Value

Constant Value

Description

13

%Attachment_ViolationFound

File violation detected by virus scan engine.

14

%Attachment_VirusScanError

Virus scan engine error.

15

%Attachment_VirusConfigError

Virus scan engine configuration error.

16

%Attachment_VirusConnectError

Virus scan engine connection error.

Click to jump to top of page

Click to jump to parent topic

Considerations When Attaching Text Files

The PeopleCode file attachment functions do not provide text file conversions when files are attached or viewed. In fact, when any file is uploaded, it is always copied to the specified destination byte-for-byte.

Warning! You may encounter problems when a text file is uploaded from one operating system or environment and then later viewed on another. For instance, suppose a text file on a DB2 system is encoded in EBCDIC. A user viewing that file in a Windows environment might see garbled content because the text file viewer is expecting ANSI encoding.

Similar issues can occur when two file systems have different character sets, such as Japanese JIS and Unicode, or different line endings.

It is the developer's responsibility to manage this issue in their environments. A number of text file conversion utilities are available for various platforms.

Some steps you can take to avoid conversion problems include:

  • Educate your users.

  • Standardize on file formats and encodings.

  • Make sure that the user's environment supports the files being transferred.

  • Restrict attachments to file types that are known to be compatible across user platforms.

Click to jump to top of page

Click to jump to parent topic

File Attachment Chunk Size

When using a database table as the storage location, the file is automatically “chunked,” or stored, in multiple rows of the database table. The size of each chunk is determined by the Maximum Attachment Chunk Size field on the PeopleTools Options page.

Because each file is chunked, you cannot pull whole files directly from the database. You must use the PeopleCode file attachment functions, which automatically put the data back together into one file for you. Because the chunk size is stored with the file, if you change the system chunk size, you can still retrieve files with different chunk sizes.

See Also

PeopleTools Options

Click to jump to top of page

Click to jump to parent topic

Using the Copy File Attachments Page

The Copy File Attachments page is provided as a way to launch a CopyAttachments operation (select PeopleTools, Utilities, Administration, Copy File Attachments). The CleanAttachments function is also available from this page.

Note. The copying functionality available on this page does not fully exploit the capabilities of the CopyAttachments built-in PeopleCode function. In particular, the page does not permit the end user to specify values for CopyAttachments’ optional parameters. If you want to enable the use of these optional parameters, you must clone and then modify the existing PeopleCode or implement your own PeopleCode to do this.

See Also

CopyAttachments

CleanAttachments

Copy File Attachments

Click to jump to parent topic

Debugging File Attachment Problems

This debugging section discusses the following:

  • Enabling tracing on the web server or application server.

  • Problems with transfers to and from FTP sites.

  • Attachments with non-ASCII file names.

  • Problems uploading files.

  • Passing error messages to the end user.

The topics in this section are of interest primarily to customers deploying file processing applications, and secondarily to application developers.

Click to jump to top of page

Click to jump to parent topic

Enabling Tracing on the Web Server or Application Server

This section discusses how to:

  • Enable tracing on the web server.

  • Enable PeopleCode tracing on the application server.

Enabling Tracing on the Web Server

To enable web server tracing of file attachment processes:

  1. Select PeopleTools, Web Profile, Web Profile Configuration, and open the current web profile.

  2. Select the Custom Properties page.

  3. Add a new row, and enter these values:

    Column

    Value

    Property Name

    IDDA

    Validation Type

    Number

    Property Value

    32 (File processing)

  4. Set the .level property of the logging.properties file to ALL.

  5. Restart the web server.

The log files are written to a directory that depends on the java.util.logging.FileHandler.pattern property of the logging.properties file.

More information on IDDA logging is available in the PeopleTools PeopleBooks.

See Enabling IDDA Logging.

Enabling PeopleCode Tracing on the Application Server

For tracing file attachment issues, set the PeopleCode trace level to 2048 (Statement Tracing, which shows each statement as it's executed). In addition, higher PeopleCode trace settings are recommended whenever CopyAttachments is run. You can enable PeopleCode tracing on the application server in several ways:

  • For all client sessions by setting TracePC in Configuration Manager.

  • For a specific client session through the Trace PeopleCode page (select PeopleTools, Utilities, Debug, Trace PeopleCode.

Because PeopleCode tracing can generate a lot of output, setting tracing for a specific client session only is recommended.

Application server log files can be found in the PS_CFG_HOME/appserv/domain/LOGS directory.

  • The application server log files have names in the form APPSRV_MMDD.LOG (in which MMDD represents the month and date).

  • The file transfer log file has a name in the form of FILETRANSFERpid.LOG.

  • The PeopleCode trace file has a name of the form, *.tracesql.

See Specifying Trace Settings.

Click to jump to top of page

Click to jump to parent topic

Problems with Transfers to and from FTP Sites

A common reason that a transfer fails is that the FTP server is not accessible from the application server. This error could be due to:

  • An incorrect password.

  • An incorrect account name.

  • An inability of the application server to resolve the FTP server's host name.

  • The FTP server is down.

Try to ping the FTP server machine from the application server system, and then try to manually transfer a file to the FTP server machine from the application server.

If the FTP site is on Microsoft Windows, the host name for the system might not be associated with a fixed IP address and might not be resolvable using DNS (Domain Name System). If the application server is on a UNIX machine, the application server can resolve the host name using DNS only—or perhaps using NIS (Network Information System) or an /etc/hosts file. However, the application server will be unable to use Windows mechanisms such as WinBeui or WINS. Therefore, the application server will not be able to convert the host name indicated for the Microsoft Windows file server into an IP address and route to it.

If the file transfer fails, you must resolve the problem by either specifying the numeric IP address in the FTP URL or by putting the host name for the FTP site into DNS, NIS, or the hosts file on your application server so that the name can be resolved.

Typically, the URL used for file attachments has the following format:

 

ftp://user:pwd@system_name/dir1/subdir

However, if the domain name cannot be resolved with DNS, then use the numeric IP address. The following example assumes system_name has the IP address of 123.123.123.123:

 

ftp://user:pwd@123.123.123.123/dir1/subdir

Note. Use numeric IP addresses only when absolutely necessary.

Click to jump to top of page

Click to jump to parent topic

Attachments with non-ASCII File Names

To successfully upload an attachment with a file name containing non-ASCII characters (such as Japanese), Oracle recommends running the application server with the locale that supports those specific non-ASCII characters—for example, ja_JP.utf-8.

If the storage location for the attachment is an FTP site or an HTTP repository, Oracle recommends that the storage location also be running in an environment that supports the same language or locale as the file names used. The web server (which serves as an intermediary in the transfer of the file from the browser to the application server and then on to the storage location) can be running either an English environment or a non-ASCII character language environment.

See Also

URL Maintenance

Click to jump to top of page

Click to jump to parent topic

Problems Uploading Files

You cannot use a relative path to specify the file that is to be uploaded; you must use a full path. If users experiences problems in uploading files, ensure that they browse to the file they wish to upload rather than attempting to manually enter the full path name of the file.

This problem can manifest itself differently depending on the browser used. For example, with some browser versions, the PeopleSoft page appears to be in an infinite “Processing” state.

See Also

My Oracle Support, “Troubleshooting Browser Limitations”

Click to jump to top of page

Click to jump to parent topic

Passing Error Messages to the End User

When working with the attachment functions, if you want the end user to be able to view error messages (such as that the file is too large, that the file was not found, that there is no disk space at the storage location, and so on), then you need to write or clone PeopleCode to interpret function return codes and pass error messages back to the user.

As an example, each of the programs in the FILE_ATTACH_WRK derived/work record includes a parameter that sets the message level, but does not translate these into user terminology. The message levels that can be set are:

  • 0 – Suppress all messages including errors.

  • 1 – Display all messages.

  • 2 – Suppress success messages only, but display error messages.

By default, the message level is 0 for each of these programs. The programs are demonstrated on the PeopleTools Test Utilities page.

See Also

FILE_ATTACH_WRK Derived/Work Record

Using the PeopleTools Test Utilities Page

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1133003.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

基于 Appium 的 Android UI 自动化测试!

自动化测试是研发人员进行质量保障的重要一环&#xff0c;良好的自动化测试机制能够让开发者及早发现编码中的逻辑缺陷&#xff0c;将风险前置。日常研发中&#xff0c;由于快速迭代的原因&#xff0c;我们经常需要在各个业务线上进行主流程回归测试&#xff0c;目前这种测试大…

Kafka入门04——原理分析

目录 01理解Topic和Partition Topic(主题) Partition(分区) 02理解消息分发 消息发送到分区 消费者订阅和消费指定分区 总结 03再均衡(rebalance) 再均衡的触发 分区分配策略 RangeAssignor(范围分区) RoundRobinAssignor(轮询分区) StickyAssignor(粘性分区) Re…

软件测试面试1000问(含文档)

前前后后面试了有20多家的公司吧&#xff0c;最近抽空把当时的录音整理了下&#xff0c;然后给大家分享下 开头都是差不多&#xff0c;就让做一个自我介绍&#xff0c;这个不用再给大家普及了吧 同时&#xff0c;我也准备了一份软件测试视频教程&#xff08;含接口、自动化、…

进阶课4——随机森林

1.定义 随机森林是一种集成学习方法&#xff0c;它利用多棵树对样本进行训练并预测。 随机森林指的是利用多棵树对样本进行训练并预测的一种分类器&#xff0c;每棵树都由随机选择的一部分特征进行训练和构建。通过多棵树的集成&#xff0c;可以增加模型的多样性和泛化能力。…

MTK AEE_EXP调试方法及user版本打开方案

一、AEE介绍 AEE (Android Exception Engine)是安卓的一个异常捕获和调试信息生成机制。 手机发生错误(异常重启/卡死)时生成db文件(一种被加密过的二进制文件)用来保存和记录异常发生时候的全部内存信息,经过调试和仿真这些信息,能够追踪到异常的缘由。 二、调试方法…

深度学习_6_实战_点集最优直线解_代码解析

问题描述&#xff1a; 上述题目的意思为&#xff0c;人工造出一些数据点&#xff0c;对我们的模型y Xw b ∈进行训练&#xff0c;其中标准模型如下&#xff1a; 其中W和X都为张量&#xff0c;我们训练的模型越接近题目给出的标准模型越好 训练过程如下&#xff1a; 人造数…

订水商城H5实战教程-04用户注册

目录 1 用户注册2 创建模型应用3 开发审核功能4 配置菜单5 发布预览最终效果 我们上一篇讲解了用户协议的功能&#xff0c;如果用户同意协议&#xff0c;就可以跳转到注册页面&#xff0c;要求用户录入个人基本信息&#xff0c;本篇我们介绍一下用户注册功能。 1 用户注册 用户…

Python-自动化绘制股票价格通道线

常规方案 通过将高点/低点与其 2 个或 3 个相邻点进行比较来检测枢轴点,并检查它是否是其中的最高/最低点。对所有枢轴点进行线性回归以获得上方和下方趋势线。价格离开通道后建仓。通过这样做,我们得到如下所示的价格通道。我认为我们可以利用给定的数据取得更好的结果。

OkHttp网络框架深入理解-SSL握手与加密

OkHttp简介 由Square公司贡献的一个处理网络请求的开源项目&#xff0c;是目前Android使用最广泛的网络框架。从Android4.4开始HttpURLConnection的底层实现采用的是OkHttp。 特点&#xff1a; 支持HTTP/2并允许对同一主机的所有请求共享一个套接字通过连接池,减少了请求延迟…

基于XML的Web服务Java接口(JAX-WS)、Jakarta XML Web Services Eclipse 实现

简介 JAX-WS&#xff08;Java API for XML-Based Web Services&#xff09;&#xff0c;是创建web服务的Java编程接口&#xff0c;特别是SOAP服务。是Java XML编程接口之一&#xff0c;是Java SE 和Java EE 平台的一部分。 JAX-WS 2.0 规范是代替JAX-RPC 1.0的下一代Web服务AP…

红蓝对抗——信息收集

文章目录 1. 基础篇1.1 企业架构收集1.2 ICP 备案查询1.3 DNS 解析记录1.4 网络汇测1.5 C段收集1.6 证书收集1.7 接口收集1.8 APK信息收集1.9 公众号信息收集1.10 站点敏感信息收集1.11 供应链/业务链收集1.12 人员信息收集1.13 Google1.14 github信息收集 2. 进阶篇2.1 子域名…

C++ 异常和错误处理机制:如何使您的程序更加稳定和可靠

在C编程中&#xff0c;异常处理和错误处理机制是非常重要的。它们可以帮助程序员有效地处理运行时错误和异常情况。本文将介绍C中的异常处理和错误处理机制。 什么是异常处理&#xff1f; 异常处理是指在程序执行过程中发生异常或错误时&#xff0c;程序能够捕获并处理这些异常…

【打靶】vulhub打靶系列(一)—小白视野的渗透测试

主机探测 arpscan arp-scan -l 另一种方法arping for i in $(seq 1 200); do sudo arping -c 1 192.168.56.$i; done 注意这个必须是root权限 ​ 端口探测 nmap nmap -p- -sV -T4 192.168.56.104 发现8080端口 web测试 访问下web页面 1、通过逻辑点绕过 发送到xia_sq…

gitlab查看、修改用户和邮箱,gitlab生成密钥

查看用户、邮箱 git config user.name git config user.email 修改用户、邮箱 git config --global user.name “xxx” git config --global user.email “xxxxxx.com” 生成ssh密钥 ssh-keygen -t rsa -C “xxxxxx.com” 查看SSH秘钥 cat ~/.ssh/id_rsa.pub 将秘钥复制&…

Redis数据类型——set类型数据介绍及操作

1.set类型介绍及基本操作 2.set类型数据的扩展操作

2023年5个美国代理IP推荐,最佳代理花落谁家?

美国代理IP指的是代理服务器位于美国的IP地址&#xff0c;对于跨境业务来说&#xff0c;这些代理IP地址可以用于隐藏用户的真实IP地址&#xff0c;将其网络流量路由通过美国的服务器&#xff0c;以实现一些特定的目的。由于近年来&#xff0c;面向美国市场的跨境商家越来越多&a…

Spring无法加载静态属性和SpringBoot单元测试指定加载配置文件

一、Spring无法加载静态属性&#xff0c;怎么解决&#xff1f; Spring主要用于管理和注入Bean&#xff08;对象&#xff09;的实例属性&#xff0c;而不是静态属性。静态属性属于类本身&#xff0c;而不是类的实例&#xff0c;因此Spring的依赖注入机制不会处理它们。 看图&a…

力扣:138. 随机链表的复制(Python3)

题目&#xff1a; 给你一个长度为 n 的链表&#xff0c;每个节点包含一个额外增加的随机指针 random &#xff0c;该指针可以指向链表中的任何节点或空节点。 构造这个链表的 深拷贝。 深拷贝应该正好由 n 个 全新 节点组成&#xff0c;其中每个新节点的值都设为其对应的原节点…

【Linux】Centos yum源替换

YUM是基于RPM包管理&#xff0c;能够从指定的服务器自动下载RPM包并且安装&#xff0c;可以自动处理依赖性关系&#xff0c;并且一次安装所有依赖的软件包&#xff0c;无须繁琐地一次次下载、安装。 CentOS 8操作系统版本结束了生命周期&#xff08;EOL&#xff09;&#xff0…