tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KC Berg <KB...@latis.com>
Subject RE: invalid https url generates NullPointerException
Date Thu, 28 Feb 2002 18:29:24 GMT
did you check your redirectPort in server.xml? 

------------------------------
<Connector className="org.apache.catalina.connector.http.HttpConnector"
               port="8080" minProcessors="5" maxProcessors="20"
               enableLookups="false" redirectPort="8443"
               acceptCount="10" debug="0" connectionTimeout="60000"/>

------------------------------

What I did to enforce the use of https and eliminate your issue was the
following...

----------------------------------------
if(request.getServerPort() != 443){
  response.sendRedirect("https://" + request.getServerName() +
request.getServletPath()+"?"+ request.getQueryString());

}
-----------------------------------

The above code works if you setup tomcat to use the standard ports for http
and https. However you can use the above code in the following manner if you
need to use the default tomcat ports.

----------------------------------------

if(request.getScheme().equals("http")){
  response.sendRedirect("https://" + request.getServerName() + ":8443" +
request.getServletPath()+"?"+ request.getQueryString());

}

----------------------------------------


I'm not sure if this is what you were after but it should work :) 

KC

-----Original Message-----
From: Steve A Drake [mailto:sad@comet.ucar.edu]
Sent: Thursday, February 28, 2002 11:19 AM
To: tomcat-user@jakarta.apache.org
Subject: invalid https url generates NullPointerException



 Hello. I just downloaded and installed Tomcat 4.0.2 and jsse1.0.2 on my
RH 7.2 box. I configured SSL under Tomcat so that the test URLs:
http://localhost:8080/ and https://localhost:8443/ work fine.

 The problem that I am having is that, if I accidentally enter:
https://localhost:8080/ Tomcat bogs down and throws the following
NullPointerException in catalina.out. I know that this address is invalid
but I'm surprised to see this behavior. Did I miss some configuration
detail?
TIA for your advice.

java.lang.NullPointerException
	at
org.apache.catalina.connector.http.HttpResponseStream.checkHead(HttpResponse
Stream.java:253)
	at
org.apache.catalina.connector.http.HttpResponseStream.<init>(HttpResponseStr
eam.java:104)
	at
org.apache.catalina.connector.http.HttpResponseImpl.createOutputStream(HttpR
esponseImpl.java:220)
	at
org.apache.catalina.connector.ResponseBase.getOutputStream(ResponseBase.java
:725)
	at
org.apache.catalina.connector.ResponseBase.finishResponse(ResponseBase.java:
469)
	at
org.apache.catalina.connector.HttpResponseBase.finishResponse(HttpResponseBa
se.java:236)
	at
org.apache.catalina.connector.http.HttpResponseImpl.finishResponse(HttpRespo
nseImpl.java:288)
	at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1039)
	at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107
)
	at java.lang.Thread.run(Thread.java:484)



--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>

--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message