login method skeleton
This commit is contained in:
1 parent
2df87040ed
commit
636b1d8a72
2 files changed
+41
-8
No files matched your search
+30
-4
@@ -1,15 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<module external.linked.project.path="D:\NFCapp_SERVER" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="web" name="Web Gradle : NFCServer.war">
|
||||
<facet type="web" name="Web Gradle : nfc_server-0.1.0.war">
|
||||
<configuration>
|
||||
<webroots />
|
||||
<webroots>
|
||||
<root url="file://$MODULE_DIR$/src/main/webapp" relative="/" />
|
||||
</webroots>
|
||||
<sourceRoots>
|
||||
<root url="file://$MODULE_DIR$/src/main/resources" />
|
||||
<root url="file://$MODULE_DIR$/src/main/java" />
|
||||
<root url="file://$MODULE_DIR$/src/main/resources" />
|
||||
</sourceRoots>
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration>
|
||||
<fileset id="fileset" name="Spring Application Context" removed="false">
|
||||
<file>file://$MODULE_DIR$/src/main/java/application/Config.java</file>
|
||||
<file>file://$MODULE_DIR$/src/main/resources/Spring-Module.xml</file>
|
||||
</fileset>
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="hibernate" name="Hibernate">
|
||||
<configuration>
|
||||
<datasource-map>
|
||||
<unit-entry name="hibernate.cfg.xml" />
|
||||
</datasource-map>
|
||||
<naming-strategy-map />
|
||||
<deploymentDescriptor name="hibernate.cfg.xml" url="file://$MODULE_DIR$/src/main/resources/hibernate.cfg.xml" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
@@ -78,8 +97,15 @@
|
||||
<orderEntry type="library" exported="" name="Gradle: spring-boot-starter-tomcat-1.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" exported="" name="Gradle: spring-web-4.0.3.RELEASE" level="project" />
|
||||
<orderEntry type="library" exported="" name="Gradle: spring-webmvc-4.0.3.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: jstl-1.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Gradle: jstl-1.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: junit-4.11" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: spring-boot-starter-test-1.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: hamcrest-core-1.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: objenesis-1.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: mockito-core-1.9.5" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: hamcrest-library-1.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: spring-test-4.0.3.RELEASE" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -10,10 +10,7 @@ import org.json.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
@@ -47,6 +44,16 @@ public class UserController {
|
||||
return "saved user: "+user.getUserId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public String login(@RequestParam String login,@RequestParam String password) throws JSONException{
|
||||
// test
|
||||
JSONObject test = new JSONObject();
|
||||
test.put("success", true);
|
||||
|
||||
return test.toString();
|
||||
}
|
||||
|
||||
@RequestMapping("/{userId}")
|
||||
public String getUser(@PathVariable("userId") Long userId) throws JSONException{
|
||||
User user = userRepository.findOne(userId);
|
||||
|
||||
Reference in new issue
Block a user