當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpOptions.abort方法代碼示例

本文整理匯總了Java中org.apache.http.client.methods.HttpOptions.abort方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpOptions.abort方法的具體用法?Java HttpOptions.abort怎麽用?Java HttpOptions.abort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.http.client.methods.HttpOptions的用法示例。


在下文中一共展示了HttpOptions.abort方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testDeny2Man

import org.apache.http.client.methods.HttpOptions; //導入方法依賴的package包/類
@Test
public void testDeny2Man() throws Exception {
   log.info("start testDeny2Man()");

   HttpGet method = new HttpGet(
         getBaseURL() + "/test/spring/loginSpring?USER=Fred&ROLE=adminXXX" + "&TENANT=" + TENANT);
   HttpResponse response = client.execute(method);
   method.abort();
   Thread.sleep(20);

   log.debug("now the test");
   HttpOptions g = new HttpOptions(URL_TS + "?role=" + URLEncoder.encode("adminXXXX", "UTF-8"));
   response = client.execute(g);
   Assert.assertEquals(HttpStatus.SC_FORBIDDEN, response.getStatusLine().getStatusCode());
   readResponseBody(response);
   g.abort();
}
 
開發者ID:Wolfgang-Winter,項目名稱:cibet,代碼行數:18,代碼來源:HttpSpringSecurity2IT.java

示例2: testDeny2Man2

import org.apache.http.client.methods.HttpOptions; //導入方法依賴的package包/類
@Test
public void testDeny2Man2() throws Exception {
   log.info("start testDeny2Man2()");
   HttpGet method = new HttpGet(
         getBaseURL() + "/test/spring/loginSpring?USER=Fred&secondUser=NULL&ROLE=admin" + "&TENANT=" + TENANT);
   HttpResponse response = client.execute(method);
   method.abort();

   Thread.sleep(20);
   log.debug("now the test");
   HttpOptions g = new HttpOptions(URL_TS + "?role=" + URLEncoder.encode("admin", "UTF-8") + "&secondUser="
         + URLEncoder.encode("NULL", "UTF-8"));
   response = client.execute(g);
   Assert.assertEquals(HttpStatus.SC_ACCEPTED, response.getStatusLine().getStatusCode());
   readResponseBody(response);
   g.abort();
}
 
開發者ID:Wolfgang-Winter,項目名稱:cibet,代碼行數:18,代碼來源:HttpSpringSecurity2IT.java

示例3: testDeny2Man3

import org.apache.http.client.methods.HttpOptions; //導入方法依賴的package包/類
@Test
public void testDeny2Man3() throws Exception {
   log.info("start testDeny2Man3()");
   HttpGet method = new HttpGet(getBaseURL()
         + "/test/spring/loginSpring?secondUser=hall&USER=Fred&secondRole=NULL&ROLE=admin" + "&TENANT=" + TENANT);
   HttpResponse response = client.execute(method);
   method.abort();
   Thread.sleep(20);

   log.debug("now the test");
   HttpOptions g = new HttpOptions(URL_TS + "?role=" + URLEncoder.encode("admin", "UTF-8") + "&secondUser="
         + URLEncoder.encode("hall", "UTF-8") + "&secondRole=" + URLEncoder.encode("NULL", "UTF-8"));
   response = client.execute(g);
   Assert.assertEquals(HttpStatus.SC_ACCEPTED, response.getStatusLine().getStatusCode());
   readResponseBody(response);
   String erString = response.getFirstHeader(Headers.CIBET_EVENTRESULT.name()).getValue();
   EventResult er = CibetUtil.decodeEventResult(erString);
   log.debug("#### EventResult: " + er);
   Assert.assertEquals(ExecutionStatus.POSTPONED, er.getExecutionStatus());
   Assert.assertEquals(ExecutionStatus.DENIED, er.getChildResults().get(0).getExecutionStatus());
   g.abort();
}
 
開發者ID:Wolfgang-Winter,項目名稱:cibet,代碼行數:23,代碼來源:HttpSpringSecurity2IT.java

示例4: testDeny2Man4

