1 package be
.nikiroo
.fanfix
.library
;
3 public class WebLibraryUrls
{
4 static public final String INDEX_URL
= "/";
6 static public final String VERSION_URL
= "/version";
8 static public final String LOGOUT_URL
= "/logout";
10 static private final String VIEWER_URL_BASE
= "/view/story/";
11 static private final String VIEWER_URL
= VIEWER_URL_BASE
12 + "{luid}/{chap}/{para}";
14 static private final String STORY_URL_BASE
= "/story/";
15 static private final String STORY_URL
= STORY_URL_BASE
16 + "{luid}/{chap}/{para}";
17 static private final String STORY_URL_COVER
= STORY_URL_BASE
19 static private final String STORY_URL_JSON
= STORY_URL_BASE
+ "{luid}/json";
21 static private final String LIST_URL_BASE
= "/list/";
23 static public final String LIST_URL_METADATA
= LIST_URL_BASE
+ "metadata";
25 static public String
getViewUrl(String luid
, Integer chap
, Integer para
) {
27 .replace("{luid}", luid
) //
28 .replace("/{chap}", chap
== null ?
"" : "/" + chap
) //
30 (chap
== null || para
== null) ?
"" : "/" + para
);
33 static public String
getStoryUrl(String luid
, int chap
, Integer para
) {
35 .replace("{luid}", luid
) //
36 .replace("{chap}", Integer
.toString(chap
)) //
37 .replace("{para}", para
== null ?
"" : Integer
.toString(para
));
40 static public String
getStoryUrlCover(String luid
) {
41 return STORY_URL_COVER
//
42 .replace("{luid}", luid
);
45 static public String
getStoryUrlJson(String luid
) {
46 return STORY_URL_JSON
//
47 .replace("{luid}", luid
);
50 static public boolean isSupportedUrl(String url
) {
51 return INDEX_URL
.equals(url
) || VERSION_URL
.equals(url
)
52 || LOGOUT_URL
.equals(url
) || isViewUrl(url
) || isStoryUrl(url
)
56 static public boolean isViewUrl(String url
) {
57 return url
!= null && url
.startsWith(VIEWER_URL_BASE
);
60 static public boolean isStoryUrl(String url
) {
61 return url
!= null && url
.startsWith(STORY_URL_BASE
);
64 static public boolean isListUrl(String url
) {
65 return url
!= null && url
.startsWith(LIST_URL_BASE
);