I'm trying to download a file from a specific directory everything works fine in the back-end when I test the service, but when I try it from the front-end I get this error and the pop/up save doesn't show.
Here's my back-end code with spring boot :
enter image description here
and my front with angular 5 looks like this
enter image description here
the service :
enter image description here
After your
respHeaders.setContentType(MediaType.APPLICATION_PDF);
Try adding this:
respHeaders.add("Content-Disposition", "attachment; filename=\"file.pdf\"");
Related
Hi i try connect my page in netlify with a service external but i dont now how configurate _redirects I put this:
/api/* http://www.webservice.com/:splat 200
And my app get webservice and put these url https://myapp.netlify.app/api/products
i want that put http://www.webservice.com/api/products
my _redirects is in public folder , my app is developer in react-hooks with webpack
plese someone cant help me,
Put the following in your netlify.toml file:
[[redirects]]
from = "/api/*"
to = "http://www.webservice.com/api/:splat"
status = 200
Then browse to https://myapp.netlify.app/api/products and it'll show you the page at http://www.webservice.com/api/products.
I have written code for uploading file in spring boot , when I test it , I get status 200 ok , but the file is not getting uploaded . Can some one help me on this . Below is the code , I can see the sysout from the method in controller is being printed but after that the length is being printed as zero. I would further like to add that the uploadFile method is working i.e., the method which takes single file works as expected , but the method which is written to upload multiple files is not working as expected and I see the length of list of Multipart file is being printed as zero .
Java Code:
postman test :
enter image description here
postman console :
enter image description here
postman console 2 :
enter image description here
filestogeservice storefile method
How can i display image form database ? in react ? i am using laravel as backend .this is my table with image
i am using {this.props.obj.image} and this is showing the file as shown below
as you can see it is showing the file it is not displying image .searched web but it says to import path but all the tutorial are importing statically
my image location is Assets/Admin/Image .
How can i resolve this
When you run a laravel project, you are already in the public folder so you don't have to specify the public folder in the path and "assets" is just a laravel-defined method for accessing the contents of the "public" directory so you shouldn't specify that in the path too.
So you should do something like this:
<img src="http://localhost:<your_port>/images/{this.props.obj.image}" alt="hello image" height="200" />
You are storing just the name of the file in the database, to load the image you need to complete the full path of the image.
If you are storing your files in:
{laravel_root_folder}/public/assets/images/
Then you should do something like this (btw I know nothing about react but this should kinda work). I'm asuming you are running your server in localhost in the 8000 port:
<img src="http://localhost:8000/assets/images/{this.props.obj.image}" alt="hello image" height="200"/>
You can not have directly access to public/storage/images from react (front end side ) for that you have to use following method to generate the URL of image and then just return that url to react side while requesting and use that url in < img src={url} /> to display the picture
https://laravel.com/docs/5.4/filesystem#file-urls
I followed Angular 2's Tour of Hero tutorial with in memory database. Then I created a Spring backend to supply data and want to integrate Angular2 with Spring's Rest API.
In Tour of Hero I only changed one line of code in hero.service.ts:
/* private heroesUrl = 'app/heroes'; */
private heroesUrl = 'http://localhost:8080/api/hero/all';
The link I changed to is the the Spring service endpoint, if I type the link in browser, it returns JSON data: [{"id":1,"name":"test"}].
However, I am getting error in Tour of Hero:
EXCEPTION: Uncaught (in promise): Response with status: 404 Not Found for URL: null
It looks like the spring endpoint of localhost:8080 is not found by Angular application running on localhost:3000. What could be the issue?
This was asked a while ago, but probably someone finds it useful.
Delete the following dependency from your package.json:
"angular-in-memory-web-api": "~0.2.4",
Remove it from node_modules directory, delete all InMemoryWebApiModule and InMemoryWebApiModule and InMemoryDataService-related code.
I use JOSSO 1.8.6. I configure all in the Tomcat lib directory file related to JOSSO, and I'm also doing all configuration in web application[spring] WEB-INF file. I got the below URL.
http://localhost:8080/TestLogin/?josso_cmd=login_optional
&josso_back_to=http://localhost:8080/TestLoginDemo/josso_security_check
&josso_partnerapp_id=TestLoginDemo
But my question is:
My parent web application is --TestLogin means this application login page is main to display all the other web application [child web application].
I have 3 child application
TestLoginDemo
jossoLogin1
JossoLoginDemo
All are spring application.
I hit in browser mean URL is http://localhost:8080/TestLoginDemo
So the below URL I see
http://localhost:8080/TestLogin/?josso_cmd=login_optional
&josso_back_to=http://localhost:8080/TestLoginDemo/josso_security_check
&josso_partnerapp_id=TestLoginDemo
But after the successful login I find the TestLogin flow means not transfer to the TestLoginDemo.
So what is the way if I have to carry on flow for TestLoginDemo?
And; after success this URL:
http://localhost:8080/TestLogin/?josso_cmd=login_optional
&josso_back_to=http://localhost:8080/TestLoginDemo/josso_security_check
&josso_partnerapp_id=TestLoginDemo
login page I got below URL in success:
http://localhost:8080/TestLogin/login.htm
instead of the below correct URL:
http://localhost:8080/TestLoginDemo/login.htm
Could anybody guide me on how to achieve this?
Why josso_cmd=login_optional, did you set it up like this ? By default this is unecessary to specify the josso_cmd argument.
In order to get back to the original application, you have to use josso_partnerapp_ctx argument (don't forget to encode URL), this will be passed to the security check page that will lead you to this page if the security check is sucessfull
Usually, URL looks like this:
https://login.domain.com/josso/signon/login.do?josso_back_to=https://site.domain.com/Josso/Check&josso_partnerapp_host=site.domain.com&josso_partnerapp_ctx=https%3a%2f%2site.domain.com%2fhome.html