Sponsored Content
Top Forums Web Development APACHE rewrite / redirect URL Post 302246168 by ampo on Monday 13th of October 2008 04:09:45 AM
Old 10-13-2008
APACHE rewrite / redirect URL

Hello.

I have scenario where a Client send request to Server1.
Server1 send request to Server2.
Request are xmlHTTPRequest - need to get data (XML) from Server2 back to client.
Trying to use APACHE proxy...


Anyone can help?
What to download / configure / ...?

Thank you for your help.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Apache Rewrite help!

I am trying to write RewriteRule on Apache_1.3.26 to get users web page from another server. for example if users tries to get web page on www.somedomain.com/~usersname it will get the web page from www.testdomain.com/~username without redirect and users will not be aware of any redirect... (1 Reply)
Discussion started by: hassan2
1 Replies

2. Cybersecurity

APACHE rewrite / redirect URL

Hello. I have scenario where a Client send request to Server1. Server1 send request to Server2. Request are xmlHTTPRequest - need to get data (XML) from Server2 back to client. Trying to use APACHE proxy... Anyone can help? What to download / configure / ...? Thank you for your help. (1 Reply)
Discussion started by: ampo
1 Replies

3. Web Development

Apache rewrite rules.

Hi, I am new to Apache but I have requirement as follows. if the url is http://images/data1/templates/ it should redirect to http:/172.20.224.23/templates/ if the url doesn't have "data1/templates" (mean http://images/) it should redirect to http://images:8080/. I tried as below ... (3 Replies)
Discussion started by: sambadamerla
3 Replies

4. Web Development

Regex to rewrite URL to another URL based on HTTP_HOST?

I am trying to find a way to test some code, but I need to rewrite a specific URL only from a specific HTTP_HOST The call goes out to http://SUB.DOMAIN.COM/showAssignment/7bde10b45efdd7a97629ef2fe01f7303/jsmodule/Nevow.Athena The ID in the middle is always random due to the cookie. I... (5 Replies)
Discussion started by: EXT3FSCK
5 Replies

5. Red Hat

Need some help on tomcat URL rewrite or mod_jk

I am trying to remove the context name from the url of my server. Current URL - http://www.domainname.com/MyApp/ What I need to make is to make it avaialble at - http://www.domainname.com/ I have already tried couple of things like below - RewriteEngine On RewriteCond... (0 Replies)
Discussion started by: rockf1bull
0 Replies

6. UNIX for Advanced & Expert Users

Apache rewrite rule help needed

Hi All, I want to redirect from http://localhost/abc/xyz/def?cc=dk&lc=da to http://localhost/abc/mnc/pdf?cc=dk&lc=da. Please suggest a rewrite rule. (0 Replies)
Discussion started by: jagnikam
0 Replies

7. Web Development

Append query string via URL rewrite in apache

Hi, Googled around but I couldn't find anything similar. I'm looking to do the following in apache.. if a user comes into the following URL. http://www.example.com/some/thing.cid?wholebunch_of_stuff_here keep the URL exactly as is BUT add &something at the very end of it. thanks in... (1 Reply)
Discussion started by: kmaq7621
1 Replies

8. Web Development

Mod_rewrite - URL rewrite based upon HTTP_REFERER

Hello, I have added following rewrite cond and rewrite rules but it does not work. RewriteCond %{HTTP_REFERER} ^http://192\.168\.1\.150/categories/.*$ RewriteRule ^(.*)$ http://www.blahblah.com/ When I hit url : http://192.168.1.150/categories/881-Goes?page=7 in my browser - it... (2 Replies)
Discussion started by: ashokvpp
2 Replies

9. Web Development

Apache rewrite/redirect parameters explanation

hi what is the meaning of the below code, please explain in details RewriteRule '^/(.*)$1$2/?' (1 Reply)
Discussion started by: raghur77
1 Replies

10. Web Development

Redirect URL containing #!

I have a Rewrite Rule that helps me redirect a page with no hindrance. I am rewriting mydomain.com/best to mydomain.com/#!/ using RewriteRule ^\/best\/? /#!/ Now I want to Rewrite mydomain.com/#!/best to (0 Replies)
Discussion started by: Junaid Subhani
0 Replies
XML::Atom::Server(3pm)					User Contributed Perl Documentation				    XML::Atom::Server(3pm)

NAME
XML::Atom::Server - A server for the Atom API SYNOPSIS
package My::Server; use base qw( XML::Atom::Server ); sub handle_request { my $server = shift; $server->authenticate or return; my $method = $server->request_method; if ($method eq 'POST') { return $server->new_post; } ... } my %Passwords; sub password_for_user { my $server = shift; my($username) = @_; $Passwords{$username}; } sub new_post { my $server = shift; my $entry = $server->atom_body or return; ## $entry is an XML::Atom::Entry object. ## ... Save the new entry ... } package main; my $server = My::Server->new; $server->run; DESCRIPTION
XML::Atom::Server provides a base class for Atom API servers. It handles all core server processing, both the SOAP and REST formats of the protocol, and WSSE authentication. It can also run as either a mod_perl handler or as part of a CGI program. It does not provide functions specific to any particular implementation, such as posting an entry, retrieving a list of entries, deleting an entry, etc. Implementations should subclass XML::Atom::Server, overriding the handle_request method, and handle all functions such as this themselves. SUBCLASSING
Request Handling Subclasses of XML::Atom::Server must override the handle_request method to perform all request processing. The implementation must set all response headers, including the response code and any relevant HTTP headers, and should return a scalar representing the response body to be sent back to the client. For example: sub handle_request { my $server = shift; my $method = $server->request_method; if ($method eq 'POST') { return $server->new_post; } ## ... handle GET, PUT, etc } sub new_post { my $server = shift; my $entry = $server->atom_body or return; my $id = save_this_entry($entry); ## Implementation-specific $server->response_header(Location => $server->uri . '/entry_id=' . $id); $server->response_code(201); $server->response_content_type('application/x.atom+xml'); return serialize_entry($entry); ## Implementation-specific } Authentication Servers that require authentication for posting or retrieving entries or feeds should override the password_for_user method. Given a username (from the WSSE header), password_for_user should return that user's password in plaintext. This will then be combined with the nonce and the creation time to generate the digest, which will be compared with the digest sent in the WSSE header. If the supplied username doesn't exist in your user database or alike, just return "undef". For example: my %Passwords = ( foo => 'bar' ); ## The password for "foo" is "bar". sub password_for_user { my $server = shift; my($username) = @_; $Passwords{$username}; } METHODS
XML::Atom::Server provides a variety of methods to be used by subclasses for retrieving headers, content, and other request information, and for setting the same on the response. Client Request Parameters o $server->uri Returns the URI of the Atom server implementation. o $server->request_method Returns the name of the request method sent to the server from the client (for example, "GET", "POST", etc). Note that if the client sent the request in a SOAP envelope, the method is obtained from the SOAPAction HTTP header. o $server->request_header($header) Retrieves the value of the HTTP request header $header. o $server->request_content Returns a scalar containing the contents of a POST or PUT request from the client. o $server->request_param($param) XML::Atom::Server automatically parses the PATH_INFO sent in the request and breaks it up into key-value pairs. This can be used to pass parameters. For example, in the URI http://localhost/atom-server/entry_id=1 the entry_id parameter would be set to 1. request_param returns the value of the value of the parameter $param. Setting up the Response o $server->response_header($header, $value) Sets the value of the HTTP response header $header to $value. o $server->response_code([ $code ]) Returns the current response code to be sent back to the client, and if $code is given, sets the response code. o $server->response_content_type([ $type ]) Returns the current Content-Type header to be sent back to the client, and $type is given, sets the value for that header. Processing the Request o $server->authenticate Attempts to authenticate the request based on the authentication information present in the request (currently just WSSE). This will call the password_for_user method in the subclass to obtain the cleartext password for the username given in the request. o $server->atom_body Returns an XML::Atom::Entry object containing the entry sent in the request. USAGE
Once you have defined your server subclass, you can set it up either as a CGI program or as a mod_perl handler. A simple CGI program would look something like this: #!/usr/bin/perl -w use strict; use My::Server; my $server = My::Server->new; $server->run; A simple mod_perl handler configuration would look something like this: PerlModule My::Server <Location /atom-server> SetHandler perl-script PerlHandler My::Server </Location> ERROR HANDLING
If you wish to return an error from handle_request, you can use the built-in error method: sub handle_request { my $server = shift; ... return $server->error(500, "Something went wrong"); } This will be returned to the client with a response code of 500 and an error string of "Something went wrong". Errors are automatically serialized into SOAP faults if the incoming request is enclosed in a SOAP envelope. AUTHOR &; COPYRIGHT Please see the XML::Atom manpage for author, copyright, and license information. perl v5.12.4 2011-09-27 XML::Atom::Server(3pm)
All times are GMT -4. The time now is 09:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy