소스 정리

This commit is contained in:
ParkSeongMin
2015-10-21 02:13:27 +00:00
parent e1befa5e02
commit 2cebf5177f
8 changed files with 254 additions and 8 deletions

View File

@@ -17,5 +17,3 @@ mvn install:install-file -Dfile=./lib/stax-api-1.0.1.jar -DgroupId=stax -Dartifa
mvn install:install-file -Dfile=./lib/xmlbeans-2.3.0.jar -DgroupId=org.apache.xmlbeans -DartifactId=xmlbeans -Dversion=2.3.0 -Dpackaging=jar
mvn install:install-file -Dfile=./lib/xmlpull-1.1.3.1.jar -DgroupId=xmlpull -DartifactId=xmlpull -Dversion=1.1.3.1 -Dpackaging=jar
mvn install:install-file -Dfile=./lib/xpp3_min-1.1.4c.jar -DgroupId=xpp3 -DartifactId=xpp3_min -Dversion=1.1.4c -Dpackaging=jar
mvn install:install-file -Dfile=./lib/able-core-1.2.1.jar -DgroupId=able -DartifactId=able-core -Dversion=1.2.1 -Dpackaging=jar

View File

@@ -41,7 +41,6 @@ public class NexcroMappingExceptionResolver extends AbstractHandlerExceptionReso
// nexacro 요청이 아닌 경우 별도 ExceptionResolver 가 처리 할 수 있도록 null을 반환 한다.
if(NexacroUtil.isNexacroRequest(request)) {
// for able framework
prepareResolveException(request, response, handler, ex);
// Nexacro Exception 만을 handling 하도록 한다.

View File

@@ -60,7 +60,7 @@ public class NexacroInterceptor extends HandlerInterceptorAdapter {
}
private void parseNexacroRequest(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// check in able framework
// checkSecurityWithServletRequest(request);
// checkSecurityMultipart(request);

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="nexacro able sample">
<project name="nexacro sample">
<bannerLeft>
<name>Maven</name>
<src>http://maven.apache.org/images/apache-maven-project.png</src>

View File

@@ -0,0 +1,39 @@
package com.nexacro.spring.servicelayout;
import java.util.Map;
import org.springframework.mock.web.MockServletContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.context.support.XmlWebApplicationContext;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
public class RequestMappingView {
public static void main(String[] args) {
MockServletContext servletContext = new MockServletContext();
/* JavaConfig 설정시 */
// AnnotationConfigWebApplicationContext wac = new
// AnnotationConfigWebApplicationContext();
// wac.setServletContext(servletContext);
// wac.register(WebConfig.class);
/* xml config 설정시 */
XmlWebApplicationContext wac = new XmlWebApplicationContext();
wac.setServletContext(servletContext);
wac.setConfigLocations(new String[] { "com/nexacro/spring/servicelayout/application-config.xml" });
wac.refresh();
RequestMappingHandlerMapping mapping = wac
.getBean(RequestMappingHandlerMapping.class);
Map<RequestMappingInfo, HandlerMethod> map = mapping
.getHandlerMethods();
for (final Map.Entry<RequestMappingInfo, HandlerMethod> entry : map
.entrySet()) {
System.out.println(entry.getKey().getPatternsCondition()
.getPatterns()
+ " : " + entry.getValue().getMethod());
}
wac.close();
}
}

View File

@@ -51,16 +51,18 @@ public class ServiceLayoutController {
for (RequestMappingInfo requestMappingInfoKey : reqMappingInfoKeys) {
HandlerMethod handlerMethod = handlerMethods.get(requestMappingInfoKey);
Annotation[][] paramAnnotaions = handlerMethod.getMethod().getParameterAnnotations();
System.out.println(handlerMethod.getMethod().getName());
String[] parameterNames = parameterNameDiscoverer.getParameterNames(handlerMethod.getMethod());
Annotation[][] paramAnnotaions = handlerMethod.getMethod().getParameterAnnotations();
Set<String> parameters = new HashSet<String>();
for (int i = 0; i < paramAnnotaions.length; i++) {
Annotation[] annotations = paramAnnotaions[i];
for (int j = 0; j < annotations.length; j++) {
Annotation annotation = annotations[j];
System.out.println("\t"+parameterNames[i]);
if (annotation instanceof RequestParam) {
parameters.add(parameterNames[i]);
@@ -81,7 +83,7 @@ public class ServiceLayoutController {
model.addAttribute("apis", serviceLayouts);
return "serviceLayout.html";
return "serviceLayout";
}
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<mvc:annotation-driven />
<context:component-scan base-package="com.nexacro.spring.servicelayout"/>
</beans>

View File

@@ -0,0 +1,196 @@
<!--
jsp 파일로 변경하여 처리하여야 한다.
taglib 등록하여 사용한다.
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
-->
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" session="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Vroombus</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<style type="text/css">
* {margin:0;padding:0}
html,body{margin:0;padding:0;overflow:hidden}
body{
width:100%;
height:100%;
}
#top{
overflow:hidden;
position:absolute;
left:0;
top:0px;
width:100%;
}
#content-area{
overflow:auto;
position:absolute;
left:0;
top:80px;
bottom:0px;
width:100%;
border-style: solid;
}
</style>
</head>
<body>
<div id="top">
<div style="padding: 20px 0px 0px 30px">
<h1>API 호출해 BoA요! ver. 1.0.0 [api 갯수: ${fn:length(apis)}]</h1>
</div>
<div class="ui-widget" style="padding-left: 30px">
<label for="apis">APIs: </label>
<input id="apis" size="60" onclick="this.value = '';"/> [login user : ${loginUser.name}]
</div>
</div>
<div id="content-area" style="padding-left: 30px">
<c:forEach items="${apis}" var="api" varStatus="index">
<hr>
<div style="padding: 7px 0px 2px 0px" id="position${index.count}">
<p style="padding-bottom: 5px; font-size: 15px;">[${index.count}] ${api.pattern}</p>
<p style="padding-bottom: 5px;">Rest&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: <input type="text" id="rest${index.count}" size="100%" value="${api.pattern}"/></p>
<c:if test="${empty api.methods}">
<p style="padding-bottom: 5px;">Parameter: <input type="text" id="parameter${index.count}" size="100%" value="${api.parameterString}" /> <a href="#" onclick="requestAPI('${index.count}', 'GET'); return false;">GET</a></p>
</c:if>
<c:forEach items="${api.methods}" var="method">
<p style="padding-bottom: 5px;">Parameter: <input type="text" id="parameter${index.count}" size="100%" value="${api.parameterString}" /> <a href="#" onclick="requestAPI('${index.count}', '${method}'); return false;">${method}</a></p>
</c:forEach>
<span>response&nbsp;&nbsp;&nbsp;: <a href="#" onclick="removeResponse('${index.count}'); return false;">지우기</a></span>
<pre id="jsonResult${index.count}" style="padding-left: 52px"></pre>
</div>
</c:forEach>
<div>
<p style="text-align:center;">최초 만든이: newoverguy</p>
</div>
</div>
<div id="load_indicator" style="display:none">
<p style="text-align:center; padding:16px 0 0 0"><img src="/img/loading_img.gif" /></p>
</div>
<script type="text/javascript">
var selectionColor = "#DBDBDB";
function removeResponse(index) {
var jsonResultElement = $('#jsonResult' + index);
jsonResultElement.html('');
}
function requestAPI(index, method) {
$('#position' + index).css("background-color", selectionColor);
removeResponse(index);
var jsonResultElement = $('#jsonResult' + index);
var loadIndicatorElement = $('#load_indicator');
var action = $("#rest" + index).val();
var param_str = encodeURI($("#parameter" + index).val().trim());
console.log(param_str);
$.ajax({
type: method,
headers: {token: "${token}"}, //
url: action,
data: param_str,
beforeSend: function() {
loadIndicatorElement.show().fadeIn();
}
}).done(function(data, textStatus, jqXHR) {
var resultStr = "";
if(data instanceof Object) {
resultStr = window.JSON.stringify(data, null, 4);
} else {
resultStr = data;
}
jsonResultElement.text(resultStr);
}).fail(function(jqXHR, tettStatus, errorThrown) {
jsonResultElement.text(tettStatus + ": " + jqXHR.statusText + " " + jqXHR.status);
}).always(function() {
loadIndicatorElement.fadeOut();
});
}
$.fn.scrollTo = function( target, options, callback ){
if(typeof options == 'function' && arguments.length == 2){ callback = options; options = target; }
var settings = $.extend({
scrollTarget : target,
offsetTop : 87,
duration : 500,
easing : 'swing'
}, options);
return this.each(function(){
var scrollPane = $(this);
var scrollTarget = (typeof settings.scrollTarget == "number") ? settings.scrollTarget : $(settings.scrollTarget);
var scrollY = (typeof scrollTarget == "number") ? scrollTarget : scrollTarget.offset().top + scrollPane.scrollTop() - parseInt(settings.offsetTop);
scrollPane.animate({scrollTop : scrollY }, parseInt(settings.duration), settings.easing, function(){
if (typeof callback == 'function') { callback.call(this); }
});
});
}
$(function() {
var availableAPIs = [
<c:forEach items="${apis}" var="api" varStatus="index">
{
id: "${index.count}",
value: "[${index.count}] ${api.pattern} ${api.methods}"
}<c:if test="${not index.last}">,</c:if>
</c:forEach>
];
$("#apis").autocomplete({
source: availableAPIs,
autoFocus: true,
select: function( event, ui ) {
$('#content-area div').css("background-color", "");
// scrollTo 하기 전에 css 배경색을 지워야 한다.
$('#content-area').scrollTo('#position' + ui.item.id);
$('#position' + ui.item.id).css("background-color", selectionColor);
}
})
.keypress(function(e) {
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) {
return false;
}
});
});
</script>
<body>
</body>
</html>