001package org.apache.turbine.util; 002 003 004/* 005 * Licensed to the Apache Software Foundation (ASF) under one 006 * or more contributor license agreements. See the NOTICE file 007 * distributed with this work for additional information 008 * regarding copyright ownership. The ASF licenses this file 009 * to you under the Apache License, Version 2.0 (the 010 * "License"); you may not use this file except in compliance 011 * with the License. You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, 016 * software distributed under the License is distributed on an 017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 018 * KIND, either express or implied. See the License for the 019 * specific language governing permissions and limitations 020 * under the License. 021 */ 022 023 024import java.io.BufferedInputStream; 025import java.io.File; 026import java.io.FileInputStream; 027import java.io.FileNotFoundException; 028import java.io.InputStream; 029import java.net.MalformedURLException; 030import java.net.URL; 031import java.util.Enumeration; 032import java.util.EventListener; 033import java.util.HashMap; 034import java.util.Map; 035import java.util.Set; 036import java.util.Vector; 037 038import javax.servlet.Filter; 039import javax.servlet.FilterRegistration; 040import javax.servlet.RequestDispatcher; 041import javax.servlet.Servlet; 042import javax.servlet.ServletConfig; 043import javax.servlet.ServletContext; 044import javax.servlet.ServletException; 045import javax.servlet.ServletRegistration; 046import javax.servlet.ServletRegistration.Dynamic; 047import javax.servlet.SessionCookieConfig; 048import javax.servlet.SessionTrackingMode; 049import javax.servlet.descriptor.JspConfigDescriptor; 050 051import org.apache.avalon.framework.activity.Disposable; 052import org.apache.avalon.framework.activity.Initializable; 053import org.apache.logging.log4j.LogManager; 054import org.apache.logging.log4j.Logger; 055import org.apache.turbine.Turbine; 056import org.apache.turbine.TurbineConstants; 057import org.apache.turbine.annotation.TurbineConfiguration; 058 059/** 060 * A class used for initialization of Turbine without a servlet container. 061 * <p> 062 * If you need to use Turbine outside of a servlet container, you can 063 * use this class for initialization of the Turbine servlet. 064 * </p> 065 * 066 * <pre> 067 * TurbineConfig config = new TurbineConfig(".", "conf/TurbineResources.properties"); 068 * </pre> 069 * 070 * <p> 071 * All paths referenced in TurbineResources.properties and the path to 072 * the properties file itself (the second argument) will be resolved 073 * relative to the directory given as the first argument of the constructor, 074 * here - the directory where application was started. Don't worry about 075 * discarding the references to objects created above. They are not needed, 076 * once everything is initialized. 077 * </p> 078 * 079 * <p> 080 * In order to initialize the Services Framework outside of the Turbine Servlet, 081 * you need to call the <code>init()</code> method. By default, this will 082 * initialize the Resource and Logging Services and any other services you 083 * have defined in your TurbineResources.properties file. 084 * </p> 085 * 086 * TODO Make this class enforce the lifecycle contracts 087 * 088 * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a> 089 * @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a> 090 * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a> 091 * @author <a href="mailto:dlr@collab.net">Daniel Rall</a> 092 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a> 093 * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a> 094 * @version $Id: TurbineConfig.java 1854688 2019-03-03 10:36:42Z tv $ 095 */ 096public class TurbineConfig 097 implements ServletConfig, ServletContext, Initializable, Disposable 098{ 099 100 @TurbineConfiguration( TurbineConstants.SESSION_TIMEOUT_KEY ) 101 protected int timeout = TurbineConstants.SESSION_TIMEOUT_DEFAULT; 102 103 /** 104 * Servlet initialization parameter name for the path to 105 * TurbineConfiguration.xml file used by Turbine 106 */ 107 public static final String CONFIGURATION_PATH_KEY = "configuration"; 108 109 /** 110 * Servlet initialization parameter name for the path to 111 * Turbine.properties file used by Turbine 112 */ 113 public static final String PROPERTIES_PATH_KEY = "properties"; 114 115 /** 116 * Default value of TurbineResources.properties file path 117 * (<code>/WEB-INF/conf/TurbineResources.properties</code>). 118 */ 119 public static final String PROPERTIES_PATH_DEFAULT = 120 "/WEB-INF/conf/TurbineResources.properties"; 121 122 /** Filenames are looked up in this directory. */ 123 protected File root; 124 125 /** Servlet container (or emulator) attributes. */ 126 protected Map<String, Object> attributes; 127 128 /** Turbine servlet initialization parameters. */ 129 protected Map<String, String> initParams; 130 131 /** The Turbine servlet instance used for initialization. */ 132 private Turbine turbine; 133 134 /** Logging */ 135 private final Logger log = LogManager.getLogger(this.getClass()); 136 137 /** 138 * Constructs a new TurbineConfig. 139 * 140 * This is the general form of the constructor. You can provide 141 * a path to search for files, and a name-value map of init 142 * parameters. 143 * 144 * <p> For the list of recognized init parameters, see 145 * {@link org.apache.turbine.Turbine} class. 146 * 147 * @param path The web application root (i.e. the path for file lookup). 148 * @param attributes Servlet container (or emulator) attributes. 149 * @param initParams initialization parameters. 150 */ 151 public TurbineConfig(String path, Map<String, Object> attributes, 152 Map<String, String> initParams) 153 { 154 root = new File(path); 155 this.attributes = attributes; 156 this.initParams = initParams; 157 } 158 159 /** 160 * Constructs a new TurbineConfig. 161 * 162 * This is the general form of the constructor. You can provide 163 * a path to search for files, and a name-value map of init 164 * parameters. 165 * 166 * <p> For the list of recognized init parameters, see 167 * {@link org.apache.turbine.Turbine} class. 168 * 169 * @param path The web application root (i.e. the path for file lookup). 170 * @param initParams initialization parameters. 171 */ 172 public TurbineConfig(String path, Map<String, String> initParams) 173 { 174 this(path, new HashMap<String, Object>(0), initParams); 175 } 176 177 /** 178 * Constructs a TurbineConfig. 179 * 180 * This is a specialized constructor that allows to configure 181 * Turbine easily in the common setups. 182 * 183 * @param path The web application root (i.e. the path for file lookup). 184 * @param properties the relative path to TurbineResources.properties file 185 */ 186 public TurbineConfig(String path, String properties) 187 { 188 this(path, new HashMap<String, String>(1)); 189 initParams.put(PROPERTIES_PATH_KEY, properties); 190 } 191 192 /** 193 * Causes this class to initialize itself which in turn initializes 194 * all of the Turbine Services that need to be initialized. 195 */ 196 @Override 197 public void initialize() 198 { 199 try 200 { 201 turbine = new Turbine(); 202 turbine.init(this); 203 } 204 catch (Exception e) 205 { 206 log.error("TurbineConfig: Initialization failed", e); 207 } 208 } 209 210 /** 211 * Initialization requiring a HTTP <code>GET</code> request. 212 * @param data the Turbine request 213 */ 214 public void init(RunData data) 215 { 216 if (turbine != null) 217 { 218 turbine.init(data); 219 } 220 } 221 222 /** 223 * Shutdown the Turbine System, lifecycle style 224 * 225 */ 226 @Override 227 public void dispose() 228 { 229 if (turbine != null) 230 { 231 turbine.destroy(); 232 } 233 } 234 235 /** 236 * Returns a reference to the Turbine servlet that was initialized. 237 * 238 * @return a ServletContext reference 239 */ 240 public Turbine getTurbine() 241 { 242 return turbine; 243 } 244 245 /** 246 * Returns a reference to the object cast onto ServletContext type. 247 * 248 * @return a ServletContext reference 249 */ 250 @Override 251 public ServletContext getServletContext() 252 { 253 return this; 254 } 255 256 /** 257 * Translates a path relative to the web application root into an 258 * absolute path. 259 * 260 * @param path A path relative to the web application root. 261 * @return An absolute version of the supplied path, or <code>null</code> 262 * if the translated path doesn't map to a file or directory. 263 */ 264 @Override 265 public String getRealPath(String path) 266 { 267 String result = null; 268 File f = new File(root, path); 269 270 if (log.isDebugEnabled()) 271 { 272 log.debug("TurbineConfig.getRealPath: path '{}' translated to '{}' {}found", 273 path, f.getPath(), f.exists() ? "" : "not "); 274 } 275 276 if (f.exists()) 277 { 278 result = f.getPath(); 279 } 280 else 281 { 282 log.error("getRealPath(\"{}\") is undefined, returning null", path); 283 } 284 285 return result; 286 } 287 288 /** 289 * Retrieves an initialization parameter. 290 * 291 * @param name the name of the parameter. 292 * @return the value of the parameter. 293 */ 294 @Override 295 public String getInitParameter(String name) 296 { 297 return initParams.get(name); 298 } 299 300 /** 301 * Retrieves an Enumeration of initialization parameter names. 302 * 303 * @return an Enumeration of initialization parameter names. 304 */ 305 @Override 306 public Enumeration<String> getInitParameterNames() 307 { 308 return new Vector<String>(initParams.keySet()).elements(); 309 } 310 311 /** 312 * Returns the servlet name. 313 * 314 * Fixed value "Turbine" is returned. 315 * 316 * @return the servlet name. 317 */ 318 @Override 319 public String getServletName() 320 { 321 return "Turbine"; 322 } 323 324 /** 325 * Returns the context name. 326 * 327 * Fixed value "Turbine" is returned 328 * 329 * @return the context name 330 */ 331 @Override 332 public String getServletContextName() 333 { 334 return "Turbine"; 335 } 336 337 /** 338 * Returns the context path. 339 * 340 * Fixed value "/turbine" is returned 341 * 342 * @return the context path 343 */ 344 @Override 345 public String getContextPath() 346 { 347 return "/turbine"; 348 } 349 350 /** 351 * Returns a URL to the resource that is mapped to a specified 352 * path. The path must begin with a "/" and is interpreted 353 * as relative to the current context root. 354 * 355 * @param s the path to the resource 356 * @return a URL pointing to the resource 357 * @throws MalformedURLException if unable to parse path 358 */ 359 @Override 360 public URL getResource(String s) 361 throws MalformedURLException 362 { 363 return new URL("file://" + getRealPath(s)); 364 } 365 366 /** 367 * Returns the resource located at the named path as 368 * an <code>InputStream</code> object. 369 * 370 * @param s the path to the resource 371 * @return an InputStream object from which the resource can be read 372 */ 373 @Override 374 public InputStream getResourceAsStream(String s) 375 { 376 try 377 { 378 FileInputStream fis = new FileInputStream(getRealPath(s)); 379 return new BufferedInputStream(fis); 380 } 381 catch (FileNotFoundException e) 382 { 383 return null; 384 } 385 } 386 387 /** 388 * Logs an error message. 389 * 390 * @param e an Exception. 391 * @param m a message. 392 * @deprecated use log(String,Throwable) instead 393 */ 394 @Override 395 @Deprecated 396 public void log(Exception e, String m) 397 { 398 log.info(m, e); 399 } 400 401 /** 402 * Logs a message. 403 * 404 * @param m a message. 405 */ 406 @Override 407 public void log(String m) 408 { 409 log.info(m); 410 } 411 412 /** 413 * Logs an error message. 414 * 415 * @param t a Throwable object. 416 * @param m a message. 417 */ 418 @Override 419 public void log(String m, Throwable t) 420 { 421 log.info(m, t); 422 } 423 424 /** 425 * Returns the servlet container attribute with the given name, or 426 * null if there is no attribute by that name. 427 */ 428 @Override 429 public Object getAttribute(String s) 430 { 431 return attributes.get(s); 432 } 433 434 /** 435 * Returns an Enumeration containing the attribute names available 436 * within this servlet context. 437 */ 438 @Override 439 public Enumeration<String> getAttributeNames() 440 { 441 return new Vector<String>(attributes.keySet()).elements(); 442 } 443 444 // Unimplemented methods follow 445 446 /** 447 * Not implemented. 448 * 449 * A method in ServletConfig or ServletContext interface that is not 450 * implemented and will throw <code>UnsuportedOperationException</code> 451 * upon invocation 452 */ 453 @Override 454 public ServletContext getContext(String s) 455 { 456 throw new UnsupportedOperationException(); 457 } 458 459 /** 460 * Not implemented. 461 * 462 * A method in ServletConfig or ServletContext interface that is not 463 * implemented and will throw <code>UnsuportedOperationException</code> 464 * upon invocation 465 */ 466 @Override 467 public int getMajorVersion() 468 { 469 throw new UnsupportedOperationException(); 470 } 471 472 /** 473 * Not implemented. 474 * 475 * A method in ServletConfig or ServletContext interface that is not 476 * implemented and will throw <code>UnsuportedOperationException</code> 477 * upon invocation 478 */ 479 @Override 480 public String getMimeType(String s) 481 { 482 throw new UnsupportedOperationException(); 483 } 484 485 /** 486 * Not implemented. 487 * 488 * A method in ServletConfig or ServletContext interface that is not 489 * implemented and will throw <code>UnsuportedOperationException</code> 490 * upon invocation 491 */ 492 @Override 493 public int getMinorVersion() 494 { 495 throw new UnsupportedOperationException(); 496 } 497 498 /** 499 * Not implemented. 500 * 501 * A method in ServletConfig or ServletContext interface that is not 502 * implemented and will throw <code>UnsuportedOperationException</code> 503 * upon invocation 504 */ 505 @Override 506 public RequestDispatcher getNamedDispatcher(String s) 507 { 508 throw new UnsupportedOperationException(); 509 } 510 511 /** 512 * Not implemented. 513 * 514 * A method in ServletConfig or ServletContext interface that is not 515 * implemented and will throw <code>UnsuportedOperationException</code> 516 * upon invocation 517 */ 518 @Override 519 public RequestDispatcher getRequestDispatcher(String s) 520 { 521 throw new UnsupportedOperationException(); 522 } 523 524 /** 525 * Not implemented. 526 * 527 * A method in ServletContext (2.3) interface that is not implemented and 528 * will throw <code>UnsuportedOperationException</code> upon invocation 529 */ 530 @Override 531 public Set<String> getResourcePaths(String s) 532 { 533 throw new UnsupportedOperationException(); 534 } 535 536 /** 537 * Not implemented. 538 * 539 * A method in ServletContext (2.3) interface that is not implemented and 540 * will throw <code>UnsuportedOperationException</code> upon invocation 541 */ 542 @Override 543 public String getServerInfo() 544 { 545 throw new UnsupportedOperationException(); 546 } 547 548 /** 549 * Not implemented. 550 * 551 * A method in ServletContext interface that is not implemented and will 552 * throw <code>UnsuportedOperationException</code> upon invocation 553 * @deprecated As of Java Servlet API 2.1, with no direct replacement. 554 */ 555 @Override 556 @Deprecated 557 public Servlet getServlet(String s) 558 { 559 throw new UnsupportedOperationException(); 560 } 561 562 /** 563 * Not implemented. 564 * 565 * A method in ServletContext interface that is not implemented and will 566 * throw <code>UnsuportedOperationException</code> upon invocation 567 * @deprecated As of Java Servlet API 2.1, with no replacement. 568 */ 569 @Override 570 @Deprecated 571 public Enumeration<String> getServletNames() 572 { 573 throw new UnsupportedOperationException(); 574 } 575 576 /** 577 * Not implemented. 578 * 579 * A method in ServletContext interface that is not implemented and will 580 * throw <code>UnsuportedOperationException</code> upon invocation 581 * @deprecated As of Java Servlet API 2.0, with no replacement. 582 */ 583 @Override 584 @Deprecated 585 public Enumeration<Servlet> getServlets() 586 { 587 throw new UnsupportedOperationException(); 588 } 589 590 /** 591 * Not implemented. 592 * 593 * A method in ServletContext interface that is not implemented and will 594 * throw <code>UnsuportedOperationException</code> upon invocation 595 */ 596 @Override 597 public void removeAttribute(String s) 598 { 599 throw new UnsupportedOperationException(); 600 } 601 602 /** 603 * Not implemented. 604 * 605 * A method in ServletContext interface that is not implemented and will 606 * throw <code>UnsuportedOperationException</code> upon invocation 607 */ 608 @Override 609 public void setAttribute(String s, Object o) 610 { 611 throw new UnsupportedOperationException(); 612 } 613 614 /** 615 * Not implemented. 616 * 617 * A method in ServletContext interface that is not implemented and will 618 * throw <code>UnsuportedOperationException</code> upon invocation 619 */ 620 @Override 621 public int getEffectiveMajorVersion() 622 { 623 throw new UnsupportedOperationException(); 624 } 625 626 /** 627 * Not implemented. 628 * 629 * A method in ServletContext interface that is not implemented and will 630 * throw <code>UnsuportedOperationException</code> upon invocation 631 */ 632 @Override 633 public int getEffectiveMinorVersion() 634 { 635 throw new UnsupportedOperationException(); 636 } 637 638 /** 639 * Not implemented. 640 * 641 * A method in ServletContext interface that is not implemented and will 642 * throw <code>UnsuportedOperationException</code> upon invocation 643 */ 644 @Override 645 public boolean setInitParameter(String name, String value) 646 { 647 throw new UnsupportedOperationException(); 648 } 649 650 /** 651 * Not implemented. 652 * 653 * A method in ServletContext interface that is not implemented and will 654 * throw <code>UnsuportedOperationException</code> upon invocation 655 */ 656 @Override 657 public Dynamic addServlet(String servletName, String className) 658 { 659 throw new UnsupportedOperationException(); 660 } 661 662 /** 663 * Not implemented. 664 * 665 * A method in ServletContext interface that is not implemented and will 666 * throw <code>UnsuportedOperationException</code> upon invocation 667 */ 668 @Override 669 public Dynamic addServlet(String servletName, Servlet servlet) 670 { 671 throw new UnsupportedOperationException(); 672 } 673 674 /** 675 * Not implemented. 676 * 677 * A method in ServletContext interface that is not implemented and will 678 * throw <code>UnsuportedOperationException</code> upon invocation 679 */ 680 @Override 681 public Dynamic addServlet(String servletName, Class<? extends Servlet> servletClass) 682 { 683 throw new UnsupportedOperationException(); 684 } 685 686 /** 687 * Not implemented. 688 * 689 * A method in ServletContext interface that is not implemented and will 690 * throw <code>UnsuportedOperationException</code> upon invocation 691 */ 692 @Override 693 public <T extends Servlet> T createServlet(Class<T> clazz) throws ServletException 694 { 695 throw new UnsupportedOperationException(); 696 } 697 698 /** 699 * Not implemented. 700 * 701 * A method in ServletContext interface that is not implemented and will 702 * throw <code>UnsuportedOperationException</code> upon invocation 703 */ 704 @Override 705 public ServletRegistration getServletRegistration(String servletName) 706 { 707 throw new UnsupportedOperationException(); 708 } 709 710 /** 711 * Not implemented. 712 * 713 * A method in ServletContext interface that is not implemented and will 714 * throw <code>UnsuportedOperationException</code> upon invocation 715 */ 716 @Override 717 public Map<String, ? extends ServletRegistration> getServletRegistrations() 718 { 719 throw new UnsupportedOperationException(); 720 } 721 722 /** 723 * Not implemented. 724 * 725 * A method in ServletContext interface that is not implemented and will 726 * throw <code>UnsuportedOperationException</code> upon invocation 727 */ 728 @Override 729 public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName, String className) 730 { 731 throw new UnsupportedOperationException(); 732 } 733 734 /** 735 * Not implemented. 736 * 737 * A method in ServletContext interface that is not implemented and will 738 * throw <code>UnsuportedOperationException</code> upon invocation 739 */ 740 @Override 741 public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName, Filter filter) 742 { 743 throw new UnsupportedOperationException(); 744 } 745 746 /** 747 * Not implemented. 748 * 749 * A method in ServletContext interface that is not implemented and will 750 * throw <code>UnsuportedOperationException</code> upon invocation 751 */ 752 @Override 753 public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName, Class<? extends Filter> filterClass) 754 { 755 throw new UnsupportedOperationException(); 756 } 757 758 /** 759 * Not implemented. 760 * 761 * A method in ServletContext interface that is not implemented and will 762 * throw <code>UnsuportedOperationException</code> upon invocation 763 */ 764 @Override 765 public <T extends Filter> T createFilter(Class<T> clazz) throws ServletException 766 { 767 throw new UnsupportedOperationException(); 768 } 769 770 /** 771 * Not implemented. 772 * 773 * A method in ServletContext interface that is not implemented and will 774 * throw <code>UnsuportedOperationException</code> upon invocation 775 */ 776 @Override 777 public FilterRegistration getFilterRegistration(String filterName) 778 { 779 throw new UnsupportedOperationException(); 780 } 781 782 /** 783 * Not implemented. 784 * 785 * A method in ServletContext interface that is not implemented and will 786 * throw <code>UnsuportedOperationException</code> upon invocation 787 */ 788 @Override 789 public Map<String, ? extends FilterRegistration> getFilterRegistrations() 790 { 791 throw new UnsupportedOperationException(); 792 } 793 794 /** 795 * Not implemented. 796 * 797 * A method in ServletContext interface that is not implemented and will 798 * throw <code>UnsuportedOperationException</code> upon invocation 799 */ 800 @Override 801 public SessionCookieConfig getSessionCookieConfig() 802 { 803 throw new UnsupportedOperationException(); 804 } 805 806 /** 807 * Not implemented. 808 * 809 * A method in ServletContext interface that is not implemented and will 810 * throw <code>UnsuportedOperationException</code> upon invocation 811 */ 812 @Override 813 public void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes) 814 { 815 throw new UnsupportedOperationException(); 816 } 817 818 /** 819 * Not implemented. 820 * 821 * A method in ServletContext interface that is not implemented and will 822 * throw <code>UnsuportedOperationException</code> upon invocation 823 */ 824 @Override 825 public Set<SessionTrackingMode> getDefaultSessionTrackingModes() 826 { 827 throw new UnsupportedOperationException(); 828 } 829 830 /** 831 * Not implemented. 832 * 833 * A method in ServletContext interface that is not implemented and will 834 * throw <code>UnsuportedOperationException</code> upon invocation 835 */ 836 @Override 837 public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() 838 { 839 throw new UnsupportedOperationException(); 840 } 841 842 /** 843 * Not implemented. 844 * 845 * A method in ServletContext interface that is not implemented and will 846 * throw <code>UnsuportedOperationException</code> upon invocation 847 */ 848 @Override 849 public void addListener(String className) 850 { 851 throw new UnsupportedOperationException(); 852 } 853 854 /** 855 * Not implemented. 856 * 857 * A method in ServletContext interface that is not implemented and will 858 * throw <code>UnsuportedOperationException</code> upon invocation 859 */ 860 @Override 861 public <T extends EventListener> void addListener(T t) 862 { 863 throw new UnsupportedOperationException(); 864 } 865 866 /** 867 * Not implemented. 868 * 869 * A method in ServletContext interface that is not implemented and will 870 * throw <code>UnsuportedOperationException</code> upon invocation 871 */ 872 @Override 873 public void addListener(Class<? extends EventListener> listenerClass) 874 { 875 throw new UnsupportedOperationException(); 876 } 877 878 /** 879 * Not implemented. 880 * 881 * A method in ServletContext interface that is not implemented and will 882 * throw <code>UnsuportedOperationException</code> upon invocation 883 */ 884 @Override 885 public <T extends EventListener> T createListener(Class<T> clazz) throws ServletException 886 { 887 throw new UnsupportedOperationException(); 888 } 889 890 /** 891 * Not implemented. 892 * 893 * A method in ServletContext interface that is not implemented and will 894 * throw <code>UnsuportedOperationException</code> upon invocation 895 */ 896 @Override 897 public JspConfigDescriptor getJspConfigDescriptor() 898 { 899 throw new UnsupportedOperationException(); 900 } 901 902 /** 903 * Not implemented. 904 * 905 * A method in ServletContext interface that is not implemented and will 906 * throw <code>UnsuportedOperationException</code> upon invocation 907 */ 908 @Override 909 public ClassLoader getClassLoader() 910 { 911 throw new UnsupportedOperationException(); 912 } 913 914 /** 915 * Not implemented. 916 * 917 * A method in ServletContext interface that is not implemented and will 918 * throw <code>UnsuportedOperationException</code> upon invocation 919 */ 920 @Override 921 public void declareRoles(String... roleNames) 922 { 923 throw new UnsupportedOperationException(); 924 } 925 926 /** 927 * Not implemented. 928 * 929 * A method in ServletContext interface that is not implemented and will 930 * throw <code>UnsuportedOperationException</code> upon invocation 931 */ 932 @Override 933 public String getVirtualServerName() 934 { 935 throw new UnsupportedOperationException(); 936 } 937 938}