[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

IOWA Question (long because of code snippets

Ben Schumacher

10/14/2004 2:29:00 PM

Hello-

I've been looking through the archives of this list some, but I'm feel
like I'm missing some critical (and probably simple) piece of
information. I'm trying to setup a page in IOWA where the URL contains
some a piece of information needed to render the page.

Basically, I want to take URLs like:

http://localhost:2000/details/FOO/

And have my application render a page using FOO as a variable. My
problem is that I'm using IOWA Webrick and it seems that IOWA is just
passing on processing this. However, if I just go to
http://localhost:2000/details/FOO/, it's working correctly. Maybe I'm
using the mapfile wrong? Or do I just not need the mapfile at all?

My MyApplication class looks like this:

require 'iowa_webrick'

class MyApplication < Iowa::Application
def initialize(*args)
@@cachedSession = 10
@mapfile = 'mapfile.cnf'
super
end
end

Iowa.startDaemon('app.cnf')
Iowa.run

And my Main.iwa looks like (which I found on this list):

class Main < Iowa::Component
def setup
$stderr.puts session.context.request.inspect
asin = File.basename(session.context.request.uri)
dispatch_page = page_named('Details')
dispatch_page.parameter = parameter
dispatch_context = Iowa::Context.new(session.context.request,
session.context.response)
dispatch_context.sessionID = session.context.sessionID
dispatch_context.requestID = session.requestCount
dispatch_page.handleResponse(dispatch_context)
session.currentPage = dispatch_page.dup
end
end

And finally, my mapfile.cnf has:

/: Details
/details: Details
/details/: Details
[
Which is obviously mostly useless, I just was trying a bunch of
different things.

Thanks for your help.

Ben



2 Answers

khaines

10/15/2004 11:18:00 AM

0

On Thu, 14 Oct 2004 23:29:13 +0900, Ben Schumacher wrote
> Hello-
>
> I've been looking through the archives of this list some, but I'm
> feel like I'm missing some critical (and probably simple) piece of
> information. I'm trying to setup a page in IOWA where the URL
> contains some a piece of information needed to render the page.
>
> Basically, I want to take URLs like:
>
> http://localhost:2000/details/FOO/

I obviously need to get more documentation up on the web, as you are the
third person in as many days to ask me this.

The exact implementation will depend on exactly what you are doing. If you
use IRC, hop onto the #IOWA channel on freenode.net, and I'll help you sort
out the precise details without boring the list. I try to monitor the
channel most of the time while I am working. If not, email me at
khaines@enigo.com or wyhaines@gmail.com or subscribe to the iowa-general
mailing list hosted at rubyforge.

In general, what you want is a change to Main.iwa. Is your app always going
to start at /details?

If so, eliminate the current Main.iwa and Main.html, and mail your
Details.iwa and Details.html into Main.iwa and Main.html.

Then all requests will start with Details, and it can mine the specific
request path (in session.context.request.uri) for whatever details that it
needs.

If you will have other entry points than just /details, then you need to
alter the current Main.iwa. If you haven't, take a look at Main.iwa. It's
extremely simple in implementation. All it is doing is trying to find a
match between the request path and an entry in the mapfile. If it finds
one, that tells it what component to use. It's very easy to customize this
in order to dispatch to the correct components if your needs are more
complex. Let me know if that's what you need to do and I can help enlighten
you on the process (and at the same time that'll help me develop text to
explain the process).


Thanks,

Kirk Haines


Al Nakba

1/9/2009 7:14:00 AM

0

On Jan 8, 4:57 pm, uNmaiviLambi <tripurant...@yahoo.com> wrote:
> On Jan 8, 6:08 pm, Mirza Ghalib <mghali...@yahoo.com> wrote:
>
> > On Jan 7, 7:29 pm, fruitella <visualseep...@yahoo.com> wrote:
> > A culture that encourages its impressionable young only
> > to kill, destroy and die, to fulfill the nefarious desires of
> > its elders, is doomed. I am talking about Islam.
>
> We are waiting for demise of islam. May be another seven or eight
> years. I do not think there needs to be a nuke attack on Mecca or
> Medina. Islam is in its final days.

Nuke them anyway. it would be hygienic..