Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I have been investigating REST for the last few days, trying to understand how it works, and what it takes to be implemented. I'd like to use it for implementing yet another web application, as I see it as a very efficient way of communicating.

However, I would like my application to do not only the REST part but also the web server part, ideally using the identical URI. So if it's a script talking to the REST interface, just a very basic chunk of XML will get returned, but if it's a browser, then it will get a menu, nice CSS, header, footer and all of the other amenities you normally see on a web page.

  • One alternative is to use a modifier on the URI as Perl Monks does: just add displaytype=xml and get the stripped down version.
  • Another alternative is to put the REST stuff in a sub-directory, so the URI goes first to /rest and then on to /project/foobar.
  • I could also add in my own header field into the request, and just have the handler Do The Right Thing

There may be other approaches .. I'd be interested in hearing from you about any other ideas or thoughts.

Oh, and here's some reading material for those of you interested in REST:

Also, I installed REST::Application -- quite a nice piece of code, and the note I sent to the author got a reply very promptly, always encouraging. It's written for Apache 1.3, and I'm using Apache 2.0, so it didn't work for me. I may just write my own code to disassemble the requests and dispatch them.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds


In reply to Combining a web application and a REST application under a single URI? by talexb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-25 07:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found