That part of the URL is not the query string part so I'm not sure why IIS was 
giving that to you as the query string. The query string is everything after 
the question mark which is nothing in your case.

Yes it's safe to use the javax.servlet.xxx request attributes. These are a 
standard part of the servlet api and should be there with all servlet 
containers.

Paul

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
DetailsDotAt
Sent: Friday, April 24, 2009 2:59 PM
To: Open BlueDragon
Subject: [OpenBD] Re: URL Redirects upon 404


Hi Paul,

That worked and Jetty/OpenBD is now processing 404 errors according to
my script.

Unfortunately, the way Jetty is providing some of the variables I need
in my script is different from IIS.

Here is what I need to have happen.

Someone hits www.company.com/12345

there is no folder named 12345, so server throws a 404 error. Before
the 404 is displayed, I have a script which is processed to check
'12345' against a database and if a record is found, it forwards the
user to a url that is also in the database.

With IIS, upon 404, I am given a variable for 'QUERY_STRING' =
404;http://company.com:80/rt45g

In which I run the following code, which essentially parses out the
url and finds the root domain 'company.com' and the first folder after
it 'rt45g'. I then use those two variables to query a database.

-------------------------------------------------------------------------------

<CFSET request_url = #cgi.query_string#>
<CFSET intTempIndex = Find("://", request_url) + 4>
<CFSET intTempIndex1 = Find("://", request_url) + 3>
<CFSET intStartIndex = Find("/", request_url, intTempIndex) + 1>
<CFSET intEndIndex = Find("/", request_url, intStartIndex)>
<CFSET intEndIndex1 = Find("/", request_url, intTempIndex1)>

<CFIF intEndIndex EQ 0>
     <CFSET intEndIndex = Len(request_url) + 1>
</CFIF>

<CFSET rawdomain = Mid(request_url, intTempIndex1, (intEndIndex1 -
intTempIndex1))>
<CFSET domain = replaceList(rawdomain, "www.","")>
<CFSET domain = replaceList(domain, ":80","")>
<CFSET querystring_x = replaceList(cgi.query_string, "404;","")>
<CFSET querystring = replaceList(querystring_x, ":80","")>
<CFSET subDomain = Mid(request_url, intStartIndex, (intEndIndex -
intStartIndex))>

-------------------------------------------------------------------------------


Now, with Jetty, it returns a blank 'QUERY_STRING' variable. So my
script isn't working. But I see the following in the debugging info
(assuming the url was company.com/rt45g)

struct >
javax.servlet.error.message - NOT_FOUND
javax.servlet.error.request_uri - /rt45g
javax.servlet.error.servlet_name - default
javax.servlet.error.status_code - 404
javax.servlet.forward.context_path - [empty string]
javax.servlet.forward.request_uri - /rt45g
javax.servlet.forward.servlet_path - /rt45g
org.mortbay.jetty.error_page - /dns/404redirect.cfm

-----------------------------------------------------------------

Is it safe to use these javax.servlet.error variables? It seems like
it is parsing much of the requested url for me, so I may be able to
simplify my script a bit.

Can someone please point me in the right direction here?


--~--~---------~--~----~------------~-------~--~----~
Open BlueDragon Public Mailing List
 http://groups.google.com/group/openbd?hl=en
 official site @ http://www.openbluedragon.org/

!! save a network - trim replies before posting !!
-~----------~----~----~----~------~----~------~--~---

Reply via email to