diff -r 4816d766a08a -r f345bda72bc4 Symbian3/PDK/Source/GUID-8E3BD71D-D372-5315-B282-F87FA60A1D5A.dita --- a/Symbian3/PDK/Source/GUID-8E3BD71D-D372-5315-B282-F87FA60A1D5A.dita Tue Mar 30 11:42:04 2010 +0100 +++ b/Symbian3/PDK/Source/GUID-8E3BD71D-D372-5315-B282-F87FA60A1D5A.dita Tue Mar 30 11:56:28 2010 +0100 @@ -1,61 +1,61 @@ - - - - - -Extracting -URI Components -

This tutorials describe the steps to extract URI components.

-
Introduction

URI components can be extracted from -an URI using TUriC8::Extract() and passing a TUriComponent flag. -For example, EUriQuery or EUriPath.

-
Extracting a scheme component

The following code -fragment illustrates how to extract a scheme component. Parse the URI before -the component is extracted calling TUriParser8::Parse().

-_LIT8( KUri,"http://web.intra/Dev/Sysdoc/devlib.htm" ); -TUriParser8 parser; // URI parser object -TInt result = parser.Parse( KUri ); // parse the URI descriptor - -//Extract the scheme component from the parsed URI -const TDesC8& des = parser.Extract( EUriScheme ); -

where des is a descriptor that contains the -extracted scheme component. Other components such as userinfo, host, port -and so on defined in TUriComponent can be extracted in -a similar way.

-
Extracting an authority component

To retrieve a -specific authority component from the URI, call TAuthority8::Extract(). -The following code fragment illustrates how to extract a authority component.

-_LIT8( KAuthorityDesc, "http://user:pass@www.mypage.com" ); -TAuthorityParser8 authorityParser; //Authority parser object - -authorityParser.Parse( KAuthorityDesc ); //Parse the authority descriptor -//extract the user infomation from the authority component -const TDesC8& des = authorityParser.Extract( EAuthorityUserinfo ); -

where, des contains the user info that is -extracted from the authority component. EAuthorityUserinfo is -an enum value of TAuthorityComponent. Similarly, host and -port can be extracted using EAuthorityHost and EAuthorityPort respectively, -which are defined in TAuthorityComponent.

-
Displaying the URI

To create a new descriptor containing -the desired component or the full URI, call TUriC8::DisplayFormL().

This -converts a component into a new descriptor. The component to be converted -can take any value between EUriScheme and EUriFragment or EUriComplete (for -the full URI). This method is used to obtain a pointer to a 16 bit descriptor -for GUI display of URI.

HBufC16* uri = parsedUri->DisplayFormL( EUriComplete );

where EUriComplete indicates that all the components -in the URI are displayed.

To fetch the URI, call TUriC8::UriDes(). -This returns a pointer to 8 bit descriptor(TDesC8) containing -the URI, which is used for HTTP requests.

-
Displaying authority

To create a new descriptor -containing a specific component or the full authority component, call TAuthority8::DisplayFormL().

This -converts a component into a new descriptor. The component to be converted -can take any value between EAuthorityUserinfo and EAuthorityPort or -the full authority, EAuthorityComplete.

HBufC authority = parsedUri->DisplayFormL( EAuthorityComplete );

where EAuthorityComplete means that the complete authority -is displayed.

-
See also

For related information, see:

HTTP Utilities Library Overview

+ + + + + +Extracting +URI Components +

This tutorials describe the steps to extract URI components.

+
Introduction

URI components can be extracted from +an URI using TUriC8::Extract() and passing a TUriComponent flag. +For example, EUriQuery or EUriPath.

+
Extracting a scheme component

The following code +fragment illustrates how to extract a scheme component. Parse the URI before +the component is extracted calling TUriParser8::Parse().

+_LIT8( KUri,"http://web.intra/Dev/Sysdoc/devlib.htm" ); +TUriParser8 parser; // URI parser object +TInt result = parser.Parse( KUri ); // parse the URI descriptor + +//Extract the scheme component from the parsed URI +const TDesC8& des = parser.Extract( EUriScheme ); +

where des is a descriptor that contains the +extracted scheme component. Other components such as userinfo, host, port +and so on defined in TUriComponent can be extracted in +a similar way.

+
Extracting an authority component

To retrieve a +specific authority component from the URI, call TAuthority8::Extract(). +The following code fragment illustrates how to extract a authority component.

+_LIT8( KAuthorityDesc, "http://user:pass@www.mypage.com" ); +TAuthorityParser8 authorityParser; //Authority parser object + +authorityParser.Parse( KAuthorityDesc ); //Parse the authority descriptor +//extract the user infomation from the authority component +const TDesC8& des = authorityParser.Extract( EAuthorityUserinfo ); +

where, des contains the user info that is +extracted from the authority component. EAuthorityUserinfo is +an enum value of TAuthorityComponent. Similarly, host and +port can be extracted using EAuthorityHost and EAuthorityPort respectively, +which are defined in TAuthorityComponent.

+
Displaying the URI

To create a new descriptor containing +the desired component or the full URI, call TUriC8::DisplayFormL().

This +converts a component into a new descriptor. The component to be converted +can take any value between EUriScheme and EUriFragment or EUriComplete (for +the full URI). This method is used to obtain a pointer to a 16 bit descriptor +for GUI display of URI.

HBufC16* uri = parsedUri->DisplayFormL( EUriComplete );

where EUriComplete indicates that all the components +in the URI are displayed.

To fetch the URI, call TUriC8::UriDes(). +This returns a pointer to 8 bit descriptor(TDesC8) containing +the URI, which is used for HTTP requests.

+
Displaying authority

To create a new descriptor +containing a specific component or the full authority component, call TAuthority8::DisplayFormL().

This +converts a component into a new descriptor. The component to be converted +can take any value between EAuthorityUserinfo and EAuthorityPort or +the full authority, EAuthorityComplete.

HBufC authority = parsedUri->DisplayFormL( EAuthorityComplete );

where EAuthorityComplete means that the complete authority +is displayed.

+
See also

For related information, see:

HTTP Utilities Library Overview

\ No newline at end of file