Created
January 10, 2022 04:03
-
-
Save jvinceso/5e4e38b281f12ad0881e2dc6b22be3d6 to your computer and use it in GitHub Desktop.
Agregar cabeceras usando el contexto actual en respuestas mediante struts2
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
//Dependencias | |
import org.apache.struts2.StrutsStatics; | |
import javax.servlet.ServletResponse; | |
import javax.servlet.http.HttpServletResponse; | |
public String metodoprueba() throws Exception { | |
final String origen = "loginAccion.metodoprueba"; | |
HttpServletResponse httpResponse =ServletActionContext.getResponse(); | |
httpResponse.setHeader("Access-Control-Allow-Origin", "*"); | |
httpResponse.setHeader("Access-Control-Allow-Methods", "POST, GET, PUT, OPTIONS, DELETE"); | |
System.out.println("---CORS Configuration Completed---"); | |
long time; | |
String result = new String(); | |
result = "json"; | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment