Restlet api

by biokys » Thu, 02 Dec 2010 05:53:55 GMT


Sponsored Links
 Hi, I am little bit confused about using of restlet framework. Can
someone explain me, if restlet api works similarly as a classic web
services (JAX-WS)? I cant figure out, how to transfer to server my
custom data type and in the same call to return any value or another
custom data type like

long id = resource.createUser(User);

Maybe i m doing anything wrong, but what is working until now for me
is just simple call

String s = getString();


where method getString() is implemented on server side like this:
@Get
public String getString() { return "Hello world";}

-- 



Re: Restlet api

by creativepragmatic » Thu, 02 Dec 2010 12:24:58 GMT


 I have been working with Restlet for a couple of months.  To me, while
it is a REST web service, it seems to work more like a remote
procedure call in code.  If I am not mistaken, custom data types
should be serialized before being sent.  I hope that helps.  I will
watch this thread for any further questions.





-- 


Sponsored Links


Re: Restlet api

by biokys » Fri, 03 Dec 2010 06:08:43 GMT


 So I make another step,
I can succesfully call this method from client:

 User user = resource.getUser("Test");



On the server side it looks like:

@Put
public User getUser(String msg) {
return new User("John" + msg, "Locke" + msg);
}


So I can pass String param to method getUser and receive object User.
BUT I need to pass to method object User as well. So it should look
like this:
@Put
public User getUser(User oldUser)
{
...
}



BUT this is not working :-(

Anyone can help me? I spent 2 evenings when i was trying to solve this
issue.

PS: Is possible in one method to pass nonprimitive object and receive
another nonprimitive object?
Thx Honza
On 2 pro, 05:24, creativepragmatic <creativepragma...@gmail.com>




-- 



Re: Restlet api

by Brill Pappin » Fri, 03 Dec 2010 07:39:40 GMT


 Try it with a Post instead of a Put.
Put isn't supposed to return anything but the request status.

- Brill Pappin





-- 



Re: Restlet api

by biokys » Tue, 07 Dec 2010 05:04:32 GMT


 It seems that both of them are returning correct objects (Put and
Post).....as i discovered, problem is with passing parameters to the
server method... it is accepting only primitive types as String, int
etc.










-- 



Other Threads

1. How can I rotate an Image in different angles?

Hi!

I found the solution! I did not need to rotate the image. I just had
to rotate the canvas-object, I was using.
LunarLander has the best example. Here is some code of it:


            canvas.save();
            canvas.rotate((float) mHeading, (float) mX, mCanvasHeight
                    - (float) mY);
            if (mMode == STATE_LOSE) {
                mCrashedImage.setBounds(xLeft, yTop, xLeft +
mLanderWidth, yTop
                        + mLanderHeight);
                mCrashedImage.draw(canvas);
            } else if (mEngineFiring) {
                mFiringImage.setBounds(xLeft, yTop, xLeft +
mLanderWidth, yTop
                        + mLanderHeight);
                mFiringImage.draw(canvas);
            } else {
                mLanderImage.setBounds(xLeft, yTop, xLeft +
mLanderWidth, yTop
                        + mLanderHeight);
                mLanderImage.draw(canvas);
            }
            canvas.restore();



Greetings, Martin







-- 

2. How i can control the Screen On/Off & Lock/Unlock in Donut( SDK 1.6)

hi, all(& happy new year~! :D)

I making an Alarm App.

In my Alarm App, if user set the alarm, the alarm Dialog will be shown
at the set alarm time.

but if device(phone) was in lock and screen off, I can't see the alarm
dialog.

I need to write code to the alarm dialog will be shown automatically
although the device(phone) is screen off(and locked).

I see the source code about AlarmClock in Donut SDK.

It is use the code like below:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);

but the FLAG_TURN_SCREEN_ON is only available in SDK 2.0 or later.

I just only use Donut(SDK 1.6).

How can i Screen on & unlock in Donut(SDK 1.6)?

-- 

3. Perkenalan dan WTA ^^

4. Record audio from SoundPool?

5. How can I minimize the stuttering of the graphics?

6. How can I get the highest framerate with this quellcode?

7. Service thread priority