20 tips to reach your goals! from JavaZone on Vimeo.
This blog is mainly about Java...
Thursday, September 10, 2015
20 tips to reach your goals!
Here is my talk on #JavaZone with the title "20 tips to reach your golas". Hope you benefit from it!
Labels:
javazone 2015
Tuesday, March 17, 2015
Get Location headers from response in AngularJS and Dropwizard
You have googled and found out that
But you always get undefined?
But in your developer tools you can see the Location in the header?
Perhaps you are using CORS (Cross Origin Resource Sharing)?
Enabling CORS only exposes a small number of the available headers by default and if you want more you have to expose them your self.
Use the ExposedHeaders
Note the highlighted line. That did the trick!
headers('Location')
is the method to use to get the location?But you always get undefined?
But in your developer tools you can see the Location in the header?
Perhaps you are using CORS (Cross Origin Resource Sharing)?
Enabling CORS only exposes a small number of the available headers by default and if you want more you have to expose them your self.
Use the ExposedHeaders
// Enable CORS headers
FilterRegistration.Dynamic cors = environment.servlets().addFilter("CORS", CrossOriginFilter.class);
// Configure CORS parameters
cors.setInitParameter(CrossOriginFilter.ALLOWED_ORIGINS_PARAM, "*");
cors.setInitParameter(CrossOriginFilter.ALLOWED_HEADERS_PARAM, "Content-Type,Authorization,X-Requested-With,Content-Length,Accept,Origin");
cors.setInitParameter(CrossOriginFilter.ALLOWED_METHODS_PARAM, "OPTIONS,GET,PUT,POST,DELETE,HEAD");
cors.setInitParameter(CrossOriginFilter.ALLOW_CREDENTIALS_PARAM, "true");
cors.setInitParameter(CrossOriginFilter.EXPOSED_HEADERS_PARAM, "Content-Type,Authorization,X-Requested-With,Content-Length,Accept,Origin,Location")
// Add URL mapping
cors.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
Note the highlighted line. That did the trick!
Labels:
AngularJS,
Dropwizard,
REST
Subscribe to:
Posts (Atom)
Labels
- Seam (14)
- Java (11)
- Hibernate (5)
- JPA (4)
- Seam 2 (4)
- Seam 2.1.1 (4)
- Seam Series (4)
- Devoxx (3)
- EJB3 (3)
- JavaOne (3)
- MySQL (3)
- PDF (3)
- jodconverter (3)
- jodconverter 3 (3)
- axis2 (2)
- hash password (2)
- pdfa (2)
- sigar (2)
- swing (2)
- testng (2)
- webservice (2)
- AngularJS (1)
- Cache (1)
- Comment (1)
- Dropwizard (1)
- Encryption (1)
- Enum (1)
- Freemarker (1)
- Guava (1)
- IE8 (1)
- IdentityManager (1)
- InnoDB (1)
- Iran (1)
- JOOReport (1)
- JSF (1)
- Jasypt (1)
- JavaPolis (1)
- Memory (1)
- MyISAM (1)
- ODT (1)
- OSS (1)
- OpenOffice (1)
- REST (1)
- Seam book (1)
- Tehran (1)
- UTF-8 (1)
- Ubuntu hardy (1)
- Windows vista (1)
- ant (1)
- chess (1)
- damenes tale (1)
- filters (1)
- firefox (1)
- html cache (1)
- interceptor (1)
- java 5 (1)
- java 6 (1)
- java 7 (1)
- javazone (1)
- javazone 2015 (1)
- jaxb (1)
- jboss (1)
- jboss 4 (1)
- jboss-ws (1)
- jdbc (1)
- jquery (1)
- jrebel (1)
- julebord (1)
- junit (1)
- musehÄnd (1)
- ojdbc (1)
- oracle (1)
- persistence.xml (1)
- prettify (1)
- ptql (1)
- richfaces (1)
- rollermouse pro (1)
- rpi (1)
- s:cache (1)
- seam-gen (1)
- second level cache (1)
- treecache (1)
- wicket (1)