-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Danial Farid
authored and
Danial Farid
committed
Jul 20, 2014
1 parent
70f49cf
commit e58a118
Showing
23 changed files
with
492 additions
and
398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.df.angularfileupload; | ||
|
||
import java.io.IOException; | ||
|
||
import javax.servlet.Filter; | ||
import javax.servlet.FilterChain; | ||
import javax.servlet.FilterConfig; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.ServletRequest; | ||
import javax.servlet.ServletResponse; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
public class CORSFilter implements Filter { | ||
|
||
@Override | ||
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, | ||
ServletException { | ||
HttpServletResponse httpResp = (HttpServletResponse) resp; | ||
HttpServletRequest httpReq = (HttpServletRequest) req; | ||
|
||
httpResp.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, OPTION"); | ||
httpResp.setHeader("Access-Control-Allow-Origin", "*"); | ||
if (httpReq.getMethod().equalsIgnoreCase("OPTIONS")) { | ||
httpResp.setHeader("Access-Control-Allow-Headers", | ||
((HttpServletRequest) req).getHeader("Access-Control-Request-Headers")); | ||
} | ||
chain.doFilter(req, resp); | ||
} | ||
|
||
@Override | ||
public void init(FilterConfig arg0) throws ServletException { | ||
} | ||
|
||
@Override | ||
public void destroy() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
<?xml version="1.0" ?> | ||
<cross-domain-policy> | ||
<allow-access-from domain="cdn.jsdelivr.net" /> | ||
<site-control permitted-cross-domain-policies="all" /> | ||
<allow-access-from domain="*" secure="false" /> | ||
<allow-access-from domain="angular-file-upload-cors.appspot.com" /> | ||
<allow-access-from domain="angular-file-upload-cors-srv.appspot.com" /> | ||
<allow-http-request-headers-from domain="*" headers="*" secure="false" /> | ||
</cross-domain-policy> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.