Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > I'm not sure what to put in the subject but opinions sought please

Reply
Thread Tools

I'm not sure what to put in the subject but opinions sought please

 
 
Dundonald
Guest
Posts: n/a
 
      11-12-2007
I'm not sure how to best ask this question so I hope I make myself
clear

I'm wondering what the best way to implement dynamic handling of
customer defined functionality in a J2EE web app. For example ...

A customer hitting URL http://www.somesite.com/someservlet?param=some_value

is the obvious solution, the servlet can handle the logic on the
paramater passed and act accordingly. What I'm wondering is, is it
possible for a URL such as the following:

http://www.somesite.com/some_value

that would automatically trigger a default / specified servlet and
pass in "some_value" as a paramter to that servlet.

Know what I mean?

To put this in to context I will write code to allow the customer to
configure certain functionality of the site and give that
functionality a unique name. But rather than have that functionality
requested by explicity calling a servlet and passing a paramater I
would like it easier for the customer to remember by calling the site
domain followed by the unique name of their functionality.

 
Reply With Quote
 
 
 
 
Juha Laiho
Guest
Posts: n/a
 
      11-12-2007
Dundonald <(E-Mail Removed)> said:
>I'm wondering what the best way to implement dynamic handling of
>customer defined functionality in a J2EE web app. For example ...
>
>A customer hitting URL http://www.somesite.com/someservlet?param=some_value
>
>is the obvious solution, the servlet can handle the logic on the
>paramater passed and act accordingly. What I'm wondering is, is it
>possible for a URL such as the following:
>
>http://www.somesite.com/some_value
>
>that would automatically trigger a default / specified servlet and
>pass in "some_value" as a paramter to that servlet.


I wouldn't do quite that; that'd give a too good possibility for the
customer to shoot themselves in the foot (f.ex. by using the same name
with an existing servlet (or even static resource). This of course
supposing that the same domain is used for anything else than this
customizable functionality.

>To put this in to context I will write code to allow the customer to
>configure certain functionality of the site and give that
>functionality a unique name. But rather than have that functionality
>requested by explicity calling a servlet and passing a paramater I
>would like it easier for the customer to remember by calling the site
>domain followed by the unique name of their functionality.


Would it be possible to have the customer to remember one word in
addition to their domain name? If so, you could create a servlet
handler which would intercept all accesses to

http://www.somesite.com/one_word/*

.... and then work its magic based on whatever is supplied as *.
This would still be less things to remember than the HTTP query
calling syntax. HP is one company using this; f.ex. you can try
hp.com/go/java (which, by the way, does not redirect to Sun..
hp.com/go/support
among others. These make great short links to be used f.ex. on
brochures and training material.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
 
Reply With Quote
 
 
 
 
Dundonald
Guest
Posts: n/a
 
      11-12-2007
On Nov 12, 7:17 pm, Juha Laiho <(E-Mail Removed)> wrote:
> Dundonald <(E-Mail Removed)> said:
>
> >I'm wondering what the best way to implement dynamic handling of
> >customer defined functionality in a J2EE web app. For example ...

>
> >A customer hitting URLhttp://www.somesite.com/someservlet?param=some_value

>
> >is the obvious solution, the servlet can handle the logic on the
> >paramater passed and act accordingly. What I'm wondering is, is it
> >possible for a URL such as the following:

>
> >http://www.somesite.com/some_value

>
> >that would automatically trigger a default / specified servlet and
> >pass in "some_value" as a paramter to that servlet.

>
> I wouldn't do quite that; that'd give a too good possibility for the
> customer to shoot themselves in the foot (f.ex. by using the same name
> with an existing servlet (or even static resource). This of course
> supposing that the same domain is used for anything else than this
> customizable functionality.


Yes it's a good point but I've thought about that one I'll
maintain a database record of reserved words that can't be used and
when the customer defines their name it too (the name) will be stored
in a database table so that any subsequent new names added will be
checked against this table hence ensuring uniqueness.

>
> >To put this in to context I will write code to allow the customer to
> >configure certain functionality of the site and give that
> >functionality a unique name. But rather than have that functionality
> >requested by explicity calling a servlet and passing a paramater I
> >would like it easier for the customer to remember by calling the site
> >domain followed by the unique name of their functionality.

>
> Would it be possible to have the customer to remember one word in
> addition to their domain name? If so, you could create a servlet
> handler which would intercept all accesses to
>
> http://www.somesite.com/one_word/*
>
> ... and then work its magic based on whatever is supplied as *.
> This would still be less things to remember than the HTTP query
> calling syntax. HP is one company using this; f.ex. you can try
> hp.com/go/java (which, by the way, does not redirect to Sun..
> hp.com/go/support
> among others. These make great short links to be used f.ex. on
> brochures and training material.


Thanks that's not a bad suggestion. The question I have then is how
is the servlet handler created for a specific servlet to pick up
anything from "go" for example and then does the servlet pick up *?
To pick up * would the servlet still use request.getParamater()
method? If so what paramater name would it use to pick up the content
of *?

Thanks

 
Reply With Quote
 
derek
Guest
Posts: n/a
 
      11-12-2007
On 11/12/2007 at 14:45:33, Dundonald <(E-Mail Removed)> wrote:

> Thanks that's not a bad suggestion. The question I have then is how
> is the servlet handler created for a specific servlet to pick up
> anything from "go" for example and then does the servlet pick up *?
> To pick up * would the servlet still use request.getParamater()
> method? If so what paramater name would it use to pick up the content
> of *?
> Thanks


Look up information on the web.xml file.
You can put something like this in there.

<servlet-mapping>
<servlet-name>ServletABC</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

The ServletABC then could look at the actual request and see where to send it based on the request.
If you do a search for "servlet-mapping" you should get tons of examples.
 
Reply With Quote
 
Chris ( Val )
Guest
Posts: n/a
 
      11-13-2007
On Nov 13, 6:45 am, Dundonald <(E-Mail Removed)> wrote:
> On Nov 12, 7:17 pm, Juha Laiho <(E-Mail Removed)> wrote:
>
>
>
>
>
> > Dundonald <(E-Mail Removed)> said:

>
> > >I'm wondering what the best way to implement dynamic handling of
> > >customer defined functionality in a J2EE web app. For example ...

>
> > >A customer hitting URLhttp://www.somesite.com/someservlet?param=some_value

>
> > >is the obvious solution, the servlet can handle the logic on the
> > >paramater passed and act accordingly. What I'm wondering is, is it
> > >possible for a URL such as the following:

>
> > >http://www.somesite.com/some_value

>
> > >that would automatically trigger a default / specified servlet and
> > >pass in "some_value" as a paramter to that servlet.

>
> > I wouldn't do quite that; that'd give a too good possibility for the
> > customer to shoot themselves in the foot (f.ex. by using the same name
> > with an existing servlet (or even static resource). This of course
> > supposing that the same domain is used for anything else than this
> > customizable functionality.

>
> Yes it's a good point but I've thought about that one I'll
> maintain a database record of reserved words that can't be used and
> when the customer defines their name it too (the name) will be stored
> in a database table so that any subsequent new names added will be
> checked against this table hence ensuring uniqueness.
>
>
>
>
>
>
>
> > >To put this in to context I will write code to allow the customer to
> > >configure certain functionality of the site and give that
> > >functionality a unique name. But rather than have that functionality
> > >requested by explicity calling a servlet and passing a paramater I
> > >would like it easier for the customer to remember by calling the site
> > >domain followed by the unique name of their functionality.

>
> > Would it be possible to have the customer to remember one word in
> > addition to their domain name? If so, you could create a servlet
> > handler which would intercept all accesses to

>
> >http://www.somesite.com/one_word/*

>
> > ... and then work its magic based on whatever is supplied as *.
> > This would still be less things to remember than the HTTP query
> > calling syntax. HP is one company using this; f.ex. you can try
> > hp.com/go/java (which, by the way, does not redirect to Sun..
> > hp.com/go/support
> > among others. These make great short links to be used f.ex. on
> > brochures and training material.

>
> Thanks that's not a bad suggestion. The question I have then is how
> is the servlet handler created for a specific servlet to pick up
> anything from "go" for example and then does the servlet pick up *?
> To pick up * would the servlet still use request.getParamater()
> method? If so what paramater name would it use to pick up the content
> of *?


I agree with Derek.

You could also look into setting up default parameters, in
your deployment descriptor, and read them via obtaining either
a "ServletConfig" or "ServletContext".

<init-param>
<param-name>DefaultCity</param-name>
<param-value>Jakarta</param-value>
</init-param>

<context-param>
<param-name>DefaultCity</param-name>
<param-value>Jakarta</param-value>
<description>A town with crazy traffic</description>
</context-param>

--
Chris

 
Reply With Quote
 
Dundonald
Guest
Posts: n/a
 
      11-13-2007
On 12 Nov, 21:20, derek wrote:
> On 11/12/2007 at 14:45:33, Dundonald <(E-Mail Removed)> wrote:
>
> > Thanks that's not a bad suggestion. The question I have then is how
> > is the servlet handler created for a specific servlet to pick up
> > anything from "go" for example and then does the servlet pick up *?
> > To pick up * would the servlet still use request.getParamater()
> > method? If so what paramater name would it use to pick up the content
> > of *?
> > Thanks

>
> Look up information on the web.xml file.
> You can put something like this in there.
>
> <servlet-mapping>
> <servlet-name>ServletABC</servlet-name>
> <url-pattern>/*</url-pattern>
> </servlet-mapping>
>
> The ServletABC then could look at the actual request and see where to send it based on the request.
> If you do a search for "servlet-mapping" you should get tons of examples.


Thanks I'll take a look.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
No Subject for this subject George MCAD 0 05-20-2005 10:19 AM
Add/Remove Programs Help Kinda Wierd Do Not Ignore Terrable Subject JustIgnore The Subject Oops Whatever Duh Samuel Townsend Computer Support 0 10-13-2004 12:49 AM
Verdana and other web fonts -- opinions sought Jim Royal HTML 40 09-09-2003 04:15 PM
Off Subject but im sure you guys can answer Rick MCSA 7 08-18-2003 02:27 PM
Re: Don, please provide more information. but try not to put it all in the subject line cos it's bloody irritating. BTW read the groups FAQ Ted Kennedy Computer Support 0 06-23-2003 06:50 PM



Advertisments