Trampoline code again

  • Thread starter Covington Bradshaw
  • Start date
C

Covington Bradshaw

First please do not make trampoline jokes, because when I was 5, I fell
from my brother's bed after happily jumping and since I am in a wheel
chair.

I am looking for a trampoline jsp or servlet. Explanation:
something like ...
http://blablabla/trampoline.jsp?jump="http://albalbalbalb/page.html"
Then show the page.html of someone else albalbalbalb Web site in a frame
of my blablabla Web site or something like that. Got it?

JspWriter out = pageContext.getOut();

URL url;
int responseCode = 0;
HttpURLConnection connection = null;
InputStream input;
BufferedReader dataInput;

try {
jumpTo = URLDecoder.decode(subcontext);
url = new URL(jumpTo);
connection = (HttpURLConnection) url.openConnection();
responseCode = connection.getResponseCode();
}
catch (Exception ex) {}

try {
input = connection.getInputStream();
dataInput = new BufferedReader(new InputStreamReader(input));
while ((line = dataInput.readLine()) != null) {
out.println(line);
}
...

How do I handle links to images etc...?
Any code example?

Thanks, I have to stop typing now and I must go to take a bath.
 
T

Tony Morris

Covington Bradshaw said:
First please do not make trampoline jokes, because when I was 5, I fell
from my brother's bed after happily jumping and since I am in a wheel
chair.

You are assuming you have a sympathetic audience.
This might work in reality (with exceptions - see the next paragraph), but
not Usenet.

Personally, I don't change my behaviour for anyone regardless of their
previous misfortune.
I wouldn't expect others to do it for me either.
This personal trait has nothing to do with Usenet.
I am looking for a trampoline jsp or servlet. Explanation:
something like ...
http://blablabla/trampoline.jsp?jump="http://albalbalbalb/page.html"
Then show the page.html of someone else albalbalbalb Web site in a frame
of my blablabla Web site or something like that. Got it?

No - and that's the funny bit.
In fact, you have earnt yourself a place on an internal network website for
a section title, "Funny Quotes".
Now that we have all stopped giggling, let's put this into perspective.
Let's assume a topic where you are informed and I am not ... lemme think ...
"automotive differential reconditioning". So that's our topic.
Let's then take someone who is requesting information from you (the informed
person).
They do it as follows, "Does anyone have a typewriter jellyfish for balloon
folding in the iron bark cave speak with the handy polyp differential?" Now,
it's quite clear I'm just inserting random nouns/adjectives here in the
sentence, but suppose I was serious - this would be quite amusing for the
person receiving the information, don't you agree?

Here is a clear cut answer:
There is no such thing as a "trampoline servlet". In fact, "trampoline" is
one of the funniest adjectives that I've heard someone use for a servlet. So
in order to answer your question, it would be in your best interest to read
up on the topic so that you can formulate a question that is less funny, and
more answerable. Unless, of course, you share my sense of humour and you
wish to continue providing amusement. If your ego is bruised, then I do not
apologise - others have laughed at my naivety in the past - take it lightly.
Good luck.

http://java.sun.com/docs/books/tutorial/servlets/
 
C

Chris Uppal

Tony said:
Here is a clear cut answer:
There is no such thing as a "trampoline servlet". In fact, "trampoline" is
one of the funniest adjectives that I've heard someone use for a servlet.

Actually, "trampoline" is a quite well-established term for code that just
"bounces" the caller to a different implementation. I have been seeing it used
for several years, and I like and use it myself.

I don't know what the OP means by "trampoline servlet", but if /I/ used the
term then I'd mean a simple servlet that exists only to channel requests to a
different service, either by HTTP redirects, or by forwarding the request
internally. What's more, if I used that term in that sense, then I'd expect to
be understood by my auditors, or at least that they would require only a
brief explanation after which they would find the expression completely
natural.

If that is what the OP is looking for then it seems quite simple; presumably
the difficulty is in maintaining session state across the bounce -- especially
if only part of the session /is/ bounced. I don't know enough about servlet
programming to recommend specific implementation approaches, but it sounds a
common enough requirement that there should be examples, or other guidance,
out there on the Web somewhere.

-- chris
 
S

Sudsy

Chris Uppal wrote:
Actually, "trampoline" is a quite well-established term for code that just
"bounces" the caller to a different implementation. I have been seeing it used
for several years, and I like and use it myself.
<snip>

It was the first time I'd seen the term "trampoline" and was similarly
confused. Now if the OP had called it a "proxy servlet" then I would
have known precisely what he/she was talking about. Using the commonly
accepted terminology facilitates effective communication.
 
T

Tony Morris

Actually, "trampoline" is a quite well-established term for code that just
"bounces" the caller to a different implementation. I have been seeing it used
for several years, and I like and use it myself.

Can you provide a reference to some authoritative source?
Google provides only ad hoc possibilities.
 
C

Chris Uppal

Tony said:
Can you provide a reference to some authoritative source?

No, sorry. This one seems to be a bit of emerging grass-roots terminology, not
something dreamed up by a Big Name. (One of the reasons, apart from its
vividness, that I like it)

FWIW, I first saw it used (in this sense) in one of the papers on
proposed/prototype generics implementations for Java, where it was used to
describe the bytecode that was generated on-the-fly for adapting generic code
to primitive types.

Looking for "trampoline code" (with the quotes) turns up quite a few examples.
Kaffe is the most Java related. There also seems to be a fairly
well-established usage (that I wasn't aware of) that applies it in a more
restrictive sense. See, for instance, the entry for "trampoline" at
jargon.watson-net.com

Google provides only ad hoc possibilities.

There are some things Google can't do :-( Someone mentioned a program called
"News Agent" to me yesterday, and I need to find out more about it; as you can
imagine, Google isn't a lot of help...

[OT: does anyone know of a program with that specific name ? All I know about
it is that it runs under Windows and uses a GUI with some sort of tree widget;
there's no suggestion that it's written in Java.]

-- chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top