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$
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     * Check also {@link TurbineXmlConfig} to load a {@link #CONFIGURATION_PATH_KEY}.
184     *
185     * @param path The web application root (i.e. the path for file lookup).
186     * @param properties the relative path to TurbineResources.properties file
187     */
188    public TurbineConfig(String path, String properties)
189    {
190        this(path, new HashMap<String, String>(1));
191        initParams.put(PROPERTIES_PATH_KEY, properties);
192    }
193
194    /**
195     * Causes this class to initialize itself which in turn initializes
196     * all of the Turbine Services that need to be initialized.
197     */
198    @Override
199    public void initialize()
200    {
201        try
202        {
203            turbine = new Turbine();
204            turbine.init(this);
205        }
206        catch (Exception e)
207        {
208            log.error("TurbineConfig: Initialization failed", e);
209        }
210    }
211
212    /**
213     * Initialization requiring a HTTP <code>GET</code> request.
214     * @param data the Turbine request
215     */
216    public void init(RunData data)
217    {
218        if (turbine != null)
219        {
220            turbine.init(data);
221        }
222    }
223
224    /**
225     * Shutdown the Turbine System, lifecycle style
226     *
227     */
228    @Override
229    public void dispose()
230    {
231        if (turbine != null)
232        {
233            turbine.destroy();
234        }
235    }
236
237    /**
238     * Returns a reference to the Turbine servlet that was initialized.
239     *
240     * @return a ServletContext reference
241     */
242    public Turbine getTurbine()
243    {
244        return turbine;
245    }
246
247    /**
248     * Returns a reference to the object cast onto ServletContext type.
249     *
250     * @return a ServletContext reference
251     */
252    @Override
253    public ServletContext getServletContext()
254    {
255        return this;
256    }
257
258    /**
259     * Translates a path relative to the web application root into an
260     * absolute path.
261     *
262     * @param path A path relative to the web application root.
263     * @return An absolute version of the supplied path, or <code>null</code>
264     * if the translated path doesn't map to a file or directory.
265     */
266    @Override
267    public String getRealPath(String path)
268    {
269        String result = null;
270        File f = new File(root, path);
271
272        if (log.isDebugEnabled())
273        {
274            log.debug("TurbineConfig.getRealPath: path '{}' translated to '{}' {}found",
275                    path, f.getPath(), f.exists() ? "" : "not ");
276        }
277
278        if (f.exists())
279        {
280          result = f.getPath();
281        }
282        else
283        {
284            log.error("getRealPath(\"{}\") is undefined, returning null", path);
285        }
286
287        return result;
288    }
289
290    /**
291     * Retrieves an initialization parameter.
292     *
293     * @param name the name of the parameter.
294     * @return the value of the parameter.
295     */
296    @Override
297    public String getInitParameter(String name)
298    {
299        return initParams.get(name);
300    }
301
302    /**
303     * Retrieves an Enumeration of initialization parameter names.
304     *
305     * @return an Enumeration of initialization parameter names.
306     */
307    @Override
308    public Enumeration<String> getInitParameterNames()
309    {
310        return new Vector<>(initParams.keySet()).elements();
311    }
312
313    /**
314     * Returns the servlet name.
315     *
316     * Fixed value "Turbine" is returned.
317     *
318     * @return the servlet name.
319     */
320    @Override
321    public String getServletName()
322    {
323        return "Turbine";
324    }
325
326    /**
327     * Returns the context name.
328     *
329     * Fixed value "Turbine" is returned
330     *
331     * @return the context name
332     */
333    @Override
334    public String getServletContextName()
335    {
336        return "Turbine";
337    }
338
339    /**
340     * Returns the context path.
341     *
342     * Fixed value "/turbine" is returned
343     *
344     * @return the context path
345     */
346    @Override
347    public String getContextPath()
348    {
349        return "/turbine";
350        }
351
352        /**
353     * Returns a URL to the resource that is mapped to a specified
354     * path. The path must begin with a "/" and is interpreted
355     * as relative to the current context root.
356     *
357     * @param s the path to the resource
358     * @return a URL pointing to the resource
359     * @throws MalformedURLException if unable to parse path
360     */
361    @Override
362    public URL getResource(String s)
363            throws MalformedURLException
364    {
365        return new URL("file://" + getRealPath(s));
366    }
367
368    /**
369     * Returns the resource located at the named path as
370     * an <code>InputStream</code> object.
371     *
372     * @param s the path to the resource
373     * @return an InputStream object from which the resource can be read
374     */
375    @Override
376    public InputStream getResourceAsStream(String s)
377    {
378        try
379        {
380            FileInputStream fis = new FileInputStream(getRealPath(s));
381            return new BufferedInputStream(fis);
382        }
383        catch (FileNotFoundException e)
384        {
385            return null;
386        }
387    }
388
389    /**
390     * Logs an error message.
391     *
392     * @param e an Exception.
393     * @param m a message.
394     * @deprecated use log(String,Throwable) instead
395     */
396    @Override
397    @Deprecated
398    public void log(Exception e, String m)
399    {
400        log.info(m, e);
401    }
402
403    /**
404     * Logs a message.
405     *
406     * @param m a message.
407     */
408    @Override
409    public void log(String m)
410    {
411        log.info(m);
412    }
413
414    /**
415     * Logs an error message.
416     *
417     * @param t a Throwable object.
418     * @param m a message.
419     */
420    @Override
421    public void log(String m, Throwable t)
422    {
423        log.info(m, t);
424    }
425
426    /**
427     * Returns the servlet container attribute with the given name, or
428     * null if there is no attribute by that name.
429     */
430    @Override
431    public Object getAttribute(String s)
432    {
433        return attributes.get(s);
434    }
435
436    /**
437     * Returns an Enumeration containing the attribute names available
438     * within this servlet context.
439     */
440    @Override
441    public Enumeration<String> getAttributeNames()
442    {
443        return new Vector<>(attributes.keySet()).elements();
444    }
445
446    // Unimplemented methods follow
447
448    /**
449     * Not implemented.
450     *
451     * A method in ServletConfig or ServletContext interface that is not
452     * implemented and will throw <code>UnsuportedOperationException</code>
453     * upon invocation
454     */
455    @Override
456    public ServletContext getContext(String s)
457    {
458        throw new UnsupportedOperationException();
459    }
460
461    /**
462     * Not implemented.
463     *
464     * A method in ServletConfig or ServletContext interface that is not
465     * implemented and will throw <code>UnsuportedOperationException</code>
466     * upon invocation
467     */
468    @Override
469    public int getMajorVersion()
470    {
471        throw new UnsupportedOperationException();
472    }
473
474    /**
475     * Not implemented.
476     *
477     * A method in ServletConfig or ServletContext interface that is not
478     * implemented and will throw <code>UnsuportedOperationException</code>
479     * upon invocation
480     */
481    @Override
482    public String getMimeType(String s)
483    {
484        throw new UnsupportedOperationException();
485    }
486
487    /**
488     * Not implemented.
489     *
490     * A method in ServletConfig or ServletContext interface that is not
491     * implemented and will throw <code>UnsuportedOperationException</code>
492     * upon invocation
493     */
494    @Override
495    public int getMinorVersion()
496    {
497        throw new UnsupportedOperationException();
498    }
499
500    /**
501     * Not implemented.
502     *
503     * A method in ServletConfig or ServletContext interface that is not
504     * implemented and will throw <code>UnsuportedOperationException</code>
505     * upon invocation
506     */
507    @Override
508    public RequestDispatcher getNamedDispatcher(String s)
509    {
510        throw new UnsupportedOperationException();
511    }
512
513    /**
514     * Not implemented.
515     *
516     * A method in ServletConfig or ServletContext interface that is not
517     * implemented and will throw <code>UnsuportedOperationException</code>
518     * upon invocation
519     */
520    @Override
521    public RequestDispatcher getRequestDispatcher(String s)
522    {
523        throw new UnsupportedOperationException();
524    }
525
526    /**
527     * Not implemented.
528     *
529     * A method in ServletContext (2.3) interface that is not implemented and
530     * will throw <code>UnsuportedOperationException</code> upon invocation
531     */
532    @Override
533    public Set<String> getResourcePaths(String s)
534    {
535        throw new UnsupportedOperationException();
536    }
537
538    /**
539     * Not implemented.
540     *
541     * A method in ServletContext (2.3) interface that is not implemented and
542     * will throw <code>UnsuportedOperationException</code> upon invocation
543     */
544    @Override
545    public String getServerInfo()
546    {
547        throw new UnsupportedOperationException();
548    }
549
550    /**
551     * Not implemented.
552     *
553     * A method in ServletContext interface that is not implemented and will
554     * throw <code>UnsuportedOperationException</code> upon invocation
555     * @deprecated As of Java Servlet API 2.1, with no direct replacement.
556     */
557    @Override
558    @Deprecated
559    public Servlet getServlet(String s)
560    {
561        throw new UnsupportedOperationException();
562    }
563
564    /**
565     * Not implemented.
566     *
567     * A method in ServletContext interface that is not implemented and will
568     * throw <code>UnsuportedOperationException</code> upon invocation
569     * @deprecated As of Java Servlet API 2.1, with no replacement.
570     */
571    @Override
572    @Deprecated
573    public Enumeration<String> getServletNames()
574    {
575        throw new UnsupportedOperationException();
576    }
577
578    /**
579     * Not implemented.
580     *
581     * A method in ServletContext interface that is not implemented and will
582     * throw <code>UnsuportedOperationException</code> upon invocation
583     * @deprecated As of Java Servlet API 2.0, with no replacement.
584     */
585    @Override
586    @Deprecated
587    public Enumeration<Servlet> getServlets()
588    {
589        throw new UnsupportedOperationException();
590    }
591
592    /**
593     * Not implemented.
594     *
595     * A method in ServletContext interface that is not implemented and will
596     * throw <code>UnsuportedOperationException</code> upon invocation
597     */
598    @Override
599    public void removeAttribute(String s)
600    {
601        throw new UnsupportedOperationException();
602    }
603
604    /**
605     * Not implemented.
606     *
607     * A method in ServletContext interface that is not implemented and will
608     * throw <code>UnsuportedOperationException</code> upon invocation
609     */
610    @Override
611    public void setAttribute(String s, Object o)
612    {
613        throw new UnsupportedOperationException();
614    }
615
616    /**
617     * Not implemented.
618     *
619     * A method in ServletContext interface that is not implemented and will
620     * throw <code>UnsuportedOperationException</code> upon invocation
621     */
622    @Override
623    public int getEffectiveMajorVersion()
624    {
625        throw new UnsupportedOperationException();
626    }
627
628    /**
629     * Not implemented.
630     *
631     * A method in ServletContext interface that is not implemented and will
632     * throw <code>UnsuportedOperationException</code> upon invocation
633     */
634    @Override
635    public int getEffectiveMinorVersion()
636    {
637        throw new UnsupportedOperationException();
638    }
639
640    /**
641     * Not implemented.
642     *
643     * A method in ServletContext interface that is not implemented and will
644     * throw <code>UnsuportedOperationException</code> upon invocation
645     */
646    @Override
647    public boolean setInitParameter(String name, String value)
648    {
649        throw new UnsupportedOperationException();
650    }
651
652    /**
653     * Not implemented.
654     *
655     * A method in ServletContext interface that is not implemented and will
656     * throw <code>UnsuportedOperationException</code> upon invocation
657     */
658    @Override
659    public Dynamic addServlet(String servletName, String className)
660    {
661        throw new UnsupportedOperationException();
662    }
663
664    /**
665     * Not implemented.
666     *
667     * A method in ServletContext interface that is not implemented and will
668     * throw <code>UnsuportedOperationException</code> upon invocation
669     */
670    @Override
671    public Dynamic addServlet(String servletName, Servlet servlet)
672    {
673        throw new UnsupportedOperationException();
674    }
675
676    /**
677     * Not implemented.
678     *
679     * A method in ServletContext interface that is not implemented and will
680     * throw <code>UnsuportedOperationException</code> upon invocation
681     */
682    @Override
683    public Dynamic addServlet(String servletName, Class<? extends Servlet> servletClass)
684    {
685        throw new UnsupportedOperationException();
686    }
687
688    /**
689     * Not implemented.
690     *
691     * A method in ServletContext interface that is not implemented and will
692     * throw <code>UnsuportedOperationException</code> upon invocation
693     */
694    @Override
695    public <T extends Servlet> T createServlet(Class<T> clazz) throws ServletException
696    {
697        throw new UnsupportedOperationException();
698    }
699
700    /**
701     * Not implemented.
702     *
703     * A method in ServletContext interface that is not implemented and will
704     * throw <code>UnsuportedOperationException</code> upon invocation
705     */
706    @Override
707    public ServletRegistration getServletRegistration(String servletName)
708    {
709        throw new UnsupportedOperationException();
710    }
711
712    /**
713     * Not implemented.
714     *
715     * A method in ServletContext interface that is not implemented and will
716     * throw <code>UnsuportedOperationException</code> upon invocation
717     */
718    @Override
719    public Map<String, ? extends ServletRegistration> getServletRegistrations()
720    {
721        throw new UnsupportedOperationException();
722    }
723
724    /**
725     * Not implemented.
726     *
727     * A method in ServletContext interface that is not implemented and will
728     * throw <code>UnsuportedOperationException</code> upon invocation
729     */
730    @Override
731    public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName, String className)
732    {
733        throw new UnsupportedOperationException();
734    }
735
736    /**
737     * Not implemented.
738     *
739     * A method in ServletContext interface that is not implemented and will
740     * throw <code>UnsuportedOperationException</code> upon invocation
741     */
742    @Override
743    public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName, Filter filter)
744    {
745        throw new UnsupportedOperationException();
746    }
747
748    /**
749     * Not implemented.
750     *
751     * A method in ServletContext interface that is not implemented and will
752     * throw <code>UnsuportedOperationException</code> upon invocation
753     */
754    @Override
755    public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName, Class<? extends Filter> filterClass)
756    {
757        throw new UnsupportedOperationException();
758    }
759
760    /**
761     * Not implemented.
762     *
763     * A method in ServletContext interface that is not implemented and will
764     * throw <code>UnsuportedOperationException</code> upon invocation
765     */
766    @Override
767    public <T extends Filter> T createFilter(Class<T> clazz) throws ServletException
768    {
769        throw new UnsupportedOperationException();
770    }
771
772    /**
773     * Not implemented.
774     *
775     * A method in ServletContext interface that is not implemented and will
776     * throw <code>UnsuportedOperationException</code> upon invocation
777     */
778    @Override
779    public FilterRegistration getFilterRegistration(String filterName)
780    {
781        throw new UnsupportedOperationException();
782    }
783
784    /**
785     * Not implemented.
786     *
787     * A method in ServletContext interface that is not implemented and will
788     * throw <code>UnsuportedOperationException</code> upon invocation
789     */
790    @Override
791    public Map<String, ? extends FilterRegistration> getFilterRegistrations()
792    {
793        throw new UnsupportedOperationException();
794    }
795
796    /**
797     * Not implemented.
798     *
799     * A method in ServletContext interface that is not implemented and will
800     * throw <code>UnsuportedOperationException</code> upon invocation
801     */
802    @Override
803    public SessionCookieConfig getSessionCookieConfig()
804    {
805        throw new UnsupportedOperationException();
806    }
807
808    /**
809     * Not implemented.
810     *
811     * A method in ServletContext interface that is not implemented and will
812     * throw <code>UnsuportedOperationException</code> upon invocation
813     */
814    @Override
815    public void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes)
816    {
817        throw new UnsupportedOperationException();
818    }
819
820    /**
821     * Not implemented.
822     *
823     * A method in ServletContext interface that is not implemented and will
824     * throw <code>UnsuportedOperationException</code> upon invocation
825     */
826    @Override
827    public Set<SessionTrackingMode> getDefaultSessionTrackingModes()
828    {
829        throw new UnsupportedOperationException();
830    }
831
832    /**
833     * Not implemented.
834     *
835     * A method in ServletContext interface that is not implemented and will
836     * throw <code>UnsuportedOperationException</code> upon invocation
837     */
838    @Override
839    public Set<SessionTrackingMode> getEffectiveSessionTrackingModes()
840    {
841        throw new UnsupportedOperationException();
842    }
843
844    /**
845     * Not implemented.
846     *
847     * A method in ServletContext interface that is not implemented and will
848     * throw <code>UnsuportedOperationException</code> upon invocation
849     */
850    @Override
851    public void addListener(String className)
852    {
853        throw new UnsupportedOperationException();
854    }
855
856    /**
857     * Not implemented.
858     *
859     * A method in ServletContext interface that is not implemented and will
860     * throw <code>UnsuportedOperationException</code> upon invocation
861     */
862    @Override
863    public <T extends EventListener> void addListener(T t)
864    {
865        throw new UnsupportedOperationException();
866    }
867
868    /**
869     * Not implemented.
870     *
871     * A method in ServletContext interface that is not implemented and will
872     * throw <code>UnsuportedOperationException</code> upon invocation
873     */
874    @Override
875    public void addListener(Class<? extends EventListener> listenerClass)
876    {
877        throw new UnsupportedOperationException();
878    }
879
880    /**
881     * Not implemented.
882     *
883     * A method in ServletContext interface that is not implemented and will
884     * throw <code>UnsuportedOperationException</code> upon invocation
885     */
886    @Override
887    public <T extends EventListener> T createListener(Class<T> clazz) throws ServletException
888    {
889        throw new UnsupportedOperationException();
890    }
891
892    /**
893     * Not implemented.
894     *
895     * A method in ServletContext interface that is not implemented and will
896     * throw <code>UnsuportedOperationException</code> upon invocation
897     */
898    @Override
899    public JspConfigDescriptor getJspConfigDescriptor()
900    {
901        throw new UnsupportedOperationException();
902    }
903
904    /**
905     * Not implemented.
906     *
907     * A method in ServletContext interface that is not implemented and will
908     * throw <code>UnsuportedOperationException</code> upon invocation
909     */
910    @Override
911    public ClassLoader getClassLoader()
912    {
913        throw new UnsupportedOperationException();
914    }
915
916    /**
917     * Not implemented.
918     *
919     * A method in ServletContext interface that is not implemented and will
920     * throw <code>UnsuportedOperationException</code> upon invocation
921     */
922    @Override
923    public void declareRoles(String... roleNames)
924    {
925        throw new UnsupportedOperationException();
926    }
927
928    /**
929     * Not implemented.
930     *
931     * A method in ServletContext interface that is not implemented and will
932     * throw <code>UnsuportedOperationException</code> upon invocation
933     */
934    @Override
935    public String getVirtualServerName()
936    {
937        throw new UnsupportedOperationException();
938    }
939
940}