001/* 002 Licensed to the Apache Software Foundation (ASF) under one 003 or more contributor license agreements. See the NOTICE file 004 distributed with this work for additional information 005 regarding copyright ownership. The ASF licenses this file 006 to you under the Apache License, Version 2.0 (the 007 "License"); you may not use this file except in compliance 008 with the License. You may obtain a copy of the License at 009 010 http://www.apache.org/licenses/LICENSE-2.0 011 012 Unless required by applicable law or agreed to in writing, 013 software distributed under the License is distributed on an 014 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 KIND, either express or implied. See the License for the 016 specific language governing permissions and limitations 017 under the License. 018 */ 019package org.apache.wiki.spi; 020 021import org.apache.wiki.WikiContext; 022import org.apache.wiki.api.core.Command; 023import org.apache.wiki.api.core.Context; 024import org.apache.wiki.api.core.Engine; 025import org.apache.wiki.api.core.Page; 026import org.apache.wiki.api.spi.ContextSPI; 027 028import javax.servlet.http.HttpServletRequest; 029 030 031/** 032 * Default implementation for {@link ContextSPI} 033 * 034 * @see ContextSPI 035 */ 036public class ContextSPIDefaultImpl implements ContextSPI { 037 038 /** 039 * {@inheritDoc} 040 */ 041 @Override 042 public Context create( final Engine engine, final Page page ) { 043 return new WikiContext( engine, page ); 044 } 045 046 /** 047 * {@inheritDoc} 048 */ 049 @Override 050 public Context create( final Engine engine, final HttpServletRequest request, final Command command ) { 051 return new WikiContext( engine, request, command ); 052 } 053 054 /** 055 * {@inheritDoc} 056 */ 057 @Override 058 public Context create( final Engine engine, final HttpServletRequest request, final Page page ) { 059 return new WikiContext( engine, request, page ); 060 } 061 062 /** 063 * {@inheritDoc} 064 */ 065 @Override 066 public Context create( final Engine engine, final HttpServletRequest request, final String requestContext ) { 067 return new WikiContext( engine, request, requestContext ); 068 } 069 070}