Skip to content
This repository has been archived by the owner on Dec 18, 2022. It is now read-only.

[BUG]Not expected response #41

Open
ztkmkoo opened this issue May 31, 2020 · 6 comments · Fixed by #42
Open

[BUG]Not expected response #41

ztkmkoo opened this issue May 31, 2020 · 6 comments · Fixed by #42
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ztkmkoo
Copy link
Owner

ztkmkoo commented May 31, 2020

Describe the bug
The http rest response is not expected value. for dss-0.0.2.

my test code:

public class Application {

    public static void main(String[] args) throws InterruptedException {
        DssRestServer dssRestServer = new DssRestServer("127.0.0.1", 8181);

        dssRestServer
                .addDssRestService(new MyService())
                .addDssRestService(new YourService());
        dssRestServer.start();
    }
}

public class MyService implements DssRestActorService {
    public String getName() {
        return "myService";
    }

    public String getPath() {
        return "/my/service";
    }

    public DssRestMethodType getMethodType() {
        return DssRestMethodType.GET;
    }

    public DssRestContentInfo getConsume() {
        return DssRestContentInfo.APPLICATION_JSON_UTF8;
    }

    public DssRestContentInfo getProduce() {
        return DssRestContentInfo.APPLICATION_JSON_UTF8;
    }

    public DssRestServiceResponse handling(DssRestServiceActorCommandRequest commandRequest) {
        final String myName = commandRequest.getContent();
        final MyServiceResponse response = new MyServiceResponse();
        response.setResult("My service is " + myName + " service");
        return response;
    }
}

Expected behavior
Expected response like

{
    "result" : "My service is Kebron service"
}

Screenshots
image

Desktop (please complete the following information):

  • OS: Ubuntu 16.04
  • Test: Insomnia
@ztkmkoo ztkmkoo added the bug Something isn't working label May 31, 2020
@ztkmkoo ztkmkoo self-assigned this May 31, 2020
ztkmkoo added a commit that referenced this issue May 31, 2020
ztkmkoo added a commit that referenced this issue May 31, 2020
@ztkmkoo ztkmkoo linked a pull request Jun 1, 2020 that will close this issue
@ztkmkoo
Copy link
Owner Author

ztkmkoo commented Jun 1, 2020

The PR #42 is just a temporary solution.

@ztkmkoo ztkmkoo removed their assignment Aug 4, 2020
Doyuni pushed a commit to Doyuni/dss that referenced this issue Aug 5, 2020
@ztkmkoo ztkmkoo added this to the Contributhon milestone Aug 8, 2020
@ztkmkoo ztkmkoo added this to To do in Opensource project via automation Aug 8, 2020
@ztkmkoo
Copy link
Owner Author

ztkmkoo commented Aug 8, 2020

@Doyuni
Are you in progress?

@Doyuni
Copy link
Collaborator

Doyuni commented Aug 8, 2020

@ztkmkoo
Oh...it may have been committed while resolve merge conflict.
Can I try this?

@ztkmkoo
Copy link
Owner Author

ztkmkoo commented Aug 9, 2020

@Doyuni
Of course

@Doyuni
Copy link
Collaborator

Doyuni commented Aug 13, 2020

@ztkmkoo

The PR #42 is just a temporary solution.

Can I ask why it is a temporary solution?

@ztkmkoo
Copy link
Owner Author

ztkmkoo commented Aug 13, 2020

@Doyuni
Hi,

Please see io.github.ztkmkoo.dss.core.network.rest.handler.DssRestHandler$responseFromServiceActor, it always converts the DssRestServiceResponse object to json string.

But, see io.github.ztkmkoo.dss.core.actor.rest.service.AbstractDssRestActorService, it has the DssRestContentInfo produce member.

We have to support not only json format. So we should let io.github.ztkmkoo.dss.core.actor.rest.DssRestServiceActor make the correct(?) response.
Maybe we need modify io.github.ztkmkoo.dss.core.message.rest.DssRestChannelHandlerCommandResponse class, and send response logic in io.github.ztkmkoo.dss.core.network.rest.handler.DssRestHandler

Doyuni pushed a commit to Doyuni/dss that referenced this issue Sep 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

2 participants