import org.apache.http.client.methods.HttpOptions; //導入方法依賴的package包/類
@Test
public void testDeny2Man4() throws Exception {
   log.info("start testDeny2Man4()");
   HttpGet method = new HttpGet(getBaseURL()
         + "/test/spring/loginSpring?secondUser=hil&secondRole=sssss&USER=Fred&ROLE=admin" + "&TENANT=" + TENANT);
   HttpResponse response = client.execute(method);
   method.abort();
   Thread.sleep(20);

   log.debug("now the test");
   HttpOptions g = new HttpOptions(URL_TS + "?role=" + URLEncoder.encode("admin", "UTF-8") + "&secondUser="
         + URLEncoder.encode("höl", "UTF-8") + "&secondRole=" + URLEncoder.encode("ssssssss", "UTF-8"));
   response = client.execute(g);
   Assert.assertEquals(HttpStatus.SC_ACCEPTED, response.getStatusLine().getStatusCode());
   readResponseBody(response);
   String erString = response.getFirstHeader(Headers.CIBET_EVENTRESULT.name()).getValue();
   EventResult er = CibetUtil.decodeEventResult(erString);
   Assert.assertEquals(ExecutionStatus.POSTPONED, er.getExecutionStatus());
   Assert.assertEquals(ExecutionStatus.DENIED, er.getChildResults().get(0).getExecutionStatus());

   g.abort();
}
 
開發者ID:Wolfgang-Winter,項目名稱:cibet,代碼行數:23,代碼來源:HttpSpringSecurity2IT.java

示例5: testGrant2Man

import org.apache.http.client.methods.HttpOptions; //導入方法依賴的package包/類
@Test
public void testGrant2Man() throws Exception {
   log.info("start testGrant2Man()");
   HttpGet method = new HttpGet(getBaseURL()
         + "/test/spring/loginSpring?USER=Fred&secondUser=hil&secondRole=second&ROLE=admin" + "&TENANT=" + TENANT);
   HttpResponse response = client.execute(method);
   method.abort();
   Thread.sleep(20);

   log.debug("now the test");
   HttpOptions g = new HttpOptions(URL_TS + "?role=" + URLEncoder.encode("admin", "UTF-8") + "&secondUser="
         + URLEncoder.encode("höl", "UTF-8") + "&secondRole=" + URLEncoder.encode("second", "UTF-8"));
   response = client.execute(g);
   Assert.assertEquals(HttpStatus.SC_ACCEPTED, response.getStatusLine().getStatusCode());
   readResponseBody(response);
   String erString = response.getFirstHeader(Headers.CIBET_EVENTRESULT.name()).getValue();
   EventResult er = CibetUtil.decodeEventResult(erString);
   Assert.assertEquals(ExecutionStatus.POSTPONED, er.getExecutionStatus());
   Assert.assertEquals(ExecutionStatus.EXECUTED, er.getChildResults().get(0).getExecutionStatus());

   g.abort();
}
 
開發者ID:Wolfgang-Winter,項目名稱:cibet,代碼行數:23,代碼來源:HttpSpringSecurity2IT.java

示例6: testEjbSecurity

import org.apache.http.client.methods.HttpOptions; //導入方法依賴的package包/類
@Ignore
@Test
public void testEjbSecurity() throws Exception {
   log.info("start testEjbSecurity()");
   HttpOptions getMethod = new HttpOptions(getBaseURL() + "/test/context?expVoter=1&parGutmann="
         + URLEncoder.encode("Ösal12345", "UTF-8") + "&role=" + URLEncoder.encode("admin", "UTF-8"));
   getMethod.addHeader("HTTP_X_FORWARDED_FOR", "192.68.2.1");

   HttpResponse response = client.execute(getMethod);
   Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
   getMethod.abort();
}
 
開發者ID:Wolfgang-Winter,項目名稱:cibet,代碼行數:13,代碼來源:HttpCibetFilter4IT.java

示例7: testGrantExpression

import org.apache.http.client.methods.HttpOptions; //導入方法依賴的package包/類
@Test
public void testGrantExpression() throws Exception {
   log.info("start testGrantExpression()");
   HttpGet method = new HttpGet(
         getBaseURL() + "/test/spring/loginSpring?USER=Hals&ROLE=admin" + "&TENANT=" + TENANT);
   HttpResponse response = client.execute(method);
   method.abort();

   log.debug("now the test");
   HttpOptions g = new HttpOptions(URL_TS + "?role=" + URLEncoder.encode("admin", "UTF-8"));
   response = client.execute(g);
   Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
   readResponseBody(response);
   g.abort();
}
 
開發者ID:Wolfgang-Winter,項目名稱:cibet,代碼行數:16,代碼來源:HttpSpringSecurityExpressionsIT.java


注:本文中的org.apache.http.client.methods.HttpOptions.abort方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。