jaroslav@623: /** jaroslav@623: * Back 2 Browser Bytecode Translator jaroslav@623: * Copyright (C) 2012 Jaroslav Tulach jaroslav@623: * jaroslav@623: * This program is free software: you can redistribute it and/or modify jaroslav@623: * it under the terms of the GNU General Public License as published by jaroslav@623: * the Free Software Foundation, version 2 of the License. jaroslav@623: * jaroslav@623: * This program is distributed in the hope that it will be useful, jaroslav@623: * but WITHOUT ANY WARRANTY; without even the implied warranty of jaroslav@623: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jaroslav@623: * GNU General Public License for more details. jaroslav@623: * jaroslav@623: * You should have received a copy of the GNU General Public License jaroslav@623: * along with this program. Look for COPYING file in the top folder. jaroslav@623: * If not, see http://opensource.org/licenses/GPL-2.0. jaroslav@623: */ jaroslav@623: package org.apidesign.bck2brwsr.vmtest; jaroslav@623: jaroslav@623: import java.lang.annotation.ElementType; jaroslav@623: import java.lang.annotation.Retention; jaroslav@623: import java.lang.annotation.RetentionPolicy; jaroslav@623: import java.lang.annotation.Target; jaroslav@623: jaroslav@667: /** jaroslav@797: * Exposes an {@link Resource HTTP page} or a set of {@link #value() pages} to the running {@link BrwsrTest}. jaroslav@623: * jaroslav@623: * @author Jaroslav Tulach jaroslav@623: */ jaroslav@623: @Retention(RetentionPolicy.RUNTIME) jaroslav@667: @Target({ElementType.METHOD, ElementType.TYPE}) jaroslav@667: public @interface Http { jaroslav@667: /** Set of pages to make available */ jaroslav@667: public Resource[] value(); jaroslav@667: jaroslav@797: /** Describes single HTTP page to the running {@link BrwsrTest}, so it can be jaroslav@797: * accessed under the specified {@link #path() relative path}. The page jaroslav@797: * content can either be specified inline via {@link #content()} or as jaroslav@797: * an external {@link #resource() resource}. jaroslav@667: * jaroslav@667: * @author Jaroslav Tulach jaroslav@626: */ jaroslav@667: @Retention(RetentionPolicy.RUNTIME) jaroslav@667: @Target({}) jaroslav@667: public @interface Resource { jaroslav@667: /** path on the server that the test can use to access the exposed resource */ jaroslav@667: String path(); jaroslav@797: /** the content of the Http.Resource */ jaroslav@667: String content(); jaroslav@667: /** resource relative to the class that should be used instead of content. jaroslav@667: * Leave content equal to empty string. jaroslav@667: */ jaroslav@667: String resource() default ""; jaroslav@667: /** mime type of the resource */ jaroslav@667: String mimeType(); jaroslav@954: /** query parameters. Can be referenced from the {@link #content} as jaroslav@954: * $0, $1, etc. The values will be extracted jaroslav@954: * from URL parameters of the request. jaroslav@954: */ jaroslav@954: String[] parameters() default {}; jaroslav@667: } jaroslav@623: }