br.com.caelum.vraptor.Options Java Examples

The following examples show how to use br.com.caelum.vraptor.Options. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CORSController.java    From aprendendo-vraptor with Apache License 2.0 5 votes vote down vote up
@Options
@Path(value = "/*")
public void options(@Observes VRaptorRequestStarted requestInfo) {
		
	Set<HttpMethod> allowed = router.allowedMethodsFor(requestInfo.getRequest().getRequestedUri());
	String allowMethods = allowed.toString().replaceAll("\\[|\\]", "");
	
	result.use(Results.status()).header("Allow", allowMethods);
	result.use(Results.status()).header("Access-Control-Allow-Methods", allowMethods);
	result.use(Results.status()).header("Access-Control-Allow-Headers", "Content-Type, X-Requested-With, accept, Authorization, origin");
}
 
Example #2
Source File: CORSController.java    From mamute with Apache License 2.0 5 votes vote down vote up
@Options("/*")
public void options() {
	Set<HttpMethod> allowed = router.allowedMethodsFor(request.getRequestedUri());
	String allowMethods = allowed.toString().replaceAll("\\[|\\]", "");

	result.use(status()).header("Allow", allowMethods);
	result.use(status()).header("Access-Control-Allow-Methods", allowMethods);
	result.use(status()).header("Access-Control-Allow-Headers", "Content-Type, X-Requested-With, accept, Authorization, origin");
	result.use(status()).noContent();
}
 
Example #3
Source File: CORSController.java    From aprendendo-vraptor with Apache License 2.0 5 votes vote down vote up
@Options
@Path(value = "/*")
public void options(@Observes VRaptorRequestStarted requestInfo) {
		
	Set<HttpMethod> allowed = router.allowedMethodsFor(requestInfo.getRequest().getRequestedUri());
	String allowMethods = allowed.toString().replaceAll("\\[|\\]", "");
	
	result.use(Results.status()).header("Allow", allowMethods);
	result.use(Results.status()).header("Access-Control-Allow-Methods", allowMethods);
	result.use(Results.status()).header("Access-Control-Allow-Headers", "Content-Type, X-Requested-With, accept, Authorization, origin");
}
 
Example #4
Source File: PathAnnotationRoutesParser.java    From vraptor4 with Apache License 2.0 4 votes vote down vote up
private Predicate<Annotation> instanceOfMethodAnnotation() {
	return or(instanceOf(Get.class), instanceOf(Post.class), instanceOf(Put.class), instanceOf(Delete.class), instanceOf(Options.class), instanceOf(Patch.class));
}
 
Example #5
Source File: PathAnnotationRoutesParserTest.java    From vraptor4 with Apache License 2.0 4 votes vote down vote up
@Options("/clients/options")
public void options() {
}