Skip to content

Commit

Permalink
Use requestedUrl for ProjectionsController links
Browse files Browse the repository at this point in the history
Was using the UriTemplateMatch which contained the local Uri.
  • Loading branch information
adbrowne committed Sep 21, 2014
1 parent 0747bb9 commit 2fd3b2b
Showing 1 changed file with 4 additions and 9 deletions.
Expand Up @@ -235,7 +235,7 @@ private void OnProjectionStatusGet(HttpEntityManager http, UriTemplateMatch matc
new SendToHttpWithConversionEnvelope
<ProjectionManagementMessage.Statistics, ProjectionStatisticsHttpFormatted>(
_networkSendQueue, http, DefaultFormatter, OkNoCacheResponseConfigurator,
status => new ProjectionStatisticsHttpFormatted(status.Projections[0], s => MakeUrl(match, s)),
status => new ProjectionStatisticsHttpFormatted(status.Projections[0], s => MakeUrl(http, s)),
ErrorsEnvelope(http));
Publish(new ProjectionManagementMessage.Command.GetStatistics(envelope, null, match.BoundVariables["name"], true));
}
Expand Down Expand Up @@ -263,7 +263,7 @@ private void OnProjectionStatisticsGet(HttpEntityManager http, UriTemplateMatch
new SendToHttpWithConversionEnvelope
<ProjectionManagementMessage.Statistics, ProjectionsStatisticsHttpFormatted>(
_networkSendQueue, http, DefaultFormatter, OkNoCacheResponseConfigurator,
status => new ProjectionsStatisticsHttpFormatted(status, s => MakeUrl(match, s)),
status => new ProjectionsStatisticsHttpFormatted(status, s => MakeUrl(http, s)),
ErrorsEnvelope(http));
Publish(new ProjectionManagementMessage.Command.GetStatistics(envelope, null, match.BoundVariables["name"], true));
}
Expand Down Expand Up @@ -335,7 +335,7 @@ private void ProjectionsGet(HttpEntityManager http, UriTemplateMatch match, Proj
var envelope =
new SendToHttpWithConversionEnvelope<ProjectionManagementMessage.Statistics, ProjectionsStatisticsHttpFormatted>(
_networkSendQueue, http, DefaultFormatter, OkNoCacheResponseConfigurator,
status => new ProjectionsStatisticsHttpFormatted(status, s => MakeUrl(match, s)),
status => new ProjectionsStatisticsHttpFormatted(status, s => MakeUrl(http, s)),
ErrorsEnvelope(http));
Publish(new ProjectionManagementMessage.Command.GetStatistics(envelope, mode, null, true));
}
Expand All @@ -349,7 +349,7 @@ private void ProjectionsPost(HttpEntityManager http, UriTemplateMatch match, Pro
_networkSendQueue, http, DefaultFormatter, (codec, message) =>
{
var localPath = string.Format("/projection/{0}", message.Name);
var url = MakeUrl(match, localPath);
var url = MakeUrl(http, localPath);
return new ResponseConfiguration(
201, "Created", codec.ContentType, codec.Encoding, new KeyValuePair<string, string>("Location", url));
}, ErrorsEnvelope(http));
Expand Down Expand Up @@ -544,11 +544,6 @@ private string ConflictFormatter(ICodec codec, ProjectionManagementMessage.Opera
return message.Reason;
}

private static string MakeUrl(UriTemplateMatch match, string localPath)
{
return new Uri(match.BaseUri, localPath).AbsoluteUri;
}

private static string DefaultFormatter<T>(ICodec codec, T message)
{
return codec.To(message);
Expand Down

0 comments on commit 2fd3b2b

Please sign in to comment.