You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Bruce Lombardi <br...@gmail.com> on 2014/08/01 00:53:22 UTC

RE: Wicketstuff restannotations example throws IllegalStateException: STREAMED with https

Andrea,

I have the SSL working fine when I call it from a Java program using
HttpsURLConnection. So it was something with "curl."  

I wonder if you could suggest how I could pass a username and password along
with the json string and authenticate the request.

Thanks,

Bruce

-----Original Message-----
From: Andrea Del Bene [mailto:an.delbene@gmail.com] 
Sent: Thursday, July 31, 2014 8:06 AM
To: users@wicket.apache.org
Subject: Re: Wicketstuff restannotations example throws
IllegalStateException: STREAMED with https

I started the example app with Maven and enabling the SSL port. I've tested
it with Firefox, although I had to disable the flag
security.mixed_content.block_active_content to load the JS libraries. I had
no problem with the REST operations (GET, POST, DELETE...), everything
worked fine usin SSL. Maybe the problem is with curl and SSL handling?
> I just stated it by running Start.java as a java application  to start
Jetty from Eclipse.
>
> Bruce
>
> Sent from my iPad
>
>> On Jul 31, 2014, at 6:09 AM, Andrea Del Bene <an...@gmail.com>
wrote:
>>
>> Hi,
>>
>> how did you started the example application?
>>> I want to use the wicketstuff-restannotations library to implement a 
>>> restful web service. It seem very handy and I was able to get the 
>>> example code working fine.
>>>
>>> To make sure I understood how everything was working and how to 
>>> access from another server I used curl from the command line to send an
HTTP request.
>>>
>>> It worked fine using http with jetty, but when I tried 
>>> http://localhost:8443 I get  IllegalStateException: STREAMED.
>>>
>>> See the details below:
>>>
>>>   
>>> The following works using curl to post:
>>>
>>>   
>>> C:\Software\Curl>curl
>>>
>>> -H "Content-Type: application/json"
>>>
>>> -d {"name":"Bruce","email":"myaccount@gmail.com","password":"piano"}
>>>
>>> http://localhost:8080/personsmanager/createPerson
>>>
>>>   
>>> It returns this:
>>>
>>>   
>>> {"name":"Bruce","email":"myaccount@gmail.com","password":"piano"}
>>>
>>>   
>>> With the following HTTPS curl command I get IllegalStateException: 
>>> STREAMED
>>> (note: the " -k/ --insecure" switch tells curl not to validate the 
>>> certificate since it is not in their list)
>>>
>>>   
>>> C:\Software\Curl>curl
>>>
>>> -H -k/ --insecure "Content-Type: application/json"
>>>
>>> -d {"name":"Bruce","email":"myaccount@gmail.com","password":"piano"}
>>> https://localhost:8443
>>>
>>> /personsmanager/persons
>>>
>>>   
>>> Stacktrace shows:
>>>
>>>   
>>> java.lang.IllegalStateException: STREAMED
>>>
>>>                  at
>>> org.eclipse.jetty.server.Request.getReader(Request.java:787)
>>>
>>>                  at
>>> org.wicketstuff.rest.utils.http.HttpUtils.readStringFromRequest(Http
>>> Utils.ja
>>> va:46)
>>>
>>>                  at
>>> org.wicketstuff.rest.contenthandling.serialdeserial.TextualWebSerial
>>> Deserial
>>> .requestToObject(TextualWebSerialDeserial.java:83)
>>>
>>>                  at
>>> org.wicketstuff.rest.utils.reflection.MethodParameter.deserializeObj
>>> ectFromR
>>> equest(MethodParameter.java:278)
>>>
>>>                  at
>>> org.wicketstuff.rest.utils.reflection.MethodParameter.extractParamet
>>> erFromAn
>>> notation(MethodParameter.java:168)
>>>
>>>                  at
>>> org.wicketstuff.rest.utils.reflection.MethodParameter.extractParamet
>>> erValue(
>>> MethodParameter.java:117)
>>>
>>>   
>>> Does this mean that it the restful annotation will not work over 
>>> https, or am I doing something wrong?
>>>
>>>   
>>> Bruce
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicketstuff restannotations example throws IllegalStateException: STREAMED with https

