Package org.b3log.latke.servlet

Examples of org.b3log.latke.servlet.HTTPRequestMethod


     */
    private static final Logger LOGGER = Logger.getLogger(LocalURLFetchService.class.getName());

    @Override
    public HTTPResponse fetch(final HTTPRequest request) throws IOException {
        final HTTPRequestMethod requestMethod = request.getRequestMethod();
        if (requestMethod == null) {
            throw new IOException("RequestMethod  for URLFetch should not be null");
        }

        return UrlFetchHandlerFactory.getFetchHandler(requestMethod).doFetch(request);
View Full Code Here


        return new Queue() {

            @Override
            public TaskHandle add(final Task task) {
                final TaskOptions taskOptions = TaskOptions.Builder.withTaskName(task.getName()).url(task.getURL());
                final HTTPRequestMethod requestMethod = task.getRequestMethod();

                switch (requestMethod) {
                    case GET:
                        taskOptions.method(TaskOptions.Method.GET);
                        break;
View Full Code Here

     * @param request the specified HTTP request
     * @return GAE HTTP request
     */
    private static com.google.appengine.api.urlfetch.HTTPRequest toGAEHTTPRequest(final HTTPRequest request) {
        final URL url = request.getURL();
        final HTTPRequestMethod requestMethod = request.getRequestMethod();

        com.google.appengine.api.urlfetch.HTTPRequest ret = null;

        switch (requestMethod) {
            case GET:
                ret = new com.google.appengine.api.urlfetch.HTTPRequest(url);
                break;
            case DELETE:
                ret = new com.google.appengine.api.urlfetch.HTTPRequest(url, HTTPMethod.DELETE);
                break;
            case HEAD:
                ret = new com.google.appengine.api.urlfetch.HTTPRequest(url, HTTPMethod.HEAD);
                break;
            case POST:
                ret = new com.google.appengine.api.urlfetch.HTTPRequest(url, HTTPMethod.POST);
                break;
            case PUT:
                ret = new com.google.appengine.api.urlfetch.HTTPRequest(url, HTTPMethod.PUT);
                break;
            default:
                throw new RuntimeException("Unsupported HTTP request method[" + requestMethod.name() + "]");
        }

        final List<HTTPHeader> headers = request.getHeaders();
        for (final HTTPHeader header : headers) {
            ret.addHeader(new com.google.appengine.api.urlfetch.HTTPHeader(header.getName(), header.getValue()));
View Full Code Here

TOP

Related Classes of org.b3log.latke.servlet.HTTPRequestMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.