get a blog content dynamically using RESTeasy












0















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 '18 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 '18 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 '18 at 12:29













  • Kukeltje can you elaborate a little bit what that means. thank you

    – magran x
    Nov 13 '18 at 12:31
















0















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 '18 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 '18 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 '18 at 12:29













  • Kukeltje can you elaborate a little bit what that means. thank you

    – magran x
    Nov 13 '18 at 12:31














0












0








0








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 '18 at 13:04







magran x

















asked Nov 13 '18 at 12:06









magran xmagran x

264




264








  • 2





    It would help if you tell us what is not working. What are you expecting to happen?

    – hochas
    Nov 13 '18 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 '18 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 '18 at 12:29













  • Kukeltje can you elaborate a little bit what that means. thank you

    – magran x
    Nov 13 '18 at 12:31














  • 2





    It would help if you tell us what is not working. What are you expecting to happen?

    – hochas
    Nov 13 '18 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 '18 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 '18 at 12:29













  • Kukeltje can you elaborate a little bit what that means. thank you

    – magran x
    Nov 13 '18 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 '18 at 12:11





It would help if you tell us what is not working. What are you expecting to happen?

– hochas
Nov 13 '18 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 '18 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 '18 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 '18 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 '18 at 12:29















Kukeltje can you elaborate a little bit what that means. thank you

– magran x
Nov 13 '18 at 12:31





Kukeltje can you elaborate a little bit what that means. thank you

– magran x
Nov 13 '18 at 12:31












0






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',
autoActivateHeartbeat: false,
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

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




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

Florida Star v. B. J. F.

Error while running script in elastic search , gateway timeout

Adding quotations to stringified JSON object values