naming improvements and tidying
This commit is contained in:
parent
961c878cbf
commit
c787ce032a
4 changed files with 38 additions and 24 deletions
|
|
@ -1,20 +0,0 @@
|
||||||
package dev.activitypub.activitypubbot;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
public class MvcController {
|
|
||||||
|
|
||||||
@RequestMapping("/@springbot")
|
|
||||||
public String home() {
|
|
||||||
System.out.println("Bottty McBotface...");
|
|
||||||
return "index";
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping("/")
|
|
||||||
public String root() {
|
|
||||||
System.out.println("Going home...");
|
|
||||||
return "index";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -6,12 +6,11 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Started out with a generic "Hello World" REST API controller,
|
* Here we handle any JSON/REST requests.
|
||||||
* extending this to handle the basic ActivityPub implementation.
|
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping( headers = "accept=application/json" )
|
@RequestMapping( headers = "accept=application/json" )
|
||||||
public class HomeController {
|
public class RestHandler {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public APProperties apProps;
|
public APProperties apProps;
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package dev.activitypub.activitypubbot;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Here we handle all non-JSON/REST requests - i.e. the normal "web" view
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class WebHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* handle requests for our "actor" - this presents the web/html view of
|
||||||
|
* the bot
|
||||||
|
*/
|
||||||
|
@RequestMapping("/@springbot")
|
||||||
|
public String atactor() {
|
||||||
|
System.out.println("WebHandler::atactor");
|
||||||
|
return this.actor();
|
||||||
|
}
|
||||||
|
@RequestMapping("/users/springbot")
|
||||||
|
public String actor() {
|
||||||
|
System.out.println("WebHandler::actor");
|
||||||
|
return "index"; // just flinging out the index page for now
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* our index page
|
||||||
|
*/
|
||||||
|
@RequestMapping("/")
|
||||||
|
public String root() {
|
||||||
|
System.out.println("WebHandler::root");
|
||||||
|
return "index";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,7 +15,7 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
public class HomeControllerTest {
|
public class RestHandlerTests {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MockMvc mvc;
|
private MockMvc mvc;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue