Search Posts

Category: spring-boot

Convert ByteArray into Image in AngularJs

I have written a controller in spring boot for getting image of particular user and i am returning it in form of byte array @GetMapping(value = “/images/{id}/{login}”,produces = {MediaType.APPLICATION_OCTET_STREAM_VALUE}) public byte[] getImage(@Valid @RequestParam(“id”) String id,@RequestParam(“login”) String login) throws IOException, XmlPullParserException, NoSuchAlgorithmException, InvalidKeyException, InvalidArgumentException, ErrorResponseException, NoResponseException, InvalidBucketNameException, InsufficientDataException, InternalException { return IOUtils.toByteArray(fileService.getImage(id, login)); } Is there a method in angularjs so that i could convert it in form of image So that i could display the […]

Jhispter : angular prints null entity while retrieving objects after 1

angular .module(‘smartLpcApp’) .controller(‘CaptionsDetailController’, CaptionsDetailController); CaptionsDetailController.$inject = [‘$scope’, ‘$rootScope’, ‘$stateParams’, ‘entity’, ‘Captions’, ‘Projects’]; function CaptionsDetailController($scope, $rootScope, $stateParams, entity, Captions, Projects) { var vm = this; vm.captions = entity; console.log(“Printing entity : “+JSON.stringify(entity)); vm.load = function (id) { Captions.get({id: id}, function(result) { vm.captions = result; }); }; var unsubscribe = $rootScope.$on(‘smartLpcApp:captionsUpdate’, function(event, result) { vm.captions = result; }); $scope.$on(‘$destroy’, unsubscribe); } I am using Jhipster 1.8.5 and angular 1.5.2. This controller gets entity and displays it.While retrieving […]

Attaching attribute to RequestContext – pass element from frontend to backend

I have written frontend in angularjs and backend in spring-boot. I need to pass some attribute from backend to frontend. This attribute is some configuration set from frontend should be passed with each request to backend. When it comes to authorization we are using LDAP. The whole aim is to be able to do: String myConf = RequestContextHolder.getRequestAttributes().getAttribute( “myConf”, RequestAttributes.SCOPE_REQUEST); I have no idea how to do it. Can you help me, please? Source: AngularJS

I am trying to fetch details of patient from a url containing json data using get method of angular js2

My classes are: ****Patient Service class.ts**** @Injectable() export class PatientService{ url=”http://localhost:8080/rest/patientC”; constructor(private http:Http){} getPatientWithObservale():Observable<patient[]>{ return this.http.get(this.url) .map(this.extractdata) .catch(this.handleErrorObservable); } private extractdata(res:Response){ let body=res.json(); console.log(body.data); return body.data || {}; } } **Observable Component class.ts** export class ObservableComponent implements OnInit{ patients:patient[]; errorMessage: string; patientName: string; patient=new patient(); constructor(private patientService: PatientService){} ngOnInit(){ this.fetchPatient(); } fetchPatient():void{ this.patientService.getPatientWithObservale() .subscribe(patients=>this.patients = patients, error=>this.errorMessage=error); } } **Observable component.html** <h3>Patient Details with Observable </h3> <table> <tr> <th>Id</th> <th>First Name</th> <th>Last Name</th> <th>Age</th> <th>Gender</th> […]