From: Chris W. <la...@us...> - 2004-10-04 12:54:42
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14693 Modified Files: URL.pm Log Message: OIN-79: allow the URL escaping to not happen based on an input parameter Index: URL.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/URL.pm,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** URL.pm 4 Oct 2004 04:06:22 -0000 1.24 --- URL.pm 4 Oct 2004 12:54:32 -0000 1.25 *************** *** 75,79 **** sub create { ! my ( $class, $url_base, $params ) = @_; $log ||= get_logger( LOG_OI ); my $param_info = ( $log->is_debug ) --- 75,79 ---- sub create { ! my ( $class, $url_base, $params, $do_not_escape ) = @_; $log ||= get_logger( LOG_OI ); my $param_info = ( $log->is_debug ) *************** *** 86,90 **** $log->debug( "Creating image URL from '$url_base' ", "and params '$param_info'" ); ! return $class->create_image( $url_base, $params ); } elsif ( $params->{STATIC} ) { --- 86,90 ---- $log->debug( "Creating image URL from '$url_base' ", "and params '$param_info'" ); ! return $class->create_image( $url_base, $params, $do_not_escape ); } elsif ( $params->{STATIC} ) { *************** *** 93,114 **** $log->debug( "Creating static URL from '$url_base' ", "and params '$param_info'" ); ! return $class->create_image( $url_base, $params ); } $log->is_debug && $log->debug( "Creating deployment URL from '$url_base' ", "and params '$param_info'" ); ! return $class->_create_deployment( DEPLOY_URL, $url_base, $params ); } sub create_image { ! my ( $class, $url_base, $params ) = @_; return $class->_create_deployment( ! DEPLOY_IMAGE_URL, $url_base, $params ); } sub create_static { ! my ( $class, $url_base, $params ) = @_; return $class->_create_deployment( ! DEPLOY_STATIC_URL, $url_base, $params ); } --- 93,115 ---- $log->debug( "Creating static URL from '$url_base' ", "and params '$param_info'" ); ! return $class->create_image( $url_base, $params, $do_not_escape ); } $log->is_debug && $log->debug( "Creating deployment URL from '$url_base' ", "and params '$param_info'" ); ! return $class->_create_deployment( ! DEPLOY_URL, $url_base, $params, $do_not_escape ); } sub create_image { ! my ( $class, $url_base, $params, $do_not_escape ) = @_; return $class->_create_deployment( ! DEPLOY_IMAGE_URL, $url_base, $params, $do_not_escape ); } sub create_static { ! my ( $class, $url_base, $params, $do_not_escape ) = @_; return $class->_create_deployment( ! DEPLOY_STATIC_URL, $url_base, $params, $do_not_escape ); } *************** *** 117,122 **** sub _create_deployment { ! my ( $class, $deploy_under, $url_base, $params ) = @_; ! $url_base = _url_escape( $url_base ); if ( $deploy_under ) { $url_base = join( '', $deploy_under, $url_base ); --- 118,125 ---- sub _create_deployment { ! my ( $class, $deploy_under, $url_base, $params, $do_not_escape ) = @_; ! unless ( $do_not_escape ) { ! $url_base = _url_escape( $url_base ); ! } if ( $deploy_under ) { $url_base = join( '', $deploy_under, $url_base ); *************** *** 140,144 **** sub create_from_action { ! my ( $class, $action, $task, $params ) = @_; $log ||= get_logger( LOG_OI ); --- 143,147 ---- sub create_from_action { ! my ( $class, $action, $task, $params, $do_not_escape ) = @_; $log ||= get_logger( LOG_OI ); *************** *** 165,169 **** $log->debug( uchk( "Creating URL from action '%s' and task " . "'%s' -- '%s'", $action, $task, $url_base ) ); ! return $class->create( $url_base, $params ); } --- 168,172 ---- $log->debug( uchk( "Creating URL from action '%s' and task " . "'%s' -- '%s'", $action, $task, $url_base ) ); ! return $class->create( $url_base, $params, $do_not_escape ); } *************** *** 314,318 **** Returns: URL with leading server context. ! B<create( $base_url, \%params )> Create a URL using the deployed context (if any), a C<$base_url> and --- 317,321 ---- Returns: URL with leading server context. ! B<create( $base_url, [ \%params, $do_not_escape ] )> Create a URL using the deployed context (if any), a C<$base_url> and *************** *** 324,328 **** have a trailing '?' to indicate the start of a query string. This is important to note if you are doing further manipulation of the URL, ! such as you with if you were embedding it in generated Javascript. Return: URL formed from the deployed context, C<$base_url> and --- 327,342 ---- have a trailing '?' to indicate the start of a query string. This is important to note if you are doing further manipulation of the URL, ! such as you with if you were embedding it in generated ! Javascript. Note that the parameter names and values are URI-escaped. ! ! Unless C<$do_not_escape> is set to a true value we also escape the ! C<$base_url>. (This makes URL-escaping the default.) So if you ! specify: ! ! $url->create( '/foo/bar is baz/' ); ! ! You'll get in return: ! ! /foo/bar%20is%20baz/ Return: URL formed from the deployed context, C<$base_url> and *************** *** 365,369 **** # $url = '/cgi-bin/oi.cgi/Public/foo?name=Mario%20Lemiux' ! B<create_image( $base_url, \%params )> Create a URL using the deployed image context (if any), a C<$base_url> --- 379,383 ---- # $url = '/cgi-bin/oi.cgi/Public/foo?name=Mario%20Lemiux' ! B<create_image( $base_url, [ \%params, $do_not_escape ] )> Create a URL using the deployed image context (if any), a C<$base_url> *************** *** 377,380 **** --- 391,398 ---- such as you with if you were embedding it in generated Javascript. + Unless C<$do_not_escape> is set to a true value we URI-escape the + C<$base_url>. (We always URI-escape the query arguments and values + created from C<\%params>.) + Return: URL formed from the deployed context, C<$base_url> and C<\%params>. *************** *** 411,414 **** --- 429,436 ---- such as you with if you were embedding it in generated Javascript. + Unless C<$do_not_escape> is set to a true value we URI-escape the + C<$base_url>. (We always URI-escape the query arguments and values + created from C<\%params>.) + Return: URL formed from the deployed context, C<$base_url> and C<\%params>. *************** *** 430,434 **** # $url = '/STAT/reports/q1-2003-01.pdf' ! B<create_from_action( $action, $task, \%params )> Similar to C<create()>, except first we find the primary URL for --- 452,456 ---- # $url = '/STAT/reports/q1-2003-01.pdf' ! B<create_from_action( $action, [ $task, \%params, $do_not_escape ] )> Similar to C<create()>, except first we find the primary URL for *************** *** 441,444 **** --- 463,470 ---- C<undef>. + Unless C<$do_not_escape> is set to a true value we URI-escape the URL + created from the action name and task. (We always URI-escape the query + arguments and values created from C<\%params>.) + See discussion in L<OpenInteract2::Action|OpenInteract2::Action> under C<MAPPING URL TO ACTION> for what the 'primary URL' is and other |