All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.iprogrammerr.bright.server.example.HelloRespondent Maven / Gradle / Ivy

package com.iprogrammerr.bright.server.example;

import com.iprogrammerr.bright.server.request.MatchedRequest;
import com.iprogrammerr.bright.server.respondent.Respondent;
import com.iprogrammerr.bright.server.response.Response;
import com.iprogrammerr.bright.server.response.template.BadRequestResponse;
import com.iprogrammerr.bright.server.response.template.OkResponse;

public final class HelloRespondent implements Respondent {

    @Override
    public Response respond(MatchedRequest request) {
	try {
	    int id = request.pathVariable("id", Integer.class);
	    String message = "Hello number " + id;
	    return new OkResponse(message);
	} catch (Exception exception) {
	    return new BadRequestResponse(exception.getMessage());
	}
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy