Created
November 27, 2015 13:51
-
-
Save danielgek/3bca6b43402dc82ac926 to your computer and use it in GitHub Desktop.
StrutsRestPlugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.danielgek.webclient.controllers; | |
import com.opensymphony.xwork2.ModelDriven; | |
import org.apache.struts2.rest.DefaultHttpHeaders; | |
import org.apache.struts2.rest.HttpHeaders; | |
import org.apache.struts2.rest.RestActionSupport; | |
/** | |
* Created by danielgek on 26/11/15. | |
*/ | |
public class UsersController extends RestActionSupport implements ModelDriven<Object> { | |
private Object object; | |
// GET /data/order/1 | |
public HttpHeaders show() { | |
object = "asdfasdfasdf"; | |
return new DefaultHttpHeaders("show"); | |
} | |
// GET /data/order | |
public HttpHeaders index() { | |
return new DefaultHttpHeaders("index") | |
.disableCaching(); | |
} | |
@Override | |
public Object getModel() { | |
return object; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE struts PUBLIC | |
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" | |
"http://struts.apache.org/dtds/struts-2.3.dtd"> | |
<struts> | |
<constant name="struts.devMode" value="true" /> | |
<constant name="struts.convention.action.suffix" value="Controller"/> | |
<constant name="struts.convention.action.mapAllMatches" value="true"/> | |
<constant name="struts.convention.package.locators" value="controllers"/> | |
</struts> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%-- | |
Created by IntelliJ IDEA. | |
User: danielgek | |
Date: 27/11/15 | |
Time: 00:10 | |
To change this template use File | Settings | File Templates. | |
--%> | |
<%@ page contentType="text/html;charset=UTF-8" language="java" %> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" | |
version="3.1" metadata-complete="true"> | |
<filter> | |
<filter-name>struts2</filter-name> | |
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> | |
</filter> | |
<filter-mapping> | |
<filter-name>struts2</filter-name> | |
<url-pattern>/*</url-pattern> | |
</filter-mapping> | |
</web-app> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment