diff --git a/python/educational-core/educational-core.iml b/python/educational-core/educational-core.iml index 058f88e071e4..811dc90aff11 100644 --- a/python/educational-core/educational-core.iml +++ b/python/educational-core/educational-core.iml @@ -33,5 +33,6 @@ + \ No newline at end of file diff --git a/python/educational-core/resources/META-INF/plugin.xml b/python/educational-core/resources/META-INF/plugin.xml index d1523e23db1d..1ff292d678d4 100644 --- a/python/educational-core/resources/META-INF/plugin.xml +++ b/python/educational-core/resources/META-INF/plugin.xml @@ -40,14 +40,16 @@ - + - + @@ -70,8 +72,9 @@ description="Navigate to the next task"/> - - + + @@ -157,13 +160,15 @@ + serviceImplementation="com.jetbrains.edu.learning.StudyDocumentationManager" overrides="true"/> - - + + @@ -177,6 +182,7 @@ + diff --git a/python/educational-core/src/com/jetbrains/edu/learning/builtInServer/StepikRestService.java b/python/educational-core/src/com/jetbrains/edu/learning/builtInServer/StepikRestService.java new file mode 100644 index 000000000000..5cb9c402f33a --- /dev/null +++ b/python/educational-core/src/com/jetbrains/edu/learning/builtInServer/StepikRestService.java @@ -0,0 +1,55 @@ +/* + * Copyright 2000-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jetbrains.edu.learning.builtInServer; + +import com.intellij.openapi.diagnostic.Logger; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.http.FullHttpRequest; +import io.netty.handler.codec.http.HttpMethod; +import io.netty.handler.codec.http.QueryStringDecoder; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.ide.RestService; + +import java.io.IOException; + +/** + * @author meanmail + */ +public class StepikRestService extends RestService { + private static final Logger LOG = Logger.getInstance(StepikRestService.class.getName()); + private static final String SERVICE_NAME = "stepik"; + + @NotNull + @Override + protected String getServiceName() { + return SERVICE_NAME; + } + + @Override + protected boolean isMethodSupported(@NotNull HttpMethod method) { + return method.equals(HttpMethod.GET); + } + + @Nullable + @Override + public String execute(@NotNull QueryStringDecoder urlDecoder, @NotNull FullHttpRequest request, @NotNull ChannelHandlerContext context) + throws IOException { + LOG.info("Request: " + urlDecoder.path()); + RestService.sendOk(request, context); + return null; + } +}