1 20 package org.apache.cactus.internal; 21 22 import org.apache.cactus.WebRequest; 23 24 29 public class RequestDirectives 30 { 31 34 private WebRequest underlyingRequest; 35 36 40 public RequestDirectives(WebRequest theRequest) 41 { 42 this.underlyingRequest = theRequest; 43 } 44 45 48 public void setClassName(String theName) 49 { 50 addDirective(HttpServiceDefinition.CLASS_NAME_PARAM, theName); 51 } 52 53 56 public void setWrappedTestName(String theName) 57 { 58 addDirective(HttpServiceDefinition.WRAPPED_CLASS_NAME_PARAM, theName); 59 } 60 61 64 public void setMethodName(String theName) 65 { 66 addDirective(HttpServiceDefinition.METHOD_NAME_PARAM, theName); 67 } 68 69 72 public void setService(ServiceEnumeration theService) 73 { 74 addDirective(HttpServiceDefinition.SERVICE_NAME_PARAM, 75 theService.toString()); 76 } 77 78 83 public void setAutoSession(String isAutoSession) 84 { 85 addDirective(HttpServiceDefinition.AUTOSESSION_NAME_PARAM, 86 isAutoSession); 87 } 88 89 98 private void addDirective(String theName, String theValue) 99 throws IllegalArgumentException 100 { 101 if (!theName.startsWith(HttpServiceDefinition.COMMAND_PREFIX)) 102 { 103 throw new IllegalArgumentException ("Cactus directives must begin" 104 + " with [" + HttpServiceDefinition.COMMAND_PREFIX 105 + "]. The offending directive was [" + theName + "]"); 106 } 107 underlyingRequest.addParameter(theName, theValue, 108 WebRequest.GET_METHOD); 109 } 110 111 } 112 | Popular Tags |