servicemix/karafにnewbyとして、私はREST要求を受け入れて返す非常に単純なプログラムを作成しようとしています。私が持っているクラスは:servicemix:どのポートが私のosgiバンドルですか?
package (....)
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import (...).model.RSDocument;
import (...).model.RSDocumentResponse;
@RestController
public class DocumentService {
@RequestMapping(value = "/rest/document", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseEntity<RSDocumentResponse> printDocument(
@RequestBody RSDocument documentRequest)
{
System.out.println(documentRequest.getContent());
RSDocumentResponse response = new RSDocumentResponse();
response.setSuccess(true);
return new ResponseEntity<>(response, HttpStatus.OK);
}
}
私はTomcatでうまく動作しています。 Tomcatでは、eclipseでサーバー上でダブルクリックし、 "Ports"セクションに値を設定することで、着信要求をlistenするポートを指定します。どのようにしてServicemixのポートを設定するのですか、現在リッスンしているポートを特定するにはどうしたらいいですか? Servicemixのコマンドラインから順番にバンドルを開始しています。私のアプリケーションが80(Apache)、8080(None)、または8181(Servicemixコンソール)をリッスンしているようではない
:あなたが他のすべての必要なバンドルがインストールされていると、すべての依存関係を含め、実行中の場合は、上のRESTサービスにナビゲートすることができるはず設定されています。私はあなたがこの1つ以上のクラスを持っていると思います –