This repository has been archived by the owner on Jul 21, 2024. It is now read-only.
forked from jnightlee/webdav-teambition
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛Fixed static frontend work dir, cause 404 issues on some device
- Loading branch information
Showing
4 changed files
with
81 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
aliyundrive-android-core/src/main/java/net/xdow/aliyundrive/servlet/FrontendServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package net.xdow.aliyundrive.servlet; | ||
|
||
import com.github.zxbu.webdavteambition.config.AliyunDriveProperties; | ||
import net.xdow.aliyundrive.util.AliyunDriveClientServiceHolder; | ||
import org.eclipse.jetty.servlet.DefaultServlet; | ||
|
||
import javax.servlet.ServletConfig; | ||
import javax.servlet.ServletException; | ||
import java.util.*; | ||
|
||
public class FrontendServlet extends DefaultServlet { | ||
|
||
Map<String, String> mInitParameterMap = new HashMap<>(); | ||
|
||
@Override | ||
public void init(ServletConfig config) throws ServletException { | ||
AliyunDriveProperties properties = AliyunDriveClientServiceHolder.getInstance().getProperties(); | ||
mInitParameterMap.put("resourceBase", properties.getFrontendDir().getAbsolutePath()); | ||
mInitParameterMap.put("dirAllowed", "true"); | ||
mInitParameterMap.put("pathInfoOnly", "true"); | ||
super.init(config); | ||
} | ||
|
||
@Override | ||
public String getInitParameter(String name) { | ||
String val = mInitParameterMap.get(name); | ||
if (val != null) { | ||
return val; | ||
} | ||
return super.getInitParameter(name); | ||
} | ||
|
||
@Override | ||
public Enumeration<String> getInitParameterNames() { | ||
Collection<String> names = new ArrayList<>(); | ||
names.addAll(mInitParameterMap.keySet()); | ||
Enumeration<String> origNames = super.getInitParameterNames(); | ||
while (origNames.hasMoreElements()) { | ||
names.add(origNames.nextElement()); | ||
} | ||
return Collections.enumeration(names); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters