Pessoal,
Depois de fazer funcionar o VRaptor usando HttpConnection http://www.guj.com.br/posts/list/214608.java, estou enfrentando uma dificuldade que com certeza deve ser ou uma ebsteira ou então novamente um erro na implementação do VRaptor.
Tenho o seguinte código em um método via @Get
@Path("/service/metodo")
public void metodo() {
String msg = "Message";
ByteArrayInputStream ba = new ByteArrayInputStream(msg.getBytes());
// Tanto usando desta forma
result.use(Results.http()).addHeader("Content-Type", "text/plain");
result.use(Results.http()).addIntHeader("Content-Length", 1000);
// Quanto usando o response injetado pelo construtor (HttpServletResponse)
// response.setContentType("Contetext/plain");
//response.setHeader("Content-Length", Long.toString(ba.available()));
result.use(Results.nothing());
Usando qualquer browser (I.E., Firefox, Chrome, etc…), normalmente recebo as seguintes informações no response:
Response Headers Value
(Status-Line) HTTP/1.0 200 OK
Expires Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie JSESSIONID=PLe0ItKeRvRuBTxqf4agmw;Path=/
Content-Type text/html
Content-Encoding gzip
Date Mon, 09 Aug 2010 16:14:06 GMT
Server Google Frontend
Cache-Control private, x-gzip-ok=""
Content-Length 130
X-Cache MISS from local firewall
X-Cache-Lookup MISS from local firewall
Via 1.0 local firewall (squid/2.6.STABLE18)
Connection keep-alive
Agora chamando este mesmo método usando HttpConnection (J2ME), não recebo o atributo Content-Length, mesmo setando no código, como mostra acima a implementação.
Response Headers Value
(Status-Line) HTTP/1.0 200 OK
Expires Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie JSESSIONID=aLipUInJd77qzHt8yp5UMA;Path=/
Content-Type text/html
Date Mon, 09 Aug 2010 16:09:45 GMT
Server Google Frontend
Cache-Control private, x-gzip-ok=""
X-Cache MISS from local firewall
X-Cache-Lookup MISS from local firewall
Via 1.0 local firewall
Connection close
Estou usando o VRaptor 3.1.0 devido a dificuldade relatada aqui http://www.guj.com.br/posts/list/214608.java
Alguma dica, truque???
Guilherme Elias.