Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISPN-3016 REST Metadata headers #1799

Conversation

tristantarrant
Copy link
Member

https://issues.jboss.org/browse/ISPN-3016

Please note that I removed the "lastModified" field from the MIMECacheEntry class and I'm now using the InternalCacheEntry data to compute that field.

https://issues.jboss.org/browse/ISPN-3016

@danberindei
Copy link
Member

"metadata headers" makes me think of the new metadata stuff that Galder is introducing in core. Wouldn't it be clearer to call them "topology headers", to make it more like HotRod?

val selectedMediaType = if (variant != null) variant.getMediaType.toString else "application/x-java-serialized-object"
selectedMediaType match {
case MediaType.APPLICATION_JSON => Response.ok.`type`(selectedMediaType).lastModified(lastMod).expires(expires).topology(cacheName, key, wantMetadata(metadata)).entity(streamIt(jsonMapper.writeValue(_, obj))).build
case MediaType.APPLICATION_XML => Response.ok.`type`(selectedMediaType).lastModified(lastMod).expires(expires).topology(cacheName, key, wantMetadata(metadata)).entity(streamIt(xstream.toXML(obj, _))).build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines are getting really long, I think they could use some wrapping.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will wrap

@galderz
Copy link
Member

galderz commented May 1, 2013

@danberindei Why topology headers? The stuff @tristantarrant is working on is precisely relative to the metadata information (expiry time...etc).

@galderz
Copy link
Member

galderz commented May 1, 2013

Hmmm, I find it a bit confusing that the REST can return different things when asking for an entry depending on the configuration, i.e. if ALWAYS is set. Having developed the Hot Rod protocol originally, I would have avoid doing that, it makes the results from the server more impredictable since they're not only based on the input parameters, but also in the configuration.

Why do we need this? To avoid sending a parameter everytime?

@tristantarrant
Copy link
Member Author

@danberindei Although at the moment the "metadata headers" stuff is for topology information only, I want to make it future proof in case we want to return further information.
@galderz you're right, I will remove "ALWAYS" and leave only NEVER (for security reasons) and ON_DEMAND.

@tristantarrant
Copy link
Member Author

made some further changes, and also added infinispan/infinispan-server#98 for the server-side configuration

I have renamed MetadataHeaders to ExtendedHeaders, since "standard metadata headers" should always be part of the response (last modified, expires, etc). I have removed "ALWAYS" from the enumeration.
I have also removed a ton of cruft from the ServerBootstrap (JBoss microcontainer ? really ?)

@tristantarrant
Copy link
Member Author

Rebased

@galderz
Copy link
Member

galderz commented May 3, 2013

Checking again...

@@ -134,6 +180,23 @@ class Server(@Context request: Request, @Context servletContext: ServletContext,
}
}

implicit private class extendedHeaders(val bld: Response.ResponseBuilder) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's a class, it should start with capital... Extended...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i forgot to find a better name for that, since otherwise it conflicted with the ExtendedHeaders class in configuration

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that implicits are relatively obscure for a lot of people, you should add some javadoc why you're using it and what it's effects are. This will help future maintainers :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defo need a better name, otherwise it can be even worse with people getting confused with the other class.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

@tristantarrant
Copy link
Member Author

Renamed the implicit class, renamed the primary owner header, added a comment

@galderz galderz closed this May 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants