Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Max Mecklin
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 59563005
authored
May 17, 2014
by
Juho Juopperi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
printedcard metadata through rest api
1 parent
7666f893
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
code/MoyaWeb/src/fi/codecrew/moya/rest/MetaRestView.java
code/MoyaWeb/src/fi/codecrew/moya/rest/MetaRestView.java
0 → 100644
View file @
5956300
package
fi
.
codecrew
.
moya
.
rest
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.RequestScoped
;
import
javax.json.JsonObject
;
import
javax.ws.rs.Consumes
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.Path
;
import
javax.ws.rs.PathParam
;
import
javax.ws.rs.Produces
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.PathSegment
;
import
fi.codecrew.moya.beans.CardTemplateBeanLocal
;
import
fi.codecrew.moya.model.PrintedCard
;
@RequestScoped
@Path
(
"/meta"
)
@Consumes
({
MediaType
.
APPLICATION_JSON
,
MediaType
.
APPLICATION_XML
})
@Produces
({
MediaType
.
APPLICATION_JSON
+
"; charset=UTF-8"
})
public
class
MetaRestView
{
@EJB
CardTemplateBeanLocal
cardTemplateBeanLocal
;
/**
* Get printed card metadata.
*
* @param cardId
* @param keys
* The path segments after card id
* @return
*/
@GET
@Path
(
"/printedcard/{id}/{keys:.*}"
)
public
String
getPrintedCardMeta
(
@PathParam
(
"id"
)
Integer
cardId
,
@PathParam
(
"key"
)
List
<
PathSegment
>
keys
)
{
PrintedCard
printedCard
=
cardTemplateBeanLocal
.
findCard
(
cardId
);
JsonObject
meta
=
printedCard
.
getMeta
();
return
meta
.
toString
();
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment