aspose file tools*
The moose likes Tomcat and the fly likes localhost:8080 --> mydomain.com Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "localhost:8080 --> mydomain.com" Watch "localhost:8080 --> mydomain.com" New topic
Author

localhost:8080 --> mydomain.com

deb platt
Ranch Hand

Joined: Jan 23, 2008
Posts: 44
Please see my following post.
[ January 24, 2008: Message edited by: deb platt ]
deb platt
Ranch Hand

Joined: Jan 23, 2008
Posts: 44
I am trying to figure out how you go from being http://localhost:8080/myContext/somefile to being http://www.mydomain.com/somefile. I'm using Apache tomcat, and I figure there must be some way of configuring tomcat to do this.
[ January 24, 2008: Message edited by: deb platt ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61770
    
  67

Originally posted by deb platt:
Please excuse the wording of my original post. I was in the middle of editing it, and it got posted by accident

Click on the notepad and pencil icon to revise a post with problems.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Moving to our Tomcat forum.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You want your app to be the root context in your container.

In Tomcat, the easiest way to do that is to rename your app's directory to "ROOT". You might want to back up the ROOT app that ships with Tomcat so you can move it back in for debugging, if necessary.
deb platt
Ranch Hand

Joined: Jan 23, 2008
Posts: 44
Thanks for suggesting that I install my web application as ROOT. After doing this, everything has been working as I had hoped, except for one thing. When I enter my domain, an authentication form appears, as expected. I enter my username and password, and intead of being directed to my home page, the follow-up is a 404 message saying /favicon.ico is not available. I am wondering if this is something left over from the default ROOT directory. There is no reference to /favicon.ico within my web app.

After getting this 404 message, if I explicitly enter my home page's URL, everything from then on seems to be working well.

Deb
deb platt
Ranch Hand

Joined: Jan 23, 2008
Posts: 44
I tried copying the favicon.ico from the original root into my root, and now after being authenticated, a web page displaying favicon.ico appears in my firefox browser instead of my home page.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Can you post your security-constraint entry?
deb platt
Ranch Hand

Joined: Jan 23, 2008
Posts: 44
<security-constraint>
<web-resource-collection>
<web-resource-name>testsecurity</web-resource-name>
<url-pattern>/*</url-pattern>
<url-pattern>*.class</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>Admin</role-name>
</auth-constraint>
</security-constraint>
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I wonder if is causing the request for favicon.ico (something that I think browser's do automatically) to be trapped as your last request for a resource and trying to force that request through security.

Do you really need to check everything or could you use a less restrictive url-pattern (or series of url patterns)?

If not, I wonder if adding an explicit link to an icon will eliminate the automatic request by the browser...
deb platt
Ranch Hand

Joined: Jan 23, 2008
Posts: 44
I tried adding the <link ...> element, but that didn't help. As soon as I was authenticated, I was presented with the favicon.ico as my first page.

I removed the <link ...> element and altered my security constraint to match the following url patterns:
<url-pattern>*.html</url-pattern>
<url-pattern>*.class</url-pattern>
<url-pattern>*.jsp</url-pattern>
Once I did that, my problem with the favicon.ico went away, and the icon even appeared in the address field of my browser as it should.

I had set up my security constraint to be something like this originally when the site was being accessed as http://localhost:8080/myContext However I encountered a problem with my authentication form, which was a .jsp file. If I entered the URL as http://localhost:8080/myContext, I was challenged to authenticate, and everything worked fine. However, if I entered the URL as http://localhost:8080/myContext/ with a closing slash, I would authenticate, and then I would be presented the login.jsp form again. And if I filled it out a second time, I got a 404 error saying j_security_check was not available. That was worrying me, so I fiddled with the serurity-constraint element some more. But regardless, I always had the same difficulty if the URL was entered with a closing slash.

Now that I'm trying out the web app as ROOT, it doesn't seem to matter whether there is a trailing slash in the address, which is a relief.

Thank you for your help.

Deb
[ January 24, 2008: Message edited by: deb platt ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: localhost:8080 --> mydomain.com