可能这个错误有一个非常简单的解决方案,但我一直在寻找方法来解决这个问题,但仍然没有得到错误.我想我尽我所能.
问题:当我在wordpress安装上启用非常永久链接时(因此,它使用/%postname%/),它不起作用.除主页外,我在所有页面上都获得了404.
这个页面http://codex.wordpress.org/Permalinks告诉我永久链接工作的要求:
已经安装了Apache Web服务器,mod_rewrite模块已经加载了a2enmod rewrite命令(并且服务器已经多次重启).因此,在/ etc/apache2/mods-enabled下,存在rewrite.load的符号链接.此外,当我运行phpinfo命令时,我看到已加载mod_rewrite模块.你也可以在这里查看:http://namorti.com/phpinfo.php
然后,在/ etc/apache2/sites-enabled中,没有"默认"存在.我将000-default.conf复制到默认值,然后编辑默认值.它包含以下内容:DocumentRoot/var/www
<Directory />
Options FollowSymLinks Indexes
AllowOverride FileInfo
</Directory>
Run Code Online (Sandbox Code Playgroud)
因此,就我而言,已启用FollowSymLinks并允许使用FileInfo指令.
至于最后两点,在我的wordpress主目录(/ var/www)中,.htaccess存在并可由Wordpress写入(我更新了永久链接结构几次,并相应地更新了.htaccess文件).现在它包含以下内容:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Run Code Online (Sandbox Code Playgroud)
所以,据我所知,它应该工作.我重启了服务器(service apache2 restart)几次.我不明白我错过了什么.有人在这里有线索吗?
提前致谢!
*编辑*
所以,我做了calcinai告诉我做的事情......我编辑了我的/ etc/apache2/sites-enabled/default文件(包含vhost).它现在看起来像这样:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and …
Run Code Online (Sandbox Code Playgroud) 我几乎到处搜索,但建议的答案对我没有帮助.
问题:我有一个Wordpress安装,最新版本(3.6.1).我已经多次完成了一个干净的安装,查看了wp-includes/option.php
其他文件,我很确定它一切正常,并且都有正确的内容.
我正在开发一个插件,我正在使用Wordpress定义的函数get_option
.每当我的代码调用该函数时,我都会得到500: internal server error
响应.很奇怪,因为应该从Wordpress框架中调用插件的代码...
让它变得更加奇怪:在那些包含文件中定义的其他函数,比如add_options_page
,完美地工作并且表现得像它们应该的那样.
因此,例如,这有效:
$pageTitle = "Title for my Options Page";
$menuLink = "Title for my Menu Link";
$userAccessLevel = 8; //that's admin
$pageSlug = "slug-to-my-plugin-options-page";
$callbackFunction = array($this, 'optionsPage');
add_options_page($pageTitle, $menuLink, $userAccessLevel,
$pageSlug, $callbackFunction);
Run Code Online (Sandbox Code Playgroud)
但这不是:
get_option("ntp_myoption");
Run Code Online (Sandbox Code Playgroud)
双方add_options_page
并get_option
在同一文件夹(源文件中定义wp-includes\option.php
和wp-includes\plugin.php
),这两个功能在这些文件是有效的,代码块两种以上是在我的插件相同的文件,我不包括或需要的任何文件.
有人有线索吗?
正如所问,我调用的完整代码块get_option
- 它来自我的类的构造函数,它包装了插件.
function __construct() {
global $wpdb;
$this->table_iso = $wpdb->prefix . "ntp_iso";
$this->pluginUrl = get_option('siteurl') . '/wp-content/plugins/my-plugin';
}
Run Code Online (Sandbox Code Playgroud)
也许值得一提:我有一个包装实际插件的类,在.php文件的底部,我有(在类定义之外),这段代码: …
好吧,之前可能已经提出过这个问题了,但是在所有网站上我都看到了"如何做到这一点"的解释告诉我,我做得完全正确.
我知道我不是,因为我的localhost tomcat上出现500服务器错误,我的服务器日志中出现以下错误:
javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class com.myapp.domain.Location, and Java type class com.myapp.domain.Location, and MIME media type application/json was not found
Run Code Online (Sandbox Code Playgroud)
因此,我要做的是使用Jersey(Java)开发RESTful Web服务.一切都很顺利,除了我想要返回JSON的事实.我无法找到与这些人不同的东西:
我的POJO(位置)看起来像这样:
package com.myapp.domain;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement()
public class Location {
private int id;
private double longtitude;
private double latitude;
public Location() {
new Location(-1, -1, -1);
}
public Location(double longtitude, double latitude) {
new Location(-1, longtitude, latitude);
}
public Location(int id, double longtitude, double latitude) { …
Run Code Online (Sandbox Code Playgroud) 好的,所以在 Java 中这是可能的:
import org.eclipse.emf.common.util.Enumerator;
public enum MyEnum implements Enumerator {
LITERAL1(0, "Name", "Literal", "custom1", "custom2", "custom3"),
LITERAL2(0, "Name", "Literal", "custom1", "custom2", "custom3"),
LITERAL3(0, "Name", "Literal", "custom1", "custom2", "custom3"),
LITERAL4(0, "Name", "Literal", "custom1", "custom2", "custom3");
public static final int LITERAL1_VALUE = 0;
public static final int LITERAL2_VALUE = 1;
public static final int LITERAL3_VALUE = 2;
public static final int LITERAL4_VALUE = 3;
private static final MyEnum[] VALUES_ARRAY =
new MyEnum[] {
LITERAL1,
LITERAL2,
LITERAL3,
LITERAL4,
};
public static final …
Run Code Online (Sandbox Code Playgroud) 我正在尝试从log4j进行日志记录,以转到我的插件中的Eclipse Error Log视图.
我有两个外部包:
这就是我的log4j.properties的样子:
# Set root logger level to debug and its only appender to default.
log4j.rootLogger=debug, default
# default is set to be a ConsoleAppender.
log4j.appender.default=VirtualConsole
# default uses PatternLayout.
log4j.appender.default.layout=org.apache.log4j.PatternLayout
log4j.appender.default.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
Run Code Online (Sandbox Code Playgroud)
这就是我的VirtualConsole的样子:
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Level;
import org.apache.log4j.spi.LoggingEvent;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.statushandlers.StatusManager;
public class VirtualConsole extends ConsoleAppender {
@Override
public void append(LoggingEvent event) {
int level = IStatus.INFO;
if (event.getLevel().equals(Level.ERROR))
level = IStatus.ERROR; …
Run Code Online (Sandbox Code Playgroud) 所以,我已经搜索了好几个小时了,但我完全遇到了这里的砖墙。
我的问题很简单:我有一个(相当大的)项目,我想用 Maven 构建它(这样我就可以稍微自动化它)。到目前为止,除了一个主要问题之外,一切都运行良好。
我有一个名为“java-plugin”的依赖项 - 我不知道确切的来源或作者,但它位于我的依赖项的依赖项中 - 我将其添加到我们自己的 Nexus 第三方存储库中,名称为给出了原来的罐子。
这个插件从我的 Nexus 添加没有任何问题,但它具有以下结构:
- netscape
-- javascript
JSException.class
JSObject.class
JSUtil.class
-- security
ForbiddenTargetException.class
ParameterizedTarget.class
Principal.class
Privilege.class
PrivilegeManager.class
PrivilegeTable.class
Target.class
UserDialogHelper.class
UserTarget.class
- sun
-- plugin
...
-- plugin2
...
- com.sun.java.browser.plugin2
...
Run Code Online (Sandbox Code Playgroud)
有什么问题?只要我在基于 Eclipse 的项目中工作,我就把 JDK 放在类路径上的“最后”一个。现在是 Maven,显然 Maven 将 JDK 放在第一位。在我的 JDK 中,我有jfxrt.jar
(Java FX 的一部分)。这个也包含一个netscape.javascript.JSObject
对象(也是一个netscape.javascript.JSException
对象)。netscape.javascript.JSUtil
另一方面,它不包含对象。所以 Maven 选择了JSObject
和JSException
,并从我自己的 java 插件依赖项中选取其他类。
当然,两个班级并不相同。当然,现在我遇到编译错误,因为 java-plugin 依赖项在类中包含“getWindow”方法,JSObject
而 …
我一直在寻找太长的时间,无法弄清楚我做错了什么.
所以,我正在尝试为某些内容生成Xades签名.不幸的是我总是遇到同样的错误:"HIERARCHY_REQUEST_ERR".这是我的XML文档:
<?xml version="1.0" encoding="UTF-8"?>
<object>
<request id="f9e1294a-64b7-488b-b475-7511e317e399">(some arbitrary base64 encoded content)</request>
</object>
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用以下代码签署"Request"元素(显然......):
/*create a document*/
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
Element objectElement = doc.createElement("object");
doc.appendChild(objectElement);
Element requestElement = doc.createElement("request");
requestElement.appendChild(doc.createTextNode(decodedContent));
requestElement.setAttribute("id", UUID.randomUUID().toString());
objectElement.appendChild(requestElement);
/*Key provider, signing profile & signer itself*/
KeyingDataProvider kp = new CustomKeyingDataProvider(certificate, privateKey);
XadesSigningProfile p = new XadesTSigningProfile(kp);
XadesSigner signer = p.newSigner();
/*Signed data*/
DataObjectDesc flatFile = new DataObjectReference("#" + requestElement.getAttribute("id"))
.withTransform(new GenericAlgorithm("http://www.w3.org/2000/09/xmldsig#base64"))
.withDataObjectTimeStamp();
SignedDataObjects dataObjs = new …
Run Code Online (Sandbox Code Playgroud) 我知道"阻止访问"应该是什么意思:你正在使用内部库,不在公共API中的东西,而你根本就不应该使用它.
现在,据我所知,包"org.eclipse.osgi.util"中的类EclipseStarter是公共API的一部分.我引用:
This package specifies API to start the platform.
Clients may use the EclipseStarter loader class to start the platform.
The EclipseStarter class is the only defined API in this package.
Run Code Online (Sandbox Code Playgroud)
来源:http://help.eclipse.org/helios/index.jsp?topic =%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fosgi%2Futil%2Fpackage-summary.html
EclipseStarter类的详细信息页面指出:
Special startup class for the Eclipse Platform. This class cannot be instantiated;
all functionality is provided by static methods.
Note that the fields on this class are not API.
Run Code Online (Sandbox Code Playgroud)
我读过:方法是开放的吗?
我的代码:
import org.eclipse.core.runtime.adaptor.EclipseStarter;
Run Code Online (Sandbox Code Playgroud)
这个已经发出警告"不鼓励访问:由于对所需库[path-to-eclipse]\plugins\org.eclipse.osgi_3.7.2.v20120110-1415.jar的限制,EclipseStarter类型无法访问"
我使用该类的代码:
try {
EclipseStarter.shutdown();
EclipseStarter.startup(null, null);
} catch …
Run Code Online (Sandbox Code Playgroud) 我有一个 Spring Boot 应用程序设置,使用 SpringSecurity 和 OneLogin 作为 JWT 令牌提供程序。
WebConfig 类如下所示:
@EnableResourceServer
@EnableWebSecurity
@Configuration
public class WebConfig extends WebSecurityConfigurerAdapter {
@Override
public void configure(WebSecurity web) {
web.ignoring().mvcMatchers(
"/actuator/info",
"/actuator/health",
"/someArbitraryPath/**");
}
}
Run Code Online (Sandbox Code Playgroud)
到目前为止,一切顺利,除了上述端点之外的所有端点都是安全的,并且仅在传入(有效)JWT 令牌时才起作用。上面配置的似乎在根本不传递身份验证标头时起作用,这正是我想要做的。
除非...当“/someArbitraryPath/someDto/”下的两个调用之一抛出异常时,该异常被配置为返回 ResponseStatus“NOT_FOUND”,结果是 401。
因此,在“/someArbitraryPath”下,我有以下(向公众开放)REST 控制器:
@RestController
@RequestMapping("/someArbitraryPath")
public class SomeArbitraryApiController {
private final SomeArbitraryService service;
private final SomeArbitraryDtoMapper dtoMapper;
public SomeArbitraryApiController(SomeArbitraryService service, SomeArbitraryDtoMapper dtoMapper) {
this.service = service;
this.dtoMapper = dtoMapper;
}
@GetMapping(value = "/someDtosList", params = {"page", "size"})
@Transactional(readOnly = true)
public SomePageDto getSomeDtoPage( …
Run Code Online (Sandbox Code Playgroud) java ×5
eclipse ×4
php ×2
wordpress ×2
.htaccess ×1
apache ×1
eclipse-3.6 ×1
eclipse-jdt ×1
eclipse-pde ×1
emf ×1
enums ×1
jar ×1
jersey ×1
json ×1
log4j ×1
maven ×1
mod-rewrite ×1
rest ×1
spring ×1
spring-boot ×1
xades4j ×1