mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
angular prototype
This commit is contained in:
27
src/main/java/com/commafeed/frontend/pages/JSONPage.java
Normal file
27
src/main/java/com/commafeed/frontend/pages/JSONPage.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.commafeed.frontend.pages;
|
||||
|
||||
import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
|
||||
import org.apache.wicket.markup.html.WebPage;
|
||||
import org.apache.wicket.request.handler.TextRequestHandler;
|
||||
import org.apache.wicket.request.mapper.parameter.PageParameters;
|
||||
|
||||
import com.commafeed.frontend.components.auth.Role;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@AuthorizeInstantiation(Role.USER)
|
||||
public abstract class JSONPage extends WebPage {
|
||||
|
||||
public JSONPage() {
|
||||
this(new PageParameters());
|
||||
}
|
||||
|
||||
public JSONPage(PageParameters pageParameters) {
|
||||
getRequestCycle().scheduleRequestHandlerAfterCurrent(
|
||||
new TextRequestHandler("application/json", "UTF-8", new Gson()
|
||||
.toJson(getObject())));
|
||||
}
|
||||
|
||||
protected abstract Object getObject();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user