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.
jax-rs blogs resteasy
add a comment |
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.
jax-rs blogs resteasy
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
add a comment |
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.
jax-rs blogs resteasy
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
jax-rs blogs resteasy
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
add a comment |
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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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