Tag Archives: rest

REST service project structure

Questions: I was working on a project with a colleague and he told me that I should create 3 levels when creating a rest service. Can anyone explain me if this is the ‘normal’ and if I use it in the correct way? He never explained me why and left the firm a few weeks… Read More »

Spring, JPA and Rest and Duplicate entry for key 'PRIMARY'

Questions: I’m just starting to learn Spring and JPA and I’ve run into a bit of a wall trying to figure out what is causing my app to try and insert cascaded values in multiple times. I have the following structure: pom.xml <?xml version=”1.0″ encoding=”UTF-8″?> <project xmlns=”http://maven.apache.org/POM/4.0.0″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”> <modelVersion>4.0.0</modelVersion> <groupId>com.test</groupId> <artifactId>core</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging>… Read More »

Handling post request using Unirest Library (PHP)

Questions: I am presently working with the unirest php library, i initiated a post request from http://localhost/path/post to a certain url, let’s say http://localhost/path/handler, how do i get the post array sent from http://localhost/path/post on http://localhost/path/handler, i tried using the $_POST[] superglobal array, it is returning NULL ? Answers:

keep playing andorid media player when app killed and restart service

Questions: My program is a music player and my Android Media Player runs on the service. The problem here is that when killed my app, the service is restarted and my player starts to work from the beginning. public class AudioPlayerService extends Service implementsMediaPlayer.OnPreparedListener { private String url = “https://www.dev2qa.com/demo/media/test.mp3”; private MediaPlayer mediaPlayer = null;… Read More »

Postman 404 spring rest api

Questions: This is my application configuration spring.data.mongodb.host=192.168.56.1 spring.data.mongodb.port=27017 spring.data.mongodb.database=test server.port=8080 spring.application.name=test server.servlet.context-path=/test This is my controller code: package com.example.crud; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.config.annotation.EnableWebMvc; @RestController @RequestMapping(“/crud”) public class CrudOperation { @GetMapping(“/getAll”) public String getMethod() { return “Get Datas success”; } @PostMapping(“/save”) public… Read More »