Posted by Bruce Lombardi <br...@gmail.com>.
Thanks again!

Bruce

Sent from my iPad

> On Aug 2, 2014, at 6:26 AM, Andrea Del Bene <an...@gmail.com> wrote:
> 
> You can use method AbstractRestResource.setResponseStatusCode
>> Thanks Andrea. I'm working this out.  Now I have one more question:
>> 
>> How can I return an Http 401 Status Code of Unauthorized if the password is
>> incorrect? I know I can return values, such as the PersonPojo in the
>> example, and I can return error messages
>> from the from a registered validator, but I think it is standard to return
>> 401 on authentication failure. Can I return a Status Code?
>> 
>> Bruce
>> 
>> -----Original Message-----
>> From: Andrea Del Bene [mailto:an.delbene@gmail.com]
>> Sent: Friday, August 01, 2014 12:26 PM
>> To: users@wicket.apache.org
>> Subject: Re: Wicketstuff restannotations example throws
>> IllegalStateException: STREAMED with https
>> 
>> I would pass them as request parameters...
>>> Andrea,
>>> 
>>> I have the SSL working fine when I call it from a Java program using
>>> HttpsURLConnection. So it was something with "curl."
>>> 
>>> I wonder if you could suggest how I could pass a username and password
>>> along with the json string and authenticate the request.
>>> 
>>> Thanks,
>>> 
>>> Bruce
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicketstuff restannotations example throws IllegalStateException: STREAMED with https

Posted by Andrea Del Bene <an...@gmail.com>.
You can use method AbstractRestResource.setResponseStatusCode
> Thanks Andrea. I'm working this out.  Now I have one more question:
>
> How can I return an Http 401 Status Code of Unauthorized if the password is
> incorrect? I know I can return values, such as the PersonPojo in the
> example, and I can return error messages
> from the from a registered validator, but I think it is standard to return
> 401 on authentication failure. Can I return a Status Code?
>
> Bruce
>
> -----Original Message-----
> From: Andrea Del Bene [mailto:an.delbene@gmail.com]
> Sent: Friday, August 01, 2014 12:26 PM
> To: users@wicket.apache.org
> Subject: Re: Wicketstuff restannotations example throws
> IllegalStateException: STREAMED with https
>
> I would pass them as request parameters...
>> Andrea,
>>
>> I have the SSL working fine when I call it from a Java program using
>> HttpsURLConnection. So it was something with "curl."
>>
>> I wonder if you could suggest how I could pass a username and password
>> along with the json string and authenticate the request.
>>
>> Thanks,
>>
>> Bruce
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Wicketstuff restannotations example throws IllegalStateException: STREAMED with https

Posted by Bruce Lombardi <br...@gmail.com>.
Thanks Andrea. I'm working this out.  Now I have one more question:

How can I return an Http 401 Status Code of Unauthorized if the password is
incorrect? I know I can return values, such as the PersonPojo in the
example, and I can return error messages 
from the from a registered validator, but I think it is standard to return
401 on authentication failure. Can I return a Status Code?

Bruce

-----Original Message-----
From: Andrea Del Bene [mailto:an.delbene@gmail.com] 
Sent: Friday, August 01, 2014 12:26 PM
To: users@wicket.apache.org
Subject: Re: Wicketstuff restannotations example throws
IllegalStateException: STREAMED with https

I would pass them as request parameters...
> Andrea,
>
> I have the SSL working fine when I call it from a Java program using 
> HttpsURLConnection. So it was something with "curl."
>
> I wonder if you could suggest how I could pass a username and password 
> along with the json string and authenticate the request.
>
> Thanks,
>
> Bruce
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicketstuff restannotations example throws IllegalStateException: STREAMED with https

Posted by Andrea Del Bene <an...@gmail.com>.
I would pass them as request parameters...
> Andrea,
>
> I have the SSL working fine when I call it from a Java program using
> HttpsURLConnection. So it was something with "curl."
>
> I wonder if you could suggest how I could pass a username and password along
> with the json string and authenticate the request.
>
> Thanks,
>
> Bruce
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org