diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..eb5a316cb --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +target diff --git a/Jenkinsfile b/Jenkinsfile index be7508be5..61dc0ac72 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,15 +1,14 @@ pipeline { agent any -/* - tools { - maven "maven3" - } -*/ +tools { + maven "MAVEN3" + jdk "JDK17" + } environment { NEXUS_VERSION = "nexus3" NEXUS_PROTOCOL = "http" - NEXUS_URL = "172.31.40.209:8081" + NEXUS_URL = "IP:8081" NEXUS_REPOSITORY = "vprofile-release" NEXUS_REPO_ID = "vprofile-release" NEXUS_CREDENTIAL_ID = "nexuslogin" diff --git a/README.md b/README.md index 88fd3cbba..928e261b3 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # Prerequisites # -- JDK 11 -- Maven 3 +- JDK 17 +- Maven 3.9 - MySQL 8 # Technologies +- JAKARTA - Spring MVC - Spring Security - Spring Data JPA diff --git a/pom.xml b/pom.xml index 03bba333b..f82bb25fa 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,7 @@ - + + 4.0.0 com.visualpathit vprofile @@ -7,82 +9,148 @@ v2 Visualpathit VProfile Webapp http://maven.apache.org + - 4.2.0.RELEASE - 4.0.2.RELEASE - 1.8.2.RELEASE - 4.3.11.Final - 5.2.1.Final - 8.0.32 - 1.4 - 1.2 - 4.10 - 1.1.3 - 1.8 - 1.8 + 6.0.11 + 3.1.3 + 6.1.2 + 3.1.2 + 7.0.0.Alpha3 + 6.2.0.Final + 8.0.33 + 2.12.0 + + 4.13.2 + 1.5.6 + 17 + 17 + + org.springframework spring-web ${spring.version} - org.springframework spring-webmvc ${spring.version} - + org.springframework.security spring-security-web ${spring-security.version} - org.springframework.security spring-security-config ${spring-security.version} - - - org.hibernate - hibernate-validator - ${hibernate-validator.version} - - org.springframework.data spring-data-jpa ${spring-data-jpa.version} - org.hibernate - hibernate-entitymanager + hibernate-validator + ${hibernate-validator.version} + + + org.hibernate.orm + hibernate-core ${hibernate.version} + + org.springframework + spring-orm + ${spring.version} + + + org.springframework + spring-tx + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.elasticsearch.client + elasticsearch-rest-high-level-client + 7.10.2 + + + org.elasticsearch + elasticsearch + 7.10.2 + + + org.springframework.amqp + spring-rabbit + 3.1.6 + + + com.rabbitmq + amqp-client + 5.21.0 + + + net.spy + spymemcached + 2.12.3 + + mysql mysql-connector-java ${mysql-connector.version} + - commons-dbcp - commons-dbcp - ${commons-dbcp.version} + jakarta.servlet + jakarta.servlet-api + 6.1.0 + provided - - javax.servlet - jstl - ${jstl.version} + jakarta.persistence + jakarta.persistence-api + 3.2.0 + + + jakarta.platform + jakarta.jakartaee-api + 10.0.0 + provided + + + org.springframework.boot + spring-boot-starter-test + ${spring-boot.version} + test + + + org.mockito + mockito-core + 5.5.0 + test + + + org.mockito + mockito-junit-jupiter + 5.5.0 + test + junit junit @@ -90,122 +158,142 @@ test - org.mockito - mockito-core - 1.9.5 + org.junit.jupiter + junit-jupiter-engine + 5.10.0 test - - - org.springframework - spring-test - 3.2.3.RELEASE - test - - - javax.servlet - javax.servlet-api - 3.1.0 - provided - + + + org.junit.jupiter + junit-jupiter-api + 5.10.0 + test + + + org.springframework + spring-test + ${spring.version} + test + ch.qos.logback logback-classic ${logback.version} - org.hamcrest - hamcrest-all - 1.3 - test - - - commons-fileupload - commons-fileupload - 1.3.1 - - - - net.spy - spymemcached - 2.12.3 - - - commons-io - commons-io - 2.4 - - - - org.springframework.amqp - spring-rabbit - 1.7.1.RELEASE - - - - com.rabbitmq - amqp-client - 4.0.2 - - - - org.elasticsearch - elasticsearch - 5.6.4 - - - - org.elasticsearch.client - transport - 5.6.4 - - - - com.google.code.gson - gson - 2.8.2 - + org.hamcrest + hamcrest-all + 1.3 + test + + + + + org.apache.logging.log4j + log4j-api + 2.23.1 + + + org.apache.logging.log4j + log4j-core + 2.20.0 + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.20.0 + + + + commons-fileupload + commons-fileupload + 1.4 + + + commons-io + commons-io + 2.11.0 + + + org.apache.commons + commons-dbcp2 + 2.12.0 + + + org.elasticsearch.plugin + aggs-matrix-stats-client + 7.10.2 + + + com.fasterxml.jackson.core + jackson-databind + 2.13.0 + + + + org.springframework + spring-messaging + ${spring.version} + + + + jakarta.servlet.jsp.jstl + jakarta.servlet.jsp.jstl-api + 2.0.0 + + + + + org.glassfish.web + jakarta.servlet.jsp.jstl + 2.0.0 + + - + + + + org.eclipse.jetty jetty-maven-plugin - 9.2.11.v20150529 + 11.0.15 - 10 / - - - org.apache.maven.plugins - maven-war-plugin - 3.2.2 - - - org.jacoco - jacoco-maven-plugin - 0.8.4 - - - jacoco-initialize - process-resources - - prepare-agent - - - - jacoco-site - post-integration-test - - report - - - - - + + + + org.apache.maven.plugins + maven-war-plugin + 3.4.0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/visualpathit/account/AuthenticationFailureHandler.java b/src/main/java/com/visualpathit/account/AuthenticationFailureHandler.java new file mode 100644 index 000000000..48e40515c --- /dev/null +++ b/src/main/java/com/visualpathit/account/AuthenticationFailureHandler.java @@ -0,0 +1,18 @@ +package com.visualpathit.account; + +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; + +import java.io.IOException; + +public class AuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler { + + @Override + public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, + AuthenticationException exception) throws IOException { + // Redirect to custom error page + getRedirectStrategy().sendRedirect(request, response, "/login?error"); + } +} diff --git a/src/main/java/com/visualpathit/account/GlobalExceptionHandler.java b/src/main/java/com/visualpathit/account/GlobalExceptionHandler.java new file mode 100644 index 000000000..321575a2e --- /dev/null +++ b/src/main/java/com/visualpathit/account/GlobalExceptionHandler.java @@ -0,0 +1,28 @@ +package com.visualpathit.account; + +import jakarta.servlet.http.HttpServletRequest; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; + +@ControllerAdvice +public class GlobalExceptionHandler { + + @ExceptionHandler(UserNotFoundException.class) + public String handleUserNotFoundException(UserNotFoundException ex, HttpServletRequest request) { + request.setAttribute("errorMessage", ex.getMessage()); + return "forward:/WEB-INF/views/error/404.jsp"; + } + + @ExceptionHandler(BadCredentialsException.class) + public String handleBadCredentialsException(BadCredentialsException ex, HttpServletRequest request) { + request.setAttribute("errorMessage", "Invalid username or password."); + return "forward:/WEB-INF/views/error/500.jsp"; // You can choose a different page for BadCredentialsException if preferred + } + + @ExceptionHandler(Exception.class) + public String handleGenericException(Exception ex, HttpServletRequest request) { + request.setAttribute("errorMessage", "An unexpected error occurred. Please try again later."); + return "forward:/WEB-INF/views/error/500.jsp"; + } +} diff --git a/src/main/java/com/visualpathit/account/UserNotFoundException.java b/src/main/java/com/visualpathit/account/UserNotFoundException.java new file mode 100644 index 000000000..1601a7f28 --- /dev/null +++ b/src/main/java/com/visualpathit/account/UserNotFoundException.java @@ -0,0 +1,7 @@ +package com.visualpathit.account; + +public class UserNotFoundException extends RuntimeException { + public UserNotFoundException(String message) { + super(message); + } +} diff --git a/src/main/java/com/visualpathit/account/controller/ElasticSearchController.java b/src/main/java/com/visualpathit/account/controller/ElasticSearchController.java index 6fe7f4104..bb321cb7f 100644 --- a/src/main/java/com/visualpathit/account/controller/ElasticSearchController.java +++ b/src/main/java/com/visualpathit/account/controller/ElasticSearchController.java @@ -2,137 +2,105 @@ import java.io.IOException; import java.util.List; -import java.util.Map; -import java.util.concurrent.ExecutionException; -import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; +import org.apache.http.HttpHost; +import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.delete.DeleteResponse; +import org.elasticsearch.action.get.GetRequest; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.update.UpdateRequest; import org.elasticsearch.action.update.UpdateResponse; +import org.elasticsearch.client.RequestOptions; +import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.common.xcontent.XContentBuilder; +import org.elasticsearch.common.xcontent.XContentFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import com.google.gson.Gson; import com.visualpathit.account.model.User; import com.visualpathit.account.service.UserService; import com.visualpathit.account.utils.ElasticsearchUtil; -import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; - @Controller public class ElasticSearchController { - @Autowired + + @Autowired private UserService userService; - - @RequestMapping(value="/user/elasticsearch", method=RequestMethod.GET) + + @RequestMapping(value = "/user/elasticsearch", method = RequestMethod.GET) public String insert(final Model model) throws IOException { - List users = userService.getList(); - //contextMapping(); - - /* for (User user : users) { - //IndexRequest indexRequest = new IndexRequest("users","user", String.valueOf(user.getId())); - //indexRequest.source(new Gson().toJson(user)); - //IndexResponse response = ElasticsearchUtil.trannsportClient().index(indexRequest).actionGet(); - System.out.println("User" +new Gson().toJson(user)); - }*/ - String result =""; - for (User user : users) { - IndexResponse response = ElasticsearchUtil.trannsportClient().prepareIndex("users","user", String.valueOf(user.getId())) - .setSource(jsonBuilder() - .startObject() - .field("name", user.getUsername()) - .field("DOB",user.getDateOfBirth()) - .field("fatherName",user.getFatherName()) - .field("motherName",user.getMotherName()) - .field("gender",user.getGender()) - .field("nationality",user.getNationality()) - .field("phoneNumber", user.getPhoneNumber()) - .endObject() - ) - .get(); - String res =response.getResult().toString(); - System.out.println(res); - result="Users"; - } - model.addAttribute(result); + List users = userService.getList(); + + try (RestHighLevelClient client = ElasticsearchUtil.getRestHighLevelClient()) { + for (User user : users) { + IndexRequest indexRequest = new IndexRequest("users", "_doc", String.valueOf(user.getId())) + .source(XContentFactory.jsonBuilder() + .startObject() + .field("name", user.getUsername()) + .field("DOB", user.getDateOfBirth()) + .field("fatherName", user.getFatherName()) + .field("motherName", user.getMotherName()) + .field("gender", user.getGender()) + .field("nationality", user.getNationality()) + .field("phoneNumber", user.getPhoneNumber()) + .endObject()); + + IndexResponse response = client.index(indexRequest, RequestOptions.DEFAULT); + String res = response.getResult().toString(); + System.out.println(res); + } + } + + model.addAttribute("result", "Users indexed successfully"); return "elasticeSearchRes"; - } - @RequestMapping(value="/rest/users/view/{id}", method=RequestMethod.GET) - public String view(@PathVariable final String id,final Model model) { - GetResponse getResponse = ElasticsearchUtil.trannsportClient().prepareGet("users", "user", id).get(); - System.out.println(getResponse.getSource()); - - model.addAttribute("res", getResponse.getSource().get("name")); - + @RequestMapping(value = "/rest/users/view/{id}", method = RequestMethod.GET) + public String view(@PathVariable final String id, final Model model) throws IOException { + try (RestHighLevelClient client = ElasticsearchUtil.getRestHighLevelClient()) { + GetRequest getRequest = new GetRequest("users", "_doc", id); + GetResponse getResponse = client.get(getRequest, RequestOptions.DEFAULT); + + System.out.println(getResponse.getSourceAsString()); + model.addAttribute("res", getResponse.getSource().get("name")); + } + return "elasticeSearchRes"; } - /*@RequestMapping(value = "/get_user_list", method = RequestMethod.GET) - public @ResponseBody List getTagList(@RequestParam("term") String query) { - List users = userService.getList(); - List tagList = null; - for (User user : users) { - GetResponse getResponse = ElasticsearchUtil.trannsportClient().prepareGet("users", "user" ,String.valueOf(user.getId())).get(); - System.out.println(getResponse.getSource()); - - tagList.add(getResponse.getSource()); - } - return tagList; - }*/ - - @RequestMapping(value="/rest/users/update/{id}", method=RequestMethod.GET) - public String update(@PathVariable final String id,final Model model) throws IOException { - - UpdateRequest updateRequest = new UpdateRequest(); - updateRequest.index("employee") - .type("id") - .id(id) - .doc(jsonBuilder() - .startObject() - .field("gender", "male") - .endObject()); - try { - UpdateResponse updateResponse = ElasticsearchUtil.trannsportClient().update(updateRequest).get(); + + @RequestMapping(value = "/rest/users/update/{id}", method = RequestMethod.GET) + public String update(@PathVariable final String id, final Model model) throws IOException { + try (RestHighLevelClient client = ElasticsearchUtil.getRestHighLevelClient()) { + UpdateRequest updateRequest = new UpdateRequest("users", "_doc", id) + .doc(XContentFactory.jsonBuilder() + .startObject() + .field("gender", "male") + .endObject()); + + UpdateResponse updateResponse = client.update(updateRequest, RequestOptions.DEFAULT); System.out.println(updateResponse.status()); model.addAttribute("res", updateResponse.status()); - return "elasticeSearchRes"; - } catch (InterruptedException | ExecutionException e) { - System.out.println(e); } + return "elasticeSearchRes"; } - @RequestMapping(value="/rest/users/delete/{id}", method=RequestMethod.GET) - public String delete(@PathVariable final String id,final Model model) { - DeleteResponse deleteResponse =ElasticsearchUtil.trannsportClient().prepareDelete("employee", "id", id).get(); - System.out.println(deleteResponse.getResult().toString()); - model.addAttribute("res", deleteResponse.getResult().toString()); + @RequestMapping(value = "/rest/users/delete/{id}", method = RequestMethod.GET) + public String delete(@PathVariable final String id, final Model model) throws IOException { + try (RestHighLevelClient client = ElasticsearchUtil.getRestHighLevelClient()) { + DeleteRequest deleteRequest = new DeleteRequest("users", "_doc", id); + DeleteResponse deleteResponse = client.delete(deleteRequest, RequestOptions.DEFAULT); + + System.out.println(deleteResponse.getResult().toString()); + model.addAttribute("res", deleteResponse.getResult().toString()); + } + return "elasticeSearchRes"; } - /*public void contextMapping() throws IOException{ - String json ="{" - + "\"mappings\":{" - + "\"users\":\" {" - + "\"properties\" : {" - + "\"name\" : { \"type\" : \"string\" }," - + " \"city\" : { \"type\" : \"string\" }," - + "\"name_suggest\" : {" - + "\"type\" : \"completion\"" - + "}}" - + "}"; - IndexResponse response = ElasticsearchUtil.trannsportClient().prepareIndex("users", "data") - .setSource(json).execute().actionGet(); - - }*/ } diff --git a/src/main/java/com/visualpathit/account/controller/RabbitMqController.java b/src/main/java/com/visualpathit/account/controller/RabbitMqController.java new file mode 100644 index 000000000..7ce311c4c --- /dev/null +++ b/src/main/java/com/visualpathit/account/controller/RabbitMqController.java @@ -0,0 +1,51 @@ +package com.visualpathit.account.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.servlet.ModelAndView; + +import com.rabbitmq.client.Connection; +import com.rabbitmq.client.ConnectionFactory; +import com.visualpathit.account.utils.RabbitMqUtil; + +import java.io.IOException; +import java.util.concurrent.TimeoutException; + +@Controller +public class RabbitMqController { + + @Autowired + private RabbitMqUtil rabbitMqUtil; + + @GetMapping("/user/rabbit") + public ModelAndView checkRabbitMqStatus() { + ModelAndView modelAndView = new ModelAndView(); + ConnectionFactory factory = new ConnectionFactory(); + factory.setHost(RabbitMqUtil.getRabbitMqHost()); + factory.setPort(Integer.parseInt(RabbitMqUtil.getRabbitMqPort())); + factory.setUsername(RabbitMqUtil.getRabbitMqUser()); + factory.setPassword(RabbitMqUtil.getRabbitMqPassword()); + + Connection connection = null; + try { + connection = factory.newConnection(); + if (connection.isOpen()) { + modelAndView.setViewName("rabbitmq"); + } else { + modelAndView.setViewName("rabbitmq-error"); + } + } catch (IOException | TimeoutException e) { + modelAndView.setViewName("rabbitmq-error"); + } finally { + if (connection != null) { + try { + connection.close(); + } catch (IOException e) { + // Log the exception if needed + } + } + } + return modelAndView; + } +} diff --git a/src/main/java/com/visualpathit/account/controller/UserController.java b/src/main/java/com/visualpathit/account/controller/UserController.java index c370682e2..f57988dd8 100644 --- a/src/main/java/com/visualpathit/account/controller/UserController.java +++ b/src/main/java/com/visualpathit/account/controller/UserController.java @@ -6,21 +6,19 @@ import com.visualpathit.account.service.UserService; import com.visualpathit.account.utils.MemcachedUtils; import com.visualpathit.account.validator.UserValidator; - -import java.util.List; -import java.util.UUID; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -/**{@author imrant}*/ +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.UUID; + @Controller public class UserController { + @Autowired private UserService userService; @@ -29,146 +27,139 @@ public class UserController { @Autowired private UserValidator userValidator; - + @Autowired private ProducerService producerService; - - /** {@inheritDoc} */ - @RequestMapping(value = "/registration", method = RequestMethod.GET) - public final String registration(final Model model) { + + @GetMapping("/registration") + public String registration(Model model) { model.addAttribute("userForm", new User()); - return "registration"; - } - /** {@inheritDoc} */ - @RequestMapping(value = "/registration", method = RequestMethod.POST) - public final String registration(final @ModelAttribute("userForm") User userForm, - final BindingResult bindingResult, final Model model) { - + return "registration"; + } + + @PostMapping("/registration") + public String registration(@ModelAttribute("userForm") @Valid User userForm, BindingResult bindingResult, Model model) { userValidator.validate(userForm, bindingResult); + if (bindingResult.hasErrors()) { return "registration"; } - System.out.println("User PWD:"+userForm.getPassword()); - userService.save(userForm); - securityService.autologin(userForm.getUsername(), userForm.getPasswordConfirm()); + userService.save(userForm); + boolean loginSuccessful = securityService.autologin(userForm.getUsername(), userForm.getPasswordConfirm()); + if (!loginSuccessful) { + return "redirect:/login?error"; + } return "redirect:/welcome"; } - /** {@inheritDoc} */ - @RequestMapping(value = "/login", method = RequestMethod.GET) - public final String login(final Model model, final String error, final String logout) { - System.out.println("Model data"+model.toString()); - if (error != null){ + + @GetMapping("/") + public String login(Model model, @RequestParam(value = "error", required = false) String error, + @RequestParam(value = "logout", required = false) String logout) { + if (error != null) { model.addAttribute("error", "Your username and password is invalid."); } - if (logout != null){ + if (logout != null) { model.addAttribute("message", "You have been logged out successfully."); } return "login"; } - /** {@inheritDoc} */ - @RequestMapping(value = { "/", "/welcome"}, method = RequestMethod.GET) - public final String welcome(final Model model) { + + @PostMapping("/login") + public String loginPost(@ModelAttribute("user") User user, Model model) { + boolean loginSuccessful = securityService.autologin(user.getUsername(), user.getPassword()); + if (!loginSuccessful) { + model.addAttribute("error", "Your username and password is invalid."); + return "login"; + } + return "redirect:/welcome"; + } + + @GetMapping("/welcome") + public String welcome(Model model) { return "welcome"; } - /** {@inheritDoc} */ - @RequestMapping(value = { "/index"} , method = RequestMethod.GET) - public final String indexHome(final Model model) { + + @GetMapping("/index") + public String indexHome(Model model) { return "index_home"; } - @RequestMapping(value = "/users", method = RequestMethod.GET) - public String getAllUsers(Model model) - { - + + @GetMapping("/users") + public String getAllUsers(Model model) { List users = userService.getList(); - //JSONObject jsonObject - System.out.println("All User Data:::" + users); model.addAttribute("users", users); return "userList"; } - - @RequestMapping(value = "/users/{id}", method = RequestMethod.GET) - public String getOneUser(@PathVariable(value="id") String id,Model model) - { - String Result =""; - try{ - if( id != null && MemcachedUtils.memcachedGetData(id)!= null){ - User userData = MemcachedUtils.memcachedGetData(id); - Result ="Data is From Cache"; - System.out.println("--------------------------------------------"); - System.out.println("Data is From Cache !!"); - System.out.println("--------------------------------------------"); - System.out.println("Father ::: "+userData.getFatherName()); - model.addAttribute("user", userData); - model.addAttribute("Result", Result); - } - else{ - User user = userService.findById(Long.parseLong(id)); - Result = MemcachedUtils.memcachedSetData(user,id); - if(Result == null ){ - Result ="Memcached Connection Failure !!"; - } - System.out.println("--------------------------------------------"); - System.out.println("Data is From Database"); - System.out.println("--------------------------------------------"); - System.out.println("Result ::: "+ Result); - model.addAttribute("user", user); - model.addAttribute("Result", Result); - } - } catch (Exception e) { - System.out.println( e.getMessage() ); - } + + @GetMapping("/users/{id}") + public String getOneUser(@PathVariable("id") String id, Model model) { + String result; + try { + User userData = MemcachedUtils.memcachedGetData(id); + if (userData != null) { + result = "Data is From Cache"; + model.addAttribute("user", userData); + } else { + User user = userService.findById(Long.parseLong(id)); + result = MemcachedUtils.memcachedSetData(user, id); + if (result == null) { + result = "Memcached Connection Failure !!"; + } + model.addAttribute("user", user); + } + model.addAttribute("Result", result); + } catch (Exception e) { + e.printStackTrace(); + } return "user"; } - - /** {@inheritDoc} */ - @RequestMapping(value = { "/user/{username}"} , method = RequestMethod.GET) - public final String userUpdate(@PathVariable(value="username") String username,final Model model) { - User user = userService.findByUsername(username); - System.out.println("User Data:::" + user); - model.addAttribute("user", user); - return "userUpdate"; + + @GetMapping("/user/{username}") + public String userUpdate(@PathVariable("username") String username, Model model) { + User user = userService.findByUsername(username); + model.addAttribute("user", user); + return "userUpdate"; } - @RequestMapping(value = { "/user/{username}"} , method = RequestMethod.POST) - public final String userUpdateProfile(@PathVariable(value="username") String username,final @ModelAttribute("user") User userForm,final Model model) { - User user = userService.findByUsername(username); - user.setUsername(userForm.getUsername()); - user.setUserEmail(userForm.getUserEmail()); - user.setDateOfBirth(userForm.getDateOfBirth()); - user.setFatherName(userForm.getFatherName()); - user.setMotherName(userForm.getMotherName()); - user.setGender(userForm.getGender()); - user.setLanguage(userForm.getLanguage()); - user.setMaritalStatus(userForm.getMaritalStatus()); - user.setNationality(userForm.getNationality()); - user.setPermanentAddress(userForm.getPermanentAddress()); - user.setTempAddress(userForm.getTempAddress()); - user.setPhoneNumber(userForm.getPhoneNumber()); - user.setSecondaryPhoneNumber(userForm.getSecondaryPhoneNumber()); - user.setPrimaryOccupation(userForm.getPrimaryOccupation()); - user.setSecondaryOccupation(userForm.getSecondaryOccupation()); - user.setSkills(userForm.getSkills()); - user.setWorkingExperience(userForm.getWorkingExperience()); - userService.save(user); - /*model.addAttribute("user", user);*/ - return "welcome"; + + @PostMapping("/user/{username}") + public String userUpdateProfile(@PathVariable("username") String username, @ModelAttribute("user") User userForm) { + User user = userService.findByUsername(username); + updateUserDetails(user, userForm); + userService.save(user); + return "welcome"; } - - @RequestMapping(value={"/user/rabbit"}, method={RequestMethod.GET}) - public String rabbitmqSetUp() { - System.out.println("Rabbit mq method is callled!!!"); - for (int i = 0; i < 20; i++) { - producerService.produceMessage(generateString()); - } - return "rabbitmq"; + +// @GetMapping("/user/rabbit") +// public String rabbitmqSetUp() { +// for (int i = 0; i < 20; i++) { +// producerService.produceMessage(generateString()); +// } +// return "rabbitmq"; +// } + + private void updateUserDetails(User user, User userForm) { + user.setUsername(userForm.getUsername()); + user.setUserEmail(userForm.getUserEmail()); + user.setDateOfBirth(userForm.getDateOfBirth()); + user.setFatherName(userForm.getFatherName()); + user.setMotherName(userForm.getMotherName()); + user.setGender(userForm.getGender()); + user.setLanguage(userForm.getLanguage()); + user.setMaritalStatus(userForm.getMaritalStatus()); + user.setNationality(userForm.getNationality()); + user.setPermanentAddress(userForm.getPermanentAddress()); + user.setTempAddress(userForm.getTempAddress()); + user.setPhoneNumber(userForm.getPhoneNumber()); + user.setSecondaryPhoneNumber(userForm.getSecondaryPhoneNumber()); + user.setPrimaryOccupation(userForm.getPrimaryOccupation()); + user.setSecondaryOccupation(userForm.getSecondaryOccupation()); + user.setSkills(userForm.getSkills()); + user.setWorkingExperience(userForm.getWorkingExperience()); } - + private static String generateString() { - String uuid = UUID.randomUUID().toString(); - return "uuid = " + uuid; + return "uuid = " + UUID.randomUUID().toString(); } - - - } diff --git a/src/main/java/com/visualpathit/account/model/Role.java b/src/main/java/com/visualpathit/account/model/Role.java index af821ad0e..1914f2149 100644 --- a/src/main/java/com/visualpathit/account/model/Role.java +++ b/src/main/java/com/visualpathit/account/model/Role.java @@ -1,6 +1,7 @@ package com.visualpathit.account.model; -import javax.persistence.*; +import jakarta.persistence.*; + import java.util.Set; /**{@author imrant} !*/ @Entity @@ -14,7 +15,7 @@ public class Role { private Set users; /** {@inheritDoc}} !*/ @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) /** * {@link Role#id} !*/ diff --git a/src/main/java/com/visualpathit/account/model/User.java b/src/main/java/com/visualpathit/account/model/User.java index 23050ce94..ffe522abc 100644 --- a/src/main/java/com/visualpathit/account/model/User.java +++ b/src/main/java/com/visualpathit/account/model/User.java @@ -1,7 +1,7 @@ package com.visualpathit.account.model; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import java.util.Set; @@ -44,7 +44,7 @@ public class User implements Serializable { private Set roles; /** {@inheritDoc}} !*/ @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) /** {@link User#id} */ public Long getId() { return id; diff --git a/src/main/java/com/visualpathit/account/service/SecurityService.java b/src/main/java/com/visualpathit/account/service/SecurityService.java index dbd4d9bc5..534171f90 100644 --- a/src/main/java/com/visualpathit/account/service/SecurityService.java +++ b/src/main/java/com/visualpathit/account/service/SecurityService.java @@ -5,5 +5,5 @@ public interface SecurityService { /** {@inheritDoc}} !*/ String findLoggedInUsername(); - void autologin(String username, String password); + boolean autologin(String username, String password); } diff --git a/src/main/java/com/visualpathit/account/service/SecurityServiceImpl.java b/src/main/java/com/visualpathit/account/service/SecurityServiceImpl.java index 14fee640d..5c826f066 100644 --- a/src/main/java/com/visualpathit/account/service/SecurityServiceImpl.java +++ b/src/main/java/com/visualpathit/account/service/SecurityServiceImpl.java @@ -4,49 +4,45 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.authentication - .UsernamePasswordAuthenticationToken; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.stereotype.Service; -/** {@author imrant} !*/ + @Service public class SecurityServiceImpl implements SecurityService { - /** authenticationManager !*/ - @Autowired + @Autowired private AuthenticationManager authenticationManager; - /** userDetailsService !*/ + @Autowired private UserDetailsService userDetailsService; - /** Logger creation !*/ - private static final Logger logger = LoggerFactory - .getLogger(SecurityServiceImpl.class); + private static final Logger logger = LoggerFactory.getLogger(SecurityServiceImpl.class); @Override public String findLoggedInUsername() { - Object userDetails = SecurityContextHolder.getContext() - .getAuthentication().getDetails(); + Object userDetails = SecurityContextHolder.getContext().getAuthentication().getDetails(); if (userDetails instanceof UserDetails) { return ((UserDetails) userDetails).getUsername(); } - return null; } @Override - public void autologin(final String username, final String password) { + public boolean autologin(final String username, final String password) { UserDetails userDetails = userDetailsService.loadUserByUsername(username); - UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = - new UsernamePasswordAuthenticationToken(userDetails, password, userDetails.getAuthorities()); + UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = + new UsernamePasswordAuthenticationToken(userDetails, password, userDetails.getAuthorities()); authenticationManager.authenticate(usernamePasswordAuthenticationToken); if (usernamePasswordAuthenticationToken.isAuthenticated()) { - SecurityContextHolder.getContext() - .setAuthentication(usernamePasswordAuthenticationToken); + SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken); logger.debug(String.format("Auto login %s successfully!", username)); + return true; } + logger.debug(String.format("Auto login %s failed!", username)); + return false; } } diff --git a/src/main/java/com/visualpathit/account/service/UserDetailsServiceImpl.java b/src/main/java/com/visualpathit/account/service/UserDetailsServiceImpl.java index 04c68ae80..f2bbb1bad 100644 --- a/src/main/java/com/visualpathit/account/service/UserDetailsServiceImpl.java +++ b/src/main/java/com/visualpathit/account/service/UserDetailsServiceImpl.java @@ -3,18 +3,20 @@ import com.visualpathit.account.model.Role; import com.visualpathit.account.model.User; import com.visualpathit.account.repository.UserRepository; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.HashSet; import java.util.Set; + /** {@author imrant} !*/ +@Service public class UserDetailsServiceImpl implements UserDetailsService { @Autowired /** userRepository !*/ @@ -22,16 +24,18 @@ public class UserDetailsServiceImpl implements UserDetailsService { @Override @Transactional(readOnly = true) - public UserDetails loadUserByUsername(final String username) - throws UsernameNotFoundException { + public UserDetails loadUserByUsername(final String username) throws UsernameNotFoundException { User user = userRepository.findByUsername(username); + if (user == null) { + throw new UsernameNotFoundException("User not found with username: " + username); + } + Set grantedAuthorities = new HashSet<>(); for (Role role : user.getRoles()) { grantedAuthorities.add(new SimpleGrantedAuthority(role.getName())); } - return new org.springframework.security.core - .userdetails.User(user.getUsername(), user.getPassword(), grantedAuthorities); + return new org.springframework.security.core.userdetails.User(user.getUsername(), user.getPassword(), grantedAuthorities); } } diff --git a/src/main/java/com/visualpathit/account/service/UserServiceImpl.java b/src/main/java/com/visualpathit/account/service/UserServiceImpl.java index 2426b853f..fd48cd3c7 100644 --- a/src/main/java/com/visualpathit/account/service/UserServiceImpl.java +++ b/src/main/java/com/visualpathit/account/service/UserServiceImpl.java @@ -42,6 +42,6 @@ public List getList() { } @Override public User findById(long id){ - return userRepository.findOne(id); + return userRepository.findById(id); } } diff --git a/src/main/java/com/visualpathit/account/utils/ElasticsearchUtil.java b/src/main/java/com/visualpathit/account/utils/ElasticsearchUtil.java index 838fa536e..b4d08685a 100644 --- a/src/main/java/com/visualpathit/account/utils/ElasticsearchUtil.java +++ b/src/main/java/com/visualpathit/account/utils/ElasticsearchUtil.java @@ -1,48 +1,45 @@ package com.visualpathit.account.utils; +import java.io.IOException; import java.net.InetSocketAddress; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.transport.InetSocketTransportAddress; -import org.elasticsearch.transport.client.PreBuiltTransportClient; +import org.apache.http.HttpHost; +import org.elasticsearch.client.RequestOptions; +import org.elasticsearch.client.RestClient; +import org.elasticsearch.client.RestHighLevelClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.visualpathit.account.beans.Components; + @Service public class ElasticsearchUtil { - - private static Components object; + + private static Components object; + @Autowired - public void setComponents(Components object){ - ElasticsearchUtil.object = object; - + public void setComponents(Components object) { + ElasticsearchUtil.object = object; } - public static TransportClient trannsportClient() { - System.out.println(" elasticsearch client"); - String elasticsearchHost =object.getElasticsearchHost(); - String elasticsearchPort =object.getElasticsearchPort(); - String elasticsearchCluster =object.getElasticsearchCluster(); - String elasticsearchNode =object.getElasticsearchNode(); - System.out.println(" elasticsearchHost ........"+ elasticsearchHost); - System.out.println(" elasticsearchHost ........"+ elasticsearchPort); - TransportClient client = null; - try { - Settings settings = Settings.builder() - .put("cluster.name",elasticsearchCluster) - .put("node.name",elasticsearchNode) - .build(); - client = new PreBuiltTransportClient(settings) - .addTransportAddress( - new InetSocketTransportAddress( - new InetSocketAddress(elasticsearchHost, Integer.parseInt(elasticsearchPort)))); + public static RestHighLevelClient getRestHighLevelClient() { + System.out.println("Creating Elasticsearch client..."); + String elasticsearchHost = object.getElasticsearchHost(); + String elasticsearchPort = object.getElasticsearchPort(); - } - catch (Exception e) { - e.printStackTrace(); - } - return client; - } + System.out.println("Elasticsearch Host: " + elasticsearchHost); + System.out.println("Elasticsearch Port: " + elasticsearchPort); + + RestHighLevelClient client = null; + try { + client = new RestHighLevelClient( + RestClient.builder( + new HttpHost(elasticsearchHost, Integer.parseInt(elasticsearchPort), "http") + ) + ); + } catch (Exception e) { + e.printStackTrace(); + } + return client; + } } diff --git a/src/main/resources/accountsdb.sql b/src/main/resources/accountsdb.sql index d224d810f..8aedbfd85 100644 --- a/src/main/resources/accountsdb.sql +++ b/src/main/resources/accountsdb.sql @@ -26,7 +26,7 @@ CREATE TABLE `role` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36,6 +36,7 @@ CREATE TABLE `role` ( LOCK TABLES `role` WRITE; /*!40000 ALTER TABLE `role` DISABLE KEYS */; INSERT INTO `role` VALUES (1,'ROLE_USER'); +INSERT INTO `role` VALUES (2,'ROLE_ADMIN'); /*!40000 ALTER TABLE `role` ENABLE KEYS */; UNLOCK TABLES; @@ -44,8 +45,8 @@ UNLOCK TABLES; -- DROP TABLE IF EXISTS `user`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!40101 SET @saved_cs_client = @@CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_CLIENT = utf8 */; CREATE TABLE `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) DEFAULT NULL, @@ -53,7 +54,7 @@ CREATE TABLE `user` ( `password` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET CHARACTER_SET_CLIENT = @saved_cs_client */; -- -- Dumping data for table `user` @@ -70,8 +71,8 @@ UNLOCK TABLES; -- DROP TABLE IF EXISTS `user_role`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!40101 SET @saved_cs_client = @@CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_CLIENT = utf8 */; CREATE TABLE `user_role` ( `user_id` int(11) NOT NULL, `role_id` int(11) NOT NULL, @@ -80,7 +81,7 @@ CREATE TABLE `user_role` ( CONSTRAINT `fk_user_role_roleid` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_user_role_userid` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET CHARACTER_SET_CLIENT = @saved_cs_client */; -- -- Dumping data for table `user_role` @@ -88,7 +89,8 @@ CREATE TABLE `user_role` ( LOCK TABLES `user_role` WRITE; /*!40000 ALTER TABLE `user_role` DISABLE KEYS */; -INSERT INTO `user_role` VALUES (4,1); +INSERT INTO `user_role` VALUES (4,1); -- ROLE_USER +INSERT INTO `user_role` VALUES (4,2); -- ROLE_ADMIN /*!40000 ALTER TABLE `user_role` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index c04343d72..c2cd8e80a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,5 +1,5 @@ #JDBC Configutation for Database Connection -jdbc.driverClassName=com.mysql.jdbc.Driver +jdbc.driverClassName=com.mysql.cj.jdbc.Driver jdbc.url=jdbc:mysql://db01:3306/accounts?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull jdbc.username=admin jdbc.password=admin123 @@ -19,7 +19,39 @@ rabbitmq.username=test rabbitmq.password=test #Elasticesearch Configuration -elasticsearch.host =192.168.1.85 -elasticsearch.port =9300 +elasticsearch.host=localhost +elasticsearch.port=9300 elasticsearch.cluster=vprofile elasticsearch.node=vprofilenode + + +spring.servlet.multipart.max-file-size=128KB +spring.servlet.multipart.max-request-size=128KB + +logging.level.org.springframework.security=DEBUG + + +# application.properties +spring.security.user.name=admin_vp +spring.security.user.password=admin_vp +spring.security.user.roles=ADMIN + + +spring.mvc.view.prefix=/WEB-INF/views/ +spring.mvc.view.suffix=.jsp + +#logging.level.root=OFF +#logging.level.org.springframework.web=OFF +#spring.main.banner-mode=OFF + +# Hibernate SQL Queries +spring.jpa.show-sql=false +spring.jpa.properties.hibernate.format_sql=false +logging.level.org.hibernate.SQL=OFF +logging.level.org.hibernate.type=OFF + + +# Debug Logging for SecurityServiceImpl +logging.level.com.visualpathit.account.service.SecurityServiceImpl=OFF + + diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 35b81df4d..37959912a 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -1,24 +1,24 @@ - + - - - %date{HH:mm:ss.SSS} [%thread] %-5level %logger{15}#%line %msg\n - - + + + %date{HH:mm:ss.SSS} [%thread] %-5level %logger{15}#%line %msg%n + + - - - + + + + + + - - - + + + + + - - - - - - \ No newline at end of file + diff --git a/src/main/webapp/META-INF/MANIFEST.MF b/src/main/webapp/META-INF/MANIFEST.MF new file mode 100644 index 000000000..59499bce4 --- /dev/null +++ b/src/main/webapp/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/src/main/webapp/WEB-INF/appconfig-data.xml b/src/main/webapp/WEB-INF/appconfig-data.xml index 7be0032b5..18d9dbafd 100644 --- a/src/main/webapp/WEB-INF/appconfig-data.xml +++ b/src/main/webapp/WEB-INF/appconfig-data.xml @@ -1,54 +1,45 @@ - - - + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> - - - - - + + + + + - - + + - + - org.hibernate.dialect.MySQL5Dialect + org.hibernate.dialect.MySQLDialect true - - + + - - - - + + - - + + + diff --git a/src/main/webapp/WEB-INF/appconfig-mvc.xml b/src/main/webapp/WEB-INF/appconfig-mvc.xml index 58f404dc5..c8efd8bda 100644 --- a/src/main/webapp/WEB-INF/appconfig-mvc.xml +++ b/src/main/webapp/WEB-INF/appconfig-mvc.xml @@ -1,32 +1,32 @@ + xmlns:mvc="http://www.springframework.org/schema/mvc" + xmlns="http://www.springframework.org/schema/beans" + 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"> - + - - - - - - classpath:validation - - - - - - /WEB-INF/views/ - - - .jsp - - - - - + + + + + classpath:validation + + + + + + /WEB-INF/views/ + + + .jsp + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/appconfig-rabbitmq.xml b/src/main/webapp/WEB-INF/appconfig-rabbitmq.xml index 989faec37..2fadbead6 100644 --- a/src/main/webapp/WEB-INF/appconfig-rabbitmq.xml +++ b/src/main/webapp/WEB-INF/appconfig-rabbitmq.xml @@ -1,28 +1,30 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:beans="http://www.springframework.org/schema/beans" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:mvc="http://www.springframework.org/schema/mvc" + xmlns:rabbit="http://www.springframework.org/schema/rabbit" + xsi:schemaLocation="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 + http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd + http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit.xsd"> - + - + - + - + - - - - - + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/appconfig-root.xml b/src/main/webapp/WEB-INF/appconfig-root.xml index 064cc5e7a..aa7ae8728 100644 --- a/src/main/webapp/WEB-INF/appconfig-root.xml +++ b/src/main/webapp/WEB-INF/appconfig-root.xml @@ -1,20 +1,19 @@ - http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> + - + + + - - - - - - - - + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/appconfig-security.xml b/src/main/webapp/WEB-INF/appconfig-security.xml index 5e2acf137..797eff774 100644 --- a/src/main/webapp/WEB-INF/appconfig-security.xml +++ b/src/main/webapp/WEB-INF/appconfig-security.xml @@ -1,30 +1,31 @@ + xmlns:beans="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd"> - - - - - - - + + + + + + + - - - - - + + + + + - + - - - + + + diff --git a/src/main/webapp/WEB-INF/views/error/404.jsp b/src/main/webapp/WEB-INF/views/error/404.jsp new file mode 100644 index 000000000..a3cd4eddc --- /dev/null +++ b/src/main/webapp/WEB-INF/views/error/404.jsp @@ -0,0 +1,32 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + + + + User Not Found + + + + +

User Not Found

+

The user you are looking for does not exist. Please try again or go back to the login page.

+ + diff --git a/src/main/webapp/WEB-INF/views/error/500.jsp b/src/main/webapp/WEB-INF/views/error/500.jsp new file mode 100644 index 000000000..41874b50a --- /dev/null +++ b/src/main/webapp/WEB-INF/views/error/500.jsp @@ -0,0 +1,63 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + + User Not Found + + + + + + +
+
+ +
+

User Not Found

+

It seems we couldn't find your account. You can create a new account if you don't have one.

+
+ + diff --git a/src/main/webapp/WEB-INF/views/error/database-error.jsp b/src/main/webapp/WEB-INF/views/error/database-error.jsp new file mode 100644 index 000000000..a99b1418e --- /dev/null +++ b/src/main/webapp/WEB-INF/views/error/database-error.jsp @@ -0,0 +1,44 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + + Database Connection Error + + + + +
+

Database Connection Error

+

We are currently unable to connect to the database. Please check your database server and credentials.

+

If the problem persists, please contact support.

+

Back to Home

+
+ + diff --git a/src/main/webapp/WEB-INF/views/index_home.jsp b/src/main/webapp/WEB-INF/views/index_home.jsp index 4579f61fe..b0d981839 100644 --- a/src/main/webapp/WEB-INF/views/index_home.jsp +++ b/src/main/webapp/WEB-INF/views/index_home.jsp @@ -10,53 +10,41 @@ -
-
-
- Architecture -
-

DevOps

-
+ Architecture

Keep Learning ..

-

Learning is a Treasure that will follow it's Owner Everywhere..

+

Learning is a Treasure that will follow it's Owner Everywhere..

@@ -69,8 +57,8 @@
- DevOps -
+ DevOps +
@@ -97,7 +85,7 @@
- DevOps + DevOps
@@ -115,20 +103,32 @@

ABOUT

-
-

VisualPath is an IT Educational Institute.Established in 2001,and Institute offers world class quality of education and wide range of courses.VisualPath Institute has a dedicated placement team to help students get job placement in various IT job roles with major companies. -

-

Address: Flat no: 205, 2nd Floor,NILGIRI Block,Aditya Encalve,Ameerpet, Hyderabad-16

-

Ph No: +91-9704455959,9618245689

-

E-Mail ID : visualpath999@gmail.com

+
+

+ HKH Infotech is a dynamic software company dedicated to delivering innovative technology solutions. Founded with a mission to leverage cutting-edge technology and unparalleled expertise, we specialize in creating high-quality software solutions that drive business success. +

+

+ Our team is led by seasoned DevOps experts with many years of industry experience. They bring a wealth of knowledge in automating and optimizing the software development lifecycle, ensuring that our projects are efficient, reliable, and scalable. +

+

+ At HKH Infotech, we focus on understanding our clients' unique needs and providing tailored solutions that meet their objectives. Whether it's custom software development, system integration, or ongoing support, we are committed to excellence and client satisfaction. +

+

+ With a commitment to staying ahead of technological trends and a passion for innovation, HKH Infotech is your trusted partner in navigating the digital landscape and achieving your business goals. +

+

Address: Punjagutta Colony Ameerpet, Hyderabad

+

Phone: +91-8001234567

+

Email: contact@hkhinfotech.com

- +
+

CONTACT

+

Lets get in touch and talk about your and our next project.

-
+ @@ -137,16 +137,12 @@ SEND MESSAGE
+
- + -
- - diff --git a/src/main/webapp/WEB-INF/views/login.jsp b/src/main/webapp/WEB-INF/views/login.jsp index 0a41ac1c4..82480a75a 100644 --- a/src/main/webapp/WEB-INF/views/login.jsp +++ b/src/main/webapp/WEB-INF/views/login.jsp @@ -7,89 +7,159 @@ - - + Login + - - - + + + + + + + + + + + + + + + + + + + + + + + + + - LOGIN +
+
+
+
+ + Login + - - + + +
+ +
+
- - - - Welcome - - - - - +
+ Username + + +
+ +
+ Password + + +
- + -
-
- -
- - -

WELCOME!

- -
- ${message} - - - ${error} - - -

SIGN UP

+
+ + Don't have an account? + + + + Sign Up + +
+
+
+
- + + + + + + + + + + + + + + + + + + -
- - - diff --git a/src/main/webapp/WEB-INF/views/rabbitmq-error.jsp b/src/main/webapp/WEB-INF/views/rabbitmq-error.jsp new file mode 100644 index 000000000..b0d94014b --- /dev/null +++ b/src/main/webapp/WEB-INF/views/rabbitmq-error.jsp @@ -0,0 +1,28 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + + RabbitMQ Error + + + +

RabbitMQ Error

+

RabbitMQ server is off. Please start the RabbitMQ server and try again.

+ + diff --git a/src/main/webapp/WEB-INF/views/rabbitmq.jsp b/src/main/webapp/WEB-INF/views/rabbitmq.jsp index 2220694d4..70ece377f 100644 --- a/src/main/webapp/WEB-INF/views/rabbitmq.jsp +++ b/src/main/webapp/WEB-INF/views/rabbitmq.jsp @@ -1,14 +1,35 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> - - + + - -Rabbitmq + + RabbitMQ + -

Rabbitmq initiated

-

Generated 2 Connections

-

6 Chanels 1 Exchage and 2 Que

+ <% + int connections = (int) (Math.random() * 10) + 1; + int channels = (int) (Math.random() * 10) + 1; + int exchange = (int) (Math.random() * 10) + 1; + int queues = (int) (Math.random() * 10) + 1; + %> +

RabbitMQ Initiated

+

Generated <%= connections %> Connections

+

<%= channels %> Channels, <%= exchange %> Exchange, and <%= queues %> Queues

- \ No newline at end of file + diff --git a/src/main/webapp/WEB-INF/views/registration.jsp b/src/main/webapp/WEB-INF/views/registration.jsp index be726ccd9..37779c4d0 100644 --- a/src/main/webapp/WEB-INF/views/registration.jsp +++ b/src/main/webapp/WEB-INF/views/registration.jsp @@ -1,112 +1,139 @@ +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> - - + Sign Up + - - - + + + + + + + + + + + + + + + + - - - +
+
+
+ + Sign Up - -
-
- -
-
+ +
+ Username + + + +
-
+
- -
+ -
- - - + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/upload.jsp b/src/main/webapp/WEB-INF/views/upload.jsp index 3e52f833a..628f866a8 100644 --- a/src/main/webapp/WEB-INF/views/upload.jsp +++ b/src/main/webapp/WEB-INF/views/upload.jsp @@ -43,7 +43,7 @@
- +
diff --git a/src/main/webapp/WEB-INF/views/user.jsp b/src/main/webapp/WEB-INF/views/user.jsp index 480bf6e24..a16774482 100644 --- a/src/main/webapp/WEB-INF/views/user.jsp +++ b/src/main/webapp/WEB-INF/views/user.jsp @@ -1,163 +1,167 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> - <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - - +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + + UserData - + + - - - - - - + + + + + + - -
-
-