get a blog content dynamically using RESTeasy











up vote
0
down vote

favorite












I am a Java developer, I want to write my own blogging application (that bloggers use to write their blogs with) i know it may sound crazy but i want it just for learning purpose, i am using JSF EJB Hibernate and RESTeasy tools,i started it i have created the database and the view.



From the information that i collected it is recommended to store the blog content in database(in html text), i find that i can use for that Javascript editor like CKEditor after the blogger write his blog in CKEditor i will concatenate it with a prepared header and footer after that i will store it in the database, and i found out that i can get blog post using RESTeasy API.



As an example(sorry):
after the blog is stored in the database
i want to present it to visitors like this:




  • link containing a path and the id of the article





<div>
<a href="/article/id">Read More...</a>
</div>




when the visitor press the link a REST Controller handle the request, fetch the article from the database using the provided id in the link and return an html page (without creating it statically).

The RESTeasy part perhaps something like this:



@Stateless
@Path("/article/")
public class ArticleResource {

@EJB
private ArticleService articleService;

@GET
@Path("/{id}")
@Produces(value = MediaType.TEXT_HTML)
public Response getArticleById(@PathParam("id") Long id){
//get article post from the database
Article article = articleService.findById(id);
//something here i didn't know
//return article post as an html page
}


}



Please if there is anything here that you see is wrong feel free to inform me, i am just learning here. And if there is an even better approach that you see is good, i really appreciate it.



I know perhaps using Spring it can be better but i want just to learn here how to do it.



I want to know how to get an html page stored in database using JAXRS,
the html page has no file in the application it is just stored in the database something like this:



"<html><head>...</head> <body>...content of the blog here</body> </html>"


Thank you in advance.










share|improve this question




















  • 2




    It would help if you tell us what is not working. What are you expecting to happen?
    – hochas
    Nov 13 at 12:11










  • "I know perhaps using Spring it can be better" this is very illogical, since I use rest via jaxrs implementation a lot and it 'just works'
    – Kukeltje
    Nov 13 at 12:20










  • thank you for your reaction, i want to use jaxrs to return html page that is stored in database but i don't know how to do it, the page didn't exists as a file it is just stored in the database stored as html text
    – magran x
    Nov 13 at 12:29












  • Kukeltje can you elaborate a little bit what that means. thank you
    – magran x
    Nov 13 at 12:31















up vote
0
down vote

favorite












I am a Java developer, I want to write my own blogging application (that bloggers use to write their blogs with) i know it may sound crazy but i want it just for learning purpose, i am using JSF EJB Hibernate and RESTeasy tools,i started it i have created the database and the view.



From the information that i collected it is recommended to store the blog content in database(in html text), i find that i can use for that Javascript editor like CKEditor after the blogger write his blog in CKEditor i will concatenate it with a prepared header and footer after that i will store it in the database, and i found out that i can get blog post using RESTeasy API.



As an example(sorry):
after the blog is stored in the database
i want to present it to visitors like this:




  • link containing a path and the id of the article





<div>
<a href="/article/id">Read More...</a>
</div>




when the visitor press the link a REST Controller handle the request, fetch the article from the database using the provided id in the link and return an html page (without creating it statically).

The RESTeasy part perhaps something like this:



@Stateless
@Path("/article/")
public class ArticleResource {

@EJB
private ArticleService articleService;

@GET
@Path("/{id}")
@Produces(value = MediaType.TEXT_HTML)
public Response getArticleById(@PathParam("id") Long id){
//get article post from the database
Article article = articleService.findById(id);
//something here i didn't know
//return article post as an html page
}


}



Please if there is anything here that you see is wrong feel free to inform me, i am just learning here. And if there is an even better approach that you see is good, i really appreciate it.



I know perhaps using Spring it can be better but i want just to learn here how to do it.



I want to know how to get an html page stored in database using JAXRS,
the html page has no file in the application it is just stored in the database something like this:



"<html><head>...</head> <body>...content of the blog here</body> </html>"


Thank you in advance.










share|improve this question




















  • 2




    It would help if you tell us what is not working. What are you expecting to happen?
    – hochas
    Nov 13 at 12:11










  • "I know perhaps using Spring it can be better" this is very illogical, since I use rest via jaxrs implementation a lot and it 'just works'
    – Kukeltje
    Nov 13 at 12:20










  • thank you for your reaction, i want to use jaxrs to return html page that is stored in database but i don't know how to do it, the page didn't exists as a file it is just stored in the database stored as html text
    – magran x
    Nov 13 at 12:29












  • Kukeltje can you elaborate a little bit what that means. thank you
    – magran x
    Nov 13 at 12:31













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am a Java developer, I want to write my own blogging application (that bloggers use to write their blogs with) i know it may sound crazy but i want it just for learning purpose, i am using JSF EJB Hibernate and RESTeasy tools,i started it i have created the database and the view.



From the information that i collected it is recommended to store the blog content in database(in html text), i find that i can use for that Javascript editor like CKEditor after the blogger write his blog in CKEditor i will concatenate it with a prepared header and footer after that i will store it in the database, and i found out that i can get blog post using RESTeasy API.



As an example(sorry):
after the blog is stored in the database
i want to present it to visitors like this:




  • link containing a path and the id of the article





<div>
<a href="/article/id">Read More...</a>
</div>




when the visitor press the link a REST Controller handle the request, fetch the article from the database using the provided id in the link and return an html page (without creating it statically).

The RESTeasy part perhaps something like this:



@Stateless
@Path("/article/")
public class ArticleResource {

@EJB
private ArticleService articleService;

@GET
@Path("/{id}")
@Produces(value = MediaType.TEXT_HTML)
public Response getArticleById(@PathParam("id") Long id){
//get article post from the database
Article article = articleService.findById(id);
//something here i didn't know
//return article post as an html page
}


}



Please if there is anything here that you see is wrong feel free to inform me, i am just learning here. And if there is an even better approach that you see is good, i really appreciate it.



I know perhaps using Spring it can be better but i want just to learn here how to do it.



I want to know how to get an html page stored in database using JAXRS,
the html page has no file in the application it is just stored in the database something like this:



"<html><head>...</head> <body>...content of the blog here</body> </html>"


Thank you in advance.










share|improve this question















I am a Java developer, I want to write my own blogging application (that bloggers use to write their blogs with) i know it may sound crazy but i want it just for learning purpose, i am using JSF EJB Hibernate and RESTeasy tools,i started it i have created the database and the view.



From the information that i collected it is recommended to store the blog content in database(in html text), i find that i can use for that Javascript editor like CKEditor after the blogger write his blog in CKEditor i will concatenate it with a prepared header and footer after that i will store it in the database, and i found out that i can get blog post using RESTeasy API.



As an example(sorry):
after the blog is stored in the database
i want to present it to visitors like this:




  • link containing a path and the id of the article





<div>
<a href="/article/id">Read More...</a>
</div>




when the visitor press the link a REST Controller handle the request, fetch the article from the database using the provided id in the link and return an html page (without creating it statically).

The RESTeasy part perhaps something like this:



@Stateless
@Path("/article/")
public class ArticleResource {

@EJB
private ArticleService articleService;

@GET
@Path("/{id}")
@Produces(value = MediaType.TEXT_HTML)
public Response getArticleById(@PathParam("id") Long id){
//get article post from the database
Article article = articleService.findById(id);
//something here i didn't know
//return article post as an html page
}


}



Please if there is anything here that you see is wrong feel free to inform me, i am just learning here. And if there is an even better approach that you see is good, i really appreciate it.



I know perhaps using Spring it can be better but i want just to learn here how to do it.



I want to know how to get an html page stored in database using JAXRS,
the html page has no file in the application it is just stored in the database something like this:



"<html><head>...</head> <body>...content of the blog here</body> </html>"


Thank you in advance.






<div>
<a href="/article/id">Read More...</a>
</div>





<div>
<a href="/article/id">Read More...</a>
</div>






jax-rs blogs resteasy






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 at 13:04

























asked Nov 13 at 12:06









magran x

264




264








  • 2




    It would help if you tell us what is not working. What are you expecting to happen?
    – hochas
    Nov 13 at 12:11










  • "I know perhaps using Spring it can be better" this is very illogical, since I use rest via jaxrs implementation a lot and it 'just works'
    – Kukeltje
    Nov 13 at 12:20










  • thank you for your reaction, i want to use jaxrs to return html page that is stored in database but i don't know how to do it, the page didn't exists as a file it is just stored in the database stored as html text
    – magran x
    Nov 13 at 12:29












  • Kukeltje can you elaborate a little bit what that means. thank you
    – magran x
    Nov 13 at 12:31














  • 2




    It would help if you tell us what is not working. What are you expecting to happen?
    – hochas
    Nov 13 at 12:11










  • "I know perhaps using Spring it can be better" this is very illogical, since I use rest via jaxrs implementation a lot and it 'just works'
    – Kukeltje
    Nov 13 at 12:20










  • thank you for your reaction, i want to use jaxrs to return html page that is stored in database but i don't know how to do it, the page didn't exists as a file it is just stored in the database stored as html text
    – magran x
    Nov 13 at 12:29












  • Kukeltje can you elaborate a little bit what that means. thank you
    – magran x
    Nov 13 at 12:31








2




2




It would help if you tell us what is not working. What are you expecting to happen?
– hochas
Nov 13 at 12:11




It would help if you tell us what is not working. What are you expecting to happen?
– hochas
Nov 13 at 12:11












"I know perhaps using Spring it can be better" this is very illogical, since I use rest via jaxrs implementation a lot and it 'just works'
– Kukeltje
Nov 13 at 12:20




"I know perhaps using Spring it can be better" this is very illogical, since I use rest via jaxrs implementation a lot and it 'just works'
– Kukeltje
Nov 13 at 12:20












thank you for your reaction, i want to use jaxrs to return html page that is stored in database but i don't know how to do it, the page didn't exists as a file it is just stored in the database stored as html text
– magran x
Nov 13 at 12:29






thank you for your reaction, i want to use jaxrs to return html page that is stored in database but i don't know how to do it, the page didn't exists as a file it is just stored in the database stored as html text
– magran x
Nov 13 at 12:29














Kukeltje can you elaborate a little bit what that means. thank you
– magran x
Nov 13 at 12:31




Kukeltje can you elaborate a little bit what that means. thank you
– magran x
Nov 13 at 12:31

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280691%2fget-a-blog-content-dynamically-using-resteasy%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280691%2fget-a-blog-content-dynamically-using-resteasy%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Can I use Tabulator js library in my java Spring + Thymeleaf project?