import com.fasterxml.jackson.databind.ObjectMapper;
import com.prueba.core.context.util.AntPathMatcher;
-import com.prueba.core.web.controller.Controller;
import com.prueba.model.domain.AccountResource;
import com.prueba.services.impl.ApiServiceImpl;
import com.sun.net.httpserver.Headers;
import com.sun.net.httpserver.HttpExchange;
-public class ApiController implements Controller {
+public class ApiController implements RestController {
private static final String CONTENT_TYPE_JSON = "application/json";
private static final String CONTENT_TYPE_HEADER = "Content-Type";
private static final Logger LOGGER = LoggerFactory.getLogger(ApiController.class);
import java.io.IOException;
-import com.prueba.core.web.controller.Controller;
import com.prueba.services.impl.LoginServiceImpl;
import com.sun.net.httpserver.HttpExchange;
-public class LoginController implements Controller {
+public class LoginController implements RestController {
@Override
public void handle(HttpExchange httpExchange) throws IOException {
import com.prueba.core.context.security.persistence.SessionInfo;
import com.prueba.core.context.security.persistence.context.SessionContext;
-import com.prueba.core.web.controller.Controller;
-import com.prueba.view.login.PageImpl;
+import com.prueba.view.page.PageImpl;
import com.sun.net.httpserver.HttpExchange;
-public class PagesController implements Controller {
+public class PagesController implements RestController {
@Override
public void handle(HttpExchange httpExchange) throws IOException {
--- /dev/null
+package com.prueba.controllers.rest;
+
+import com.sun.net.httpserver.HttpHandler;
+
+public interface RestController extends HttpHandler {
+
+}
+++ /dev/null
-package com.prueba.core.web.controller;
-
-import com.sun.net.httpserver.HttpHandler;
-
-public interface Controller extends HttpHandler {
-
-}
+++ /dev/null
-package com.prueba.view.login;
-
-import java.io.IOException;
-
-import org.rendersnake.HtmlCanvas;
-
-public class PageImpl {
-
- public String doPage(int number, String userName) throws IOException {
- final HtmlCanvas html = new HtmlCanvas();
- return html
- .html()
- .body()
- .h1().content("PAGE: " + number)
- .output().content("Hello: " + userName)
- ._body()
- ._html()
- .toHtml();
- }
-
-}
--- /dev/null
+package com.prueba.view.page;
+
+import static org.rendersnake.HtmlAttributesFactory.href;
+
+import java.io.IOException;
+
+import org.rendersnake.HtmlCanvas;
+
+public class PageImpl {
+
+ public String doPage(int number, String userName) throws IOException {
+ final HtmlCanvas html = new HtmlCanvas();
+ return html
+ .html()
+ .body()
+ .h1().content("PAGE: " + number)
+ .h1().content("Hello: " + userName)
+ .h1().a(href("/app/login/logout.html"))
+ ._body()
+ ._html()
+ .toHtml();
+ }
+
+}