• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Context Path Problem

 
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Skanda Raman
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any Help Please
 
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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.
 
Skanda Raman
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks Balu.

Yes i was wrong.

It is https for port 90.

https://localhost:90

Please suggest.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ?
 
Skanda Raman
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Skanda Raman
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

Please let me know
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Skanda Raman
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Skanda Raman
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any Suggestions. Please let me know
 
Skanda Raman
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic