rt/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/Http.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 09 Jun 2014 19:17:41 +0200
changeset 1623 d9cdfd8ef694
parent 797 7b5a053c6763
child 1787 ea12a3bb4b33
permissions -rw-r--r--
Remove the dirty hacks with names. The fix with the compiler should be good enough.
jaroslav@623
     1
/**
jaroslav@623
     2
 * Back 2 Browser Bytecode Translator
jaroslav@623
     3
 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@623
     4
 *
jaroslav@623
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@623
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@623
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@623
     8
 *
jaroslav@623
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@623
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@623
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@623
    12
 * GNU General Public License for more details.
jaroslav@623
    13
 *
jaroslav@623
    14
 * You should have received a copy of the GNU General Public License
jaroslav@623
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@623
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@623
    17
 */
jaroslav@623
    18
package org.apidesign.bck2brwsr.vmtest;
jaroslav@623
    19
jaroslav@623
    20
import java.lang.annotation.ElementType;
jaroslav@623
    21
import java.lang.annotation.Retention;
jaroslav@623
    22
import java.lang.annotation.RetentionPolicy;
jaroslav@623
    23
import java.lang.annotation.Target;
jaroslav@623
    24
jaroslav@667
    25
/**
jaroslav@797
    26
 * Exposes an {@link Resource HTTP page} or a set of {@link #value() pages} to the running {@link BrwsrTest}.
jaroslav@623
    27
 *
jaroslav@623
    28
 * @author Jaroslav Tulach <jtulach@netbeans.org>
jaroslav@623
    29
 */
jaroslav@623
    30
@Retention(RetentionPolicy.RUNTIME)
jaroslav@667
    31
@Target({ElementType.METHOD, ElementType.TYPE})
jaroslav@667
    32
public @interface Http {
jaroslav@667
    33
    /** Set of pages to make available */
jaroslav@667
    34
    public Resource[] value();
jaroslav@667
    35
    
jaroslav@797
    36
    /** Describes single HTTP page to the running {@link BrwsrTest}, so it can be 
jaroslav@797
    37
     * accessed under the specified {@link #path() relative path}. The page
jaroslav@797
    38
     * content can either be specified inline via {@link #content()} or as
jaroslav@797
    39
     * an external {@link #resource() resource}.
jaroslav@667
    40
     *
jaroslav@667
    41
     * @author Jaroslav Tulach <jtulach@netbeans.org>
jaroslav@626
    42
     */
jaroslav@667
    43
    @Retention(RetentionPolicy.RUNTIME)
jaroslav@667
    44
    @Target({})
jaroslav@667
    45
    public @interface Resource {
jaroslav@667
    46
        /** path on the server that the test can use to access the exposed resource */
jaroslav@667
    47
        String path();
jaroslav@797
    48
        /** the content of the <code>Http.Resource</code> */
jaroslav@667
    49
        String content();
jaroslav@667
    50
        /** resource relative to the class that should be used instead of <code>content</code>.
jaroslav@667
    51
         * Leave content equal to empty string.
jaroslav@667
    52
         */
jaroslav@667
    53
        String resource() default "";
jaroslav@667
    54
        /** mime type of the resource */
jaroslav@667
    55
        String mimeType();
jaroslav@954
    56
        /** query parameters. Can be referenced from the {@link #content} as
jaroslav@954
    57
         * <code>$0</code>, <code>$1</code>, etc. The values will be extracted
jaroslav@954
    58
         * from URL parameters of the request.
jaroslav@954
    59
         */
jaroslav@954
    60
        String[] parameters() default {};
jaroslav@667
    61
    }
jaroslav@623
    62
}