wood burning stoves 2.0*
The moose likes JBoss/WildFly and the fly likes Context Path Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Context Path Problem" Watch "Context Path Problem" New topic
Author

Context Path Problem

Eshwar Prasad
Ranch Hand

Joined: Mar 21, 2008
Posts: 202

Hi,

I am using jboss 5.0.1 app server. I have deployed my application myapp.war into server/default folder. In jboss-web.xml i have specified contextpath as myapp.

And my myapp.war folder structure is as below
|_WEB-INF-----------Folder available in myapp.war
|__login.html-----File available in myapp.war
|_cafeApp----------------Folder available in myapp.war
|__index.html--File available under cafeApp folder

Now there is requirement such that when i access http://localhost:8080/ it should lead me to login.html page which is available in root of myapp.war and if i access http://localhost:90 it should lead me to index.html which is found under cafeApp folder.

Please let me know how can execute this

Thanks in advance
Eshwar Prasad
Ranch Hand

Joined: Mar 21, 2008
Posts: 202
Any Help Please
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874



Now there is requirement such that when i access http://localhost:8080/ it should lead me to login.html page which is available in root of myapp.war and if i access http://localhost:90 it should lead me to index.html which is found under cafeApp folder



I really doubt your requirement , how could same server be accessible in 2 http ports ( 8080 , 90). do you mean https for the other port.
Eshwar Prasad
Ranch Hand

Joined: Mar 21, 2008
Posts: 202

Thanks Balu.

Yes i was wrong.

It is https for port 90.

https://localhost:90

Please suggest.
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


Eshwar,

There can be many welcome file , but only one will be used by the server for both http and https. One way is to target to common index.jsp. In jsp , check for the protocol and redirect accordingly. got it ?
Eshwar Prasad
Ranch Hand

Joined: Mar 21, 2008
Posts: 202

Thanks Balu.

You are right.

As you suggested i tried implementing this with lines of JSP code



When I access this jsp with http://localhost:8080/

i get the below results

Request Protocol: HTTP/1.1
Server name: localhost
Server port: 8080


When accessed with https://localhost:90

i get below results

Request Protocol: HTTP/1.1
Server name: localhost
Server port: 90


The Protocol identification always results HTTP/1.1 in both http and https cases.

Please let me know if i am performing wrong any where.
Eshwar Prasad
Ranch Hand

Joined: Mar 21, 2008
Posts: 202

any way to set the document path so that it refers "cafeApp" folder.

Please let me know
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

I would not use port 90 for HTTPS - that port is reserved for FTP. Port 443 is the default port for HTTPS. If you don't want to use 443, you should use something above 1024 as all ports below that have specific uses. See http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

Before you can use HTTPS, you need to have a generated a key and registered that key to JBoss AS (and ultimately to your browser). You cannot just prepend "https" have have it use the HTTPS protocol. This might help: http://www.jboss.org/community/wiki/SSLSetup


JBoss In Action
Eshwar Prasad
Ranch Hand

Joined: Mar 21, 2008
Posts: 202

Thanks Peter.

I have changed the port from 90 to 443.

The below links you provided is really helpful. I configured SSL in JBOSS 5.0.1

But the problem is that i want to put all my secure application files into cafeApp folder available in WAR file.

1. So on accessing https://localhost:443/myApp it should point to cafeApp folder available under myApp.war

2. If I mispell https://localhost:443/myApp as http://localhost:443/myApp, i should land to index page available in cafeApp folder.

Can this be done. Please let me know.
Eshwar Prasad
Ranch Hand

Joined: Mar 21, 2008
Posts: 202
Any Suggestions. Please let me know
Eshwar Prasad
Ranch Hand

Joined: Mar 21, 2008
Posts: 202
I used isSecure() method on request object and is working fine.

Now i can redirect to secure folder as Balu suggested.

But i am not getting why request.getProtocol() returns http string while executing the request through https

Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Context Path Problem
 
Similar Threads
Deploy web apps on different ports
setting up log4J for application
Virtual Hosting in Jboss Error
question on getInitParameter(String)
dowloading file from a server problem