restlet

JasperReports® Server login not working from Google App Engine (due to missing header attribute)

心已入冬 提交于 2019-12-01 12:51:47
问题 I'm trying to make a REST call (using the Restlet framework) from Google App Engine to a JasperReports server that I have running on Google Compute Engine. To use the JasperReports REST interface you need to first login by sending a POST request (with no body) and username/password query params. http:///jasperserver/rest/login?j_username=&j_password= The JasperReports server will respond by adding a "Set-Cookie" request header attribute. The attribute value contains a session ID that you use

Why use REST @Produces annotation

南笙酒味 提交于 2019-12-01 09:33:57
So I understand that you are specifying the type, but why? Under what conditions would it matter. For example, if I have the following method, and I comment out the @Produces annotation, it still returns JSON. @GET @Path("/json") //@Produces({MediaType.APPLICATION_JSON}) public String getJson(){ return toJson(getResults()); } The API doc says 'If not specified then a container will assume that any type can be produced.' So why would I not want the container to assume that? I think it depends on your JAX-RS implementation but here's Jersey's explanation of their @Produces annotation: https:/

how to pass parameters to RESTlet webservice from android?

戏子无情 提交于 2019-12-01 08:43:41
I've been looking online for how to pass parameters to RESTlet webservice but it seem there are not much tutorial concerning RESTlet. I would like to send some parameters gathered from a form on my android application (it would be great if i could do this using JSON). well i solved this as for the server side @Post public JSONArray serverSideFunction(Representation entity) throws JSONException { try { JSONObject req = (new JsonRepresentation(entity)).getJsonObject(); System.out.println(req.getString(/* filed name */)); System.out.println(req.getString(/* filed name */)); /* * you can retrieve

How to access header values of request in Java Restlet?

Deadly 提交于 2019-12-01 08:17:28
I am developing web services using Restlet Java . For this I want to protect some webservices from unauthorized clients. So I have written Filter class. In that Filter class I want to get the headers of the Request. But I am getting the following error - java.lang.ClassCastException: org.restlet.engine.http.HttpRequest cannot be cast to javax.servlet.http.HttpServletRequest The coding is - public class MyFilter extends Filter { @Override protected int beforeHandle(Request request, Response response) { int result = STOP; HttpServletRequest httpReq = (HttpServletRequest) request; String user

How to access header values of request in Java Restlet?

耗尽温柔 提交于 2019-12-01 04:44:20
问题 I am developing web services using Restlet Java . For this I want to protect some webservices from unauthorized clients. So I have written Filter class. In that Filter class I want to get the headers of the Request. But I am getting the following error - java.lang.ClassCastException: org.restlet.engine.http.HttpRequest cannot be cast to javax.servlet.http.HttpServletRequest The coding is - public class MyFilter extends Filter { @Override protected int beforeHandle(Request request, Response

REST: Mapping 404 HTTP Status codes

前提是你 提交于 2019-11-30 22:49:43
问题 Our team is developing RESTFul applications...we are debating the "BEST PRACTICE" approach. Should 404 status code response be returned for a filter-like query? Say my GET URL is .../1/service/startsWith/a.json and it returns all values that start with A in my database...but if no "a" values are found should i just return status code 200 with an empty json string? or status code 404. Thanks! 回答1: See this question, in the update to my answer I address your issue. Specifically this bit, I

RESTful Webservices on Google App Engine

≡放荡痞女 提交于 2019-11-30 10:07:48
First of all I need to say that I'm not so experienced in Google App Engine. I know that it is possible that we deploy RESTful Web-services (JERSEY) on GAE And also I know that RESTLET has a version specifically for GAE. I want to take advice from those who have worked with both approaches that which one is better. For example is configuring the GAE application for JERSEY too difficult or struggling??? Or for example has using RESTLET any disadvantages? Or is it too thick (RESTLET)? Thanks I started one year ago to develop an app with Jersey and Google App Engine. Great experience from my side

RESTful authentication - resulting poor performance on high load?

时光毁灭记忆、已成空白 提交于 2019-11-30 08:32:38
For a RESTful web service we say that that the server shouldn't store any state. Now for every request the 'user' must be authenticated and must have an authorization for the action(s) he/she wishes to carry out. Now every request will contain authorization data for that user. Here are my confusions: Assuming there is a login and password field on the home-page. The user enters the username/password which is sent back to the server, user verified and then 'some token' is returned. Now this token is sent to the server on every request. Question(s): Does the backend DB need to have a separate

fix java.net.SocketTimeoutException: Read timed out

耗尽温柔 提交于 2019-11-30 01:59:33
I have a RESTful server which takes an http POST input from client to vote up songs on server. I have used Apache HTTPClient for client. public boolean vote() { HttpClient client = new DefaultHttpClient(getHttpParameters()); HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000); // Timeout Limit HttpResponse response; try { HttpPost post = new HttpPost("http://127.0.0.1:8080/ws/"); StringEntity se = new StringEntity("{ \"song_id\" : \"2\" }"); se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE,"application/json")); post.setEntity(se); response = client.execute(post); if

RESTful Webservices on Google App Engine

穿精又带淫゛_ 提交于 2019-11-29 15:16:28
问题 First of all I need to say that I'm not so experienced in Google App Engine. I know that it is possible that we deploy RESTful Web-services (JERSEY) on GAE And also I know that RESTLET has a version specifically for GAE. I want to take advice from those who have worked with both approaches that which one is better. For example is configuring the GAE application for JERSEY too difficult or struggling??? Or for example has using RESTLET any disadvantages? Or is it too thick (RESTLET)? Thanks