aspose file tools*
The moose likes Servlets and the fly likes Change URL http/unbeatableonline.com/swbeatableonline.com to http/unbeatableonline.com Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Change URL http/unbeatableonline.com/swbeatableonline.com to http/unbeatableonline.com" Watch "Change URL http/unbeatableonline.com/swbeatableonline.com to http/unbeatableonline.com" New topic
Author

Change URL http/unbeatableonline.com/swbeatableonline.com to http/unbeatableonline.com

Chino khan
Greenhorn

Joined: Aug 19, 2011
Posts: 7
My servlet is running good as listed below.
URL is http/unbeatableonline.com/unbeatableonline.com

I have servlet running from:
C:\Tomcat 4.1\webapps\ROOT\WEB-INF\classes\Unbeatable\src
Images and css file are running from:
C:\Tomcat 4.1\webapps\ROOT\unbeatable\css
C:\Tomcat 4.1\webapps\ROOT\unbeatable\images

I am accessing my css in the code.
out.println("<link href='../unbeatable/css/style.css' rel='stylesheet' type='text/css' />");

web.xml
<servlet>
<servlet-name>unbeatableonline</servlet-name>
<servlet-class>Unbeatable.src.unbeatableonline</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>unbeatableonline</servlet-name>
<url-pattern>/unbeatableonline.com</url-pattern>
</servlet-mapping>

Now where I need help
I want to run servlet using URL: http/unbeatableonline.com

I changed my web.xml as follows.
<servlet>
<servlet-name>unbeatableonline</servlet-name>
<servlet-class>Unbeatable.src.unbeatableonline</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>unbeatableonline</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

After the change servlet runs fine but I don't have access to my css and image folder

Any help would be appreciated

Thanks Chino Khan
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Mapping / means that all resources will be mapped to the servlet. Obviously not what you want.

Rather, set up a "welcome file" setting.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Chino khan
Greenhorn

Joined: Aug 19, 2011
Posts: 7
Rather, set up a "welcome file" setting. ?

you mean to say I should move my css and image folder to :
C:\Tomcat 4.1\webapps\ROOT\WEB-INF\classes\Unbeatable\src
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

No, I said you should set up a welcome-file setting in your deployment descriptor. That doesn't sound anything at all like "move your files around".
Chino khan
Greenhorn

Joined: Aug 19, 2011
Posts: 7
I will google and try to learn how to set up a welcome-file setting in my deployment descriptor.

Thanks for pointing me in right direction.
Chino khan
Greenhorn

Joined: Aug 19, 2011
Posts: 7
can you see any error with my web-xml
<servlet>
<servlet-name>unbeatableonline</servlet-name>
<servlet-class>Unbeatable.src.unbeatableonline</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>unbeatableonline</servlet-name>
<url-pattern>/unbeatableonline.com</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>unbeatableonline.com</welcome-file>
</welcome-file-list>

http://unbeatableonline.com/unbeatableonline.com works
http://unbeatableonline.com error 404
any clue
Chino khan
Greenhorn

Joined: Aug 19, 2011
Posts: 7
Hi can anyone point me in right direction how to write welcome file. I am stuck.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

It took me exactly 7 seconds to find this other topic on precisely this subject via google.

Please ShowSomeEffort of your own.
Chino khan
Greenhorn

Joined: Aug 19, 2011
Posts: 7
Thanks for your speedy replay.
I have looked at all the links you provided. I think I do not understand the concept. I have been looking for the solution for last 2 days.
Chino khan
Greenhorn

Joined: Aug 19, 2011
Posts: 7
Ok I found the solution:

first make a simple html file and name is as index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://unbeatableonline.com/unbeatableonline.com">
<title>Unbeatable</title>
</head>

<body>
</body>
</html>

now place this file in the root dir of your server in my case it is(C:\Tomcat 4.1\webapps\ROOT)

now modify you web-xml file

<servlet>
<servlet-name>unbeatableonline</servlet-name>
<servlet-class>Unbeatable.src.unbeatableonline</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>unbeatableonline</servlet-name>
<url-pattern>/unbeatableonline.com/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

Thanks a lot Chino Khan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Change URL http/unbeatableonline.com/swbeatableonline.com to http/unbeatableonline.com