1 52 53 package com.go.teaservlet; 54 55 import java.io.IOException ; 56 import java.io.UnsupportedEncodingException ; 57 import java.util.Date ; 58 import java.util.List ; 59 import java.util.ArrayList ; 60 import java.util.Iterator ; 61 62 import javax.servlet.ServletException ; 63 import javax.servlet.http.Cookie ; 64 65 73 public interface HttpContext extends com.go.tea.runtime.UtilityContext { 74 75 79 public Request getRequest(); 80 81 88 public Request getRequest(String encoding); 89 90 96 public void setStatus(int code); 97 98 105 public void sendError(int code) 106 throws AbortTemplateException, IOException ; 107 108 116 public void sendError(int code, String message) 117 throws AbortTemplateException, IOException ; 118 119 126 public void sendRedirect(String url) 127 throws AbortTemplateException, IOException ; 128 129 136 public void setContentType(String type) 137 throws UnsupportedEncodingException , IOException ; 138 139 148 public void setHeader(String name, String value); 149 150 159 public void setHeader(String name, int value); 160 161 170 public void setHeader(String name, Date value); 171 172 178 public String encodeParameter(String str); 179 180 190 public boolean fileExists(String path) throws IOException ; 191 192 206 public void insertFile(String path) throws IOException ; 207 208 222 public String readFile(String path) throws IOException ; 223 224 239 public String readFile(String path, String encoding) throws IOException ; 240 241 250 public boolean URLExists(String URL) throws IOException ; 251 252 261 public void insertURL(String URL) throws IOException ; 262 263 271 public String readURL(String URL) throws IOException ; 272 273 282 public String readURL(String URL, String encoding) throws IOException ; 283 284 292 public void setURLTimeout(long timeout); 293 294 302 public interface Request { 303 304 309 public String getProtocol(); 310 311 315 public String getScheme(); 316 317 320 public String getServerName(); 321 322 325 public int getServerPort(); 326 327 331 public String getRemoteAddr(); 332 333 337 public String getRemoteHost(); 338 339 344 public String getAuthType(); 345 346 351 public String getMethod(); 352 353 369 public String getRequestURI(); 370 371 377 public String getContextPath(); 378 379 384 public String getServletPath(); 385 386 392 public String getPathInfo(); 393 394 399 public String getQueryString(); 400 401 402 408 public String getRemoteUser(); 409 410 418 public String getRequestedSessionId(); 419 420 423 public boolean isRequestedSessionIdValid(); 424 425 428 public Parameters getParameters(); 429 430 433 public Headers getHeaders(); 434 435 438 public Cookies getCookies(); 439 440 443 public Attributes getAttributes(); 444 } 445 446 453 public interface Parameters { 454 455 461 public ParameterValues get(String name); 462 463 467 public StringArrayList getNames(); 468 } 469 470 478 public interface ParameterValues extends List { 479 480 481 public static final Class ELEMENT_TYPE = Parameter.class; 482 483 486 public Integer getAsInteger(); 487 488 491 public String getAsString(); 492 493 public String toString(); 494 } 495 496 504 public interface Parameter { 505 506 509 public Integer getAsInteger(); 510 511 514 public String getAsString(); 515 516 public String toString(); 517 } 518 519 526 public interface Headers { 527 528 534 public Header get(String name); 535 536 540 public StringArrayList getNames(); 541 } 542 543 551 public interface Header { 552 553 556 public Integer getAsInteger(); 557 558 561 public String getAsString(); 562 563 566 public Date getAsDate(); 567 568 public String toString(); 569 } 570 571 578 public interface Cookies { 579 580 586 public Cookie get(String name); 587 588 592 public Cookie [] getAll(); 593 } 594 595 602 public interface Attributes { 603 604 609 public Object get(String name); 610 611 615 public StringArrayList getNames(); 616 } 617 618 625 public static class StringArrayList extends ArrayList { 626 627 628 public static final Class ELEMENT_TYPE = String .class; 629 630 StringArrayList() { 631 } 632 } 633 } 634
| Popular Tags
|