You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Henrique Faria <hf...@singularitysystems.com> on 2004/08/02 22:30:05 UTC

Getting only Response 400 when implementing a new connector for Tomcat 5

I´ve been trying to write a Dummy Conector to Tomcat just to learn how I
must call an Adapter. It´s the first step to write a ISO-8583 connector.

For that, I instancialize an Request and Response (org.apache.coyote),
and set all attributes that I think to be necessary :

    request = new Request();
    response = new Response();
    ByteChunk inputChunk = new ByteChunk();
    InputBuffer inputBuffer = new ByteChunkInputBuffer(new ByteChunk());
    OutputBuffer outputBuffer = new ByteChunkOutputBuffer(new
ByteChunk());
    request.setInputBuffer(inputBuffer);
    response.setOutputBuffer(outputBuffer);

    // construct a fake request
    request.setResponse(response);
    request.setInputBuffer(inputBuffer);
    request.protocol().setString("HTTP/1.1");
    request.query().setString("");
    request.method().setString("GET");
    request.scheme().setString("http");
    request.serverName().setString("jlima-dsk1");
    request.requestURI().setString("/WebModule/servlet1");
    request.unparsedURI().setString("/WebModule/servlet1");
    request.queryString().setString("");
    request.setStartTime(System.currentTimeMillis());

After that, I try to invoke the container via an Adapter (
org.apache.coyote ), and finally I print the response.

adapter.service(request,response);

But what I got from the response is quit strange. I always get an 400
error, even when the host exist.

org.apache.coyote.Response.getMessage() = No Host matches server name
jlima-dsk1
org.apache.coyote.Response.getStatus() = 400

Do anybody know what I´m doing wrong ?

PS: I´m using J2SDK 1.4.2 and Tomcat 5.
 	 	

Henrique Faria	         Senior Consultant
Java Software Team	
tel: 	55.11.3285 4699	
cel: 	55.11.9811 8281	
fax:	55.11.3266 5121	
hfaria@singularitysystems.com	

Júlio Melhado Lima	   Senior Consultant
Java Software Team	
tel: 	55.11.3285 4699	
cel: 	55.11.9811 8281	
fax:	55.11.3266 5121	
jlima@singularitysystems.com	





---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Getting only Response 400 when implementing a new connector for Tomcat 5

Posted by Bill Barker <wb...@wilshire.com>.
----- Original Message -----
From: "Remy Maucherat" <re...@apache.org>
To: "Tomcat Developers List" <to...@jakarta.apache.org>
Sent: Monday, August 02, 2004 2:36 PM
Subject: Re: Getting only Response 400 when implementing a new connector for
Tomcat 5


>Bill Barker wrote:
>
>>The Adapter implementation is expecting that the requestURI is of type
BYTE.
>>It doesn't deal well with type STRING.
>>
>>
>I don't think the latest 5.0.x code has these limitations anymore.
>

That's my recollection too.  However I'm too lazy to check CVS tags to see
if it made it into a released version ;-).

>Rémy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org



RES: Getting only Response 400 when implementing a new connector for Tomcat 5

Posted by Henrique Faria <hf...@singularitysystems.com>.
The whole problem was due to the "protocol" attribute of the "connector"
element, in the server.xml. We didn't set it.
Actually, we extended the CoyoteConnector class, overriding
setProtocol() method, which called super.setProtocol(), if the protocol
didn't match our string protocol.
Thanks anyway!

Henrique Faria	         Senior Consultant
Java Software Team	
tel: 	55.11.3285 4699	
cel: 	55.11.9811 8281	
fax:	 55.11.3266 5121	
hfaria@singularitysystems.com	

-----Mensagem original-----
De: Remy Maucherat [mailto:remm@apache.org] 
Enviada em: Monday, August 02, 2004 6:37 PM
Para: Tomcat Developers List
Assunto: Re: Getting only Response 400 when implementing a new connector
for Tomcat 5

Bill Barker wrote:

>The Adapter implementation is expecting that the requestURI is of type
BYTE.
>It doesn't deal well with type STRING.
>  
>
I don't think the latest 5.0.x code has these limitations anymore.

Rémy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Getting only Response 400 when implementing a new connector for Tomcat 5

Posted by Remy Maucherat <re...@apache.org>.
Bill Barker wrote:

>The Adapter implementation is expecting that the requestURI is of type BYTE.
>It doesn't deal well with type STRING.
>  
>
I don't think the latest 5.0.x code has these limitations anymore.

Rémy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Getting only Response 400 when implementing a new connector for Tomcat 5

Posted by Bill Barker <wb...@wilshire.com>.
The Adapter implementation is expecting that the requestURI is of type BYTE.
It doesn't deal well with type STRING.

----- Original Message -----
From: "Henrique Faria" <hf...@singularitysystems.com>
To: "'Tomcat Developers List'" <to...@jakarta.apache.org>
Cc: <fj...@singularitysystems.com>
Sent: Monday, August 02, 2004 1:30 PM
Subject: Getting only Response 400 when implementing a new connector for
Tomcat 5


I´ve been trying to write a Dummy Conector to Tomcat just to learn how I
must call an Adapter. It´s the first step to write a ISO-8583 connector.

For that, I instancialize an Request and Response (org.apache.coyote),
and set all attributes that I think to be necessary :

    request = new Request();
    response = new Response();
    ByteChunk inputChunk = new ByteChunk();
    InputBuffer inputBuffer = new ByteChunkInputBuffer(new ByteChunk());
    OutputBuffer outputBuffer = new ByteChunkOutputBuffer(new
ByteChunk());
    request.setInputBuffer(inputBuffer);
    response.setOutputBuffer(outputBuffer);

    // construct a fake request
    request.setResponse(response);
    request.setInputBuffer(inputBuffer);
    request.protocol().setString("HTTP/1.1");
    request.query().setString("");
    request.method().setString("GET");
    request.scheme().setString("http");
    request.serverName().setString("jlima-dsk1");
    request.requestURI().setString("/WebModule/servlet1");
    request.unparsedURI().setString("/WebModule/servlet1");
    request.queryString().setString("");
    request.setStartTime(System.currentTimeMillis());

After that, I try to invoke the container via an Adapter (
org.apache.coyote ), and finally I print the response.

adapter.service(request,response);

But what I got from the response is quit strange. I always get an 400
error, even when the host exist.

org.apache.coyote.Response.getMessage() = No Host matches server name
jlima-dsk1
org.apache.coyote.Response.getStatus() = 400

Do anybody know what I´m doing wrong ?

PS: I´m using J2SDK 1.4.2 and Tomcat 5.


Henrique Faria          Senior Consultant
Java Software Team
tel: 55.11.3285 4699
cel: 55.11.9811 8281
fax: 55.11.3266 5121
hfaria@singularitysystems.com

Júlio Melhado Lima    Senior Consultant
Java Software Team
tel: 55.11.3285 4699
cel: 55.11.9811 8281
fax: 55.11.3266 5121
jlima@singularitysystems.com





---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org