Learning to work with HTTP using RoR

im trying to learn how to handle http
here is the scenario:

www.mysite.com performs an HTTParty.post to www.2ndsite.com
www.2ndsite.com processes the data
www.2ndsite.com will post back to www.mysite.com the resulting data

here are the questions that i have:
is there any difference in the way to handle the incoming data? (im
used mainly to internal object to object communication, so my worry is
iba yung way of handling the data)
can you guys suggest literature to read on how to learn on about this
issue.

thank you in advance!!!

Jason Agujo wrote:

im trying to learn how to handle http
here is the scenario:

www.mysite.com performs an HTTParty.post to www.2ndsite.com
www.2ndsite.com processes the data
www.2ndsite.com will post back to www.mysite.com the resulting data

here are the questions that i have:
is there any difference in the way to handle the incoming data? (im
used mainly to internal object to object communication, so my worry is
iba yung way of handling the data)
can you guys suggest literature to read on how to learn on about this
issue.

This is why man invented web services. Rails does a fine job of
providing REST web services. You should start there. Also look at web
services provides by some of the more popular web applications such as
Basecamp, Lighthouse, PivotalTracker, etc.

http://www.pivotaltracker.com/help/api
http://help.lighthouseapp.com/faqs/api

Here is a clean way of doing this on Suse.

in /etc/apache2/httpd.conf make sure there is an include to a
directory with all of your virtual hosts definitions:

Include /etc/apache2/vhosts.d/*.conf

then in my /etc/apache2/listen.conf I have (it could go anywhere in
reality but SUSE puts it in here.) And I am willing to bet that this
is the part you have missed out if you are still not up and running:

NameVirtualHost *:80

and as I use Passenger i have the following file: /etc/apache2/
vhosts.d/passenger.conf

these are the Apache directived to load the passenger runtime module

for Rails. These are used by the rails virtual hosts

LoadModule passenger_module /usr/lib64/ruby/gems/1.8/gems/
passenger-2.2.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib64/ruby/gems/1.8/gems/passenger-2.2.2
PassengerRuby /usr/bin/ruby
PassengerUserSwitching off
PassengerDefaultUser wwwrun

then for each of your virtual hosts put a file in /etc/apache2/
vhosts.d/example.conf (I redirect example.com to www.example.com for
which you have to enable the rewrite Apache module)

<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.example.com/$1 [L,R]

RailsEnv production
RailsBaseURI /

  <Directory /srv/www/vhosts/example/current/public>
      Options FollowSymLinks
      AllowOverride None
      Order allow,deny
      Allow from All
      </Directory>


    DocumentRoot /srv/www/vhosts/example/current/public

ErrorLog /var/log/apache2/example_production_error_log
TransferLog /var/log/apache2/example_production_access_log
LogLevel warn

Another simple thing here is that if you rename a example.conf to
example.conf.disable and do a rcapache2 restart then you can take a
virtual host off-line.

I did think at one stage at templating this using capistano (and some
have) but I decided to keep everything in Git. Then it is easy to
move virtual hosts between servers.

On my setup I am still not happy on where the errors go to (mainly the
default server error log for some reason) so any ideas out there on
why this is the case.

O.