473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Wildcards in <url-pattern>

Hello,

I would like to have one servlet serve all requests that do not
require any "processing". For example, CSS's, JPG's, etc.

I know I can accomlish this with an entry in WEB.XML:

<servlet-mapping>
<servlet-name>ForwardServlet</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
However; here's my problem. Let's say a page has the following:

<LINK rel=stylesheet type="text/css" href="style.css">

Now, since there is no mapping then "style.css" must reside in the
root. However; I can have my servlet search for "style.css". Let's
say it finds it at "MyApp/ThisClient/style.css".

So, my servlet adds the path and then forwards it on.

However; since WEB.XML says "*.css", well, now my request with
"MyApp/ThisClient/style.css" gets caught too.

The result is an endless loop until the server dies.

Is there any way around this?

I want the css file caught by WEB.XML the first time, after I build
the full path, I just want to serve it.

Any help out there?

Thanks,
Ed
Jul 17 '05 #1
2 7796
Edward Patrick wrote:
However; here's my problem. Let's say a page has the following:

<LINK rel=stylesheet type="text/css" href="style.css">

Now, since there is no mapping then "style.css" must reside in the
root. However; I can have my servlet search for "style.css". Let's
say it finds it at "MyApp/ThisClient/style.css".

So, my servlet adds the path and then forwards it on.

However; since WEB.XML says "*.css", well, now my request with
"MyApp/ThisClient/style.css" gets caught too.

The result is an endless loop until the server dies.

Is there any way around this?


You could consider using a filter instead. The first time through,
you'd catch the request and set an attribute in it that it's being
handled. Every other time through, you'd see that attribute and pass it
right through.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Jul 17 '05 #2
EP******@alldata.net (Edward Patrick) writes:

<snip>
So, my servlet adds the path and then forwards it on.

However; since WEB.XML says "*.css", well, now my request with
"MyApp/ThisClient/style.css" gets caught too.


<snip>

Hi

When you say you forward it, I take it you mean that you use sendRedirect.
If that's the case, the easiest way to solve your problem is to use
a request-dispatcher to forward instead:

RequestDispatcher rd = request.getRequestDispatcher(
"MyApp/ThisClient/style.css");
rd.forward(request,response);

HTH
HAND
--
Ola Gustafsson
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Francesco Moi | last post by:
Hello. I'm trying to build a RSS feed for my website. It starts: ----------------//--------------------- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE rss PUBLIC "-//Netscape...
2
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are...
4
by: higabe | last post by:
Three questions 1) I have a string function that works perfectly but according to W3C.org web site is syntactically flawed because it contains the characters </ in sequence. So how am I...
34
by: Mark Moore | last post by:
It looks like there's a pretty serious CSS bug in IE6 (v6.0.2800.1106). The HTML below is validated STRICT HTML 4.01 and renders as I would expect in Opera, FrontPage, and Netscape. For some...
11
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom,...
7
by: Tony | last post by:
I'm using XmlTextWriter to write XML to a string and XmlDocument to read it back. Every thing works OK except if my data contains a < or >. If this is the case they get saved as < > repectively....
0
by: Doug | last post by:
I got this as soon as I installed Vis Studio 2003, which either requires different permissions to inetpub\wwwroot or changed them during installation. I couldn't open an existing solution or...
5
by: Nathan Sokalski | last post by:
My Web.config file contains the following section to register some of my UserControls: <pages> <controls> <add tagPrefix="NATE" tagName="Banner" src="~/Banner.ascx"/> <add tagPrefix="NATE"...
2
by: sf | last post by:
Hundsome Money Online Guaranteed payment month after month · Work part time or full time as you like . Make quick good cash working 2 to 3 hours a day . Work anywhere from home/ office without...
0
by: reema | last post by:
EJB Interview Questions http://interviewdoor.com/technical/EJB-Interview-Questions.htm CSS Interview Questions http://interviewdoor.com/technical/CSS-Interview-Questions.htm C Interview Questions...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.