Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7973247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:03:34+00:00 2026-06-04T08:03:34+00:00

I am using restlet server has a RESTful provider for my mobile application. Is

  • 0

I am using restlet server has a RESTful provider for my mobile application. Is there anything to do with varnish to make restlet working ?

Indeed, without using varnish and making my app contacting directly my rest server everything works fine.

Here the exception returned by restlet server :

May 14, 2012 7:48:10 PM org.restlet.resource.UniformResource doCatch
WARNING: Exception or error caught in resource
java.lang.NullPointerException
        at fr.evoxmusic.ebackupserver.rest.IsGoogleRegistered.isGoogleRegistered(IsGoogleRegistered.java:30)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.restlet.resource.ServerResource.doHandle(ServerResource.java:449)
        at org.restlet.resource.ServerResource.post(ServerResource.java:1114)
        at org.restlet.resource.ServerResource.doHandle(ServerResource.java:533)
        at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:590)
        at org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:302)
        at org.restlet.resource.ServerResource.handle(ServerResource.java:849)

Note : I am using Reslet client. Here my code to contact the server.

public class RestletClient extends ClientResource {
    private static final String TAG = "RestletClient";
    private static final String UserAgent = "eBackupSMS";

    public static JSONObject SendHttpPost(String URL, JSONObject entity) {
        JSONObject result = new JSONObject();
        JsonRepresentation jr = new JsonRepresentation(entity);

        Client client = new Client(new Context(), Protocol.HTTP);
        client.getContext().getParameters().add("useForwardedForHeader", "true");
        ClientResource cr = new ClientResource(URL);
        cr.setNext(client);

        List<Preference<Encoding>> preflist = cr.getClientInfo().getAcceptedEncodings();
        preflist.add(new Preference<Encoding>(Encoding.GZIP));
        preflist.add(new Preference<Encoding>(Encoding.DEFLATE));

        cr.getClientInfo().setAgent(UserAgent);

        // Others params.
        cr.setRetryDelay(10000);
        cr.setRetryAttempts(3);
        cr.setRetryOnError(true);

        try {

            cr.post(jr);
            jr = new JsonRepresentation(cr.getResponseEntity());
            cr.release();

            result = jr.getJsonObject();
        } catch (Exception e) {
            Log.e(TAG, e.toString());
        }

        return result;
    }

}

Here the isGoogleRegistered resource where the error happens.

public class IsGoogleRegistered extends ServerResource {

    /**
     * Method used to verify if the token provided by the client is valid for
     * the google server.
     * 
     * @param entity as json representation
     * @return a jsonobject containing the response
     * @throws Exception
     * 
     * @example : {"google":{"registrationid":"client token id"}}
     */
    @Post("json")
    public JsonRepresentation isGoogleRegistered(JsonRepresentation entity) throws Exception {
        JSONObject wrapper = new JSONObject();
        JSONObject content = new JSONObject();

        wrapper = entity.getJsonObject().getJSONObject("google");

        try {
            if (C2DMMessage.isGoogleRegistered(JBackupServer.c2dmToken, wrapper.getString("registrationid")))
                content.put("isgoogleregistered", true);
            else
                content.put("isgoogleregistered", false);
        } catch (IOException e) {
            content.put("error", "connection to google servers not available");
        }

        wrapper = new JSONObject();
        wrapper.put("result", content);

        JsonRepresentation jr = new JsonRepresentation(wrapper);
        return jr;
    }

}

line 30 :

wrapper = entity.getJsonObject().getJSONObject("google");

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:03:36+00:00Added an answer on June 4, 2026 at 8:03 am

    By using socat I saw that varnish seems not correctly forward chunked http request to the backend..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Restlet to make a RESTful platform. I haven't used it before, but
Where can I embed startup initialization code in a Restlet web application, without using
We are working on a restful application that has a 'whiteboard' like feature. I
I have deployed our Restlet services to a Jetty Java Application server using the
We're using Restlet 2.0.8 and have an Application instance overwriting org.restlet.Application#createInboundRoot(). In there, we
I've been working on a set of RESTful HTTP services implemented using Restlet in
Using Restlet I have created a router for my Java application. From using curl,
I am using Restlet FileRepresentation to get a file on the server side of
I am currently working on a small project using RESTlet on Google App Engine/Java.
I'm calling the openNMS webservices to my android mobile using restlet framework. Iam getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.