小编sch*_*uno的帖子

Angular S3 静态网站 - 403 禁止路由错误

我知道还有其他关于堆栈溢出的问题与此类似,但我还没有能够解决我的问题。我有一个使用静态网站托管在 S3 中托管的 Angular 7 应用程序。我尚未购买域或设置 CloudFront,因为我仍在开发该站点。

我的问题是,当导航栏中的点击事件触发导航时,路由工作正常(代码使用路由器链接),但如果我在除根(“/”)以外的任何页面上刷新我得到 403来自 S3 的禁止错误:

在此处输入图片说明

正如我所说,角度路由似乎工作正常,因为我在代码中使用 router-link 来处理导航,这是一个例子:

<a routerLink="/services">Click here</a>
Run Code Online (Sandbox Code Playgroud)

这是我的 app-routing.module.ts 代码:

const routes: Routes = [
  { path: '', component: HomeComponent }, 
  { path: 'about-us', component: AboutUsComponent }, 
  { path: 'new-patients', component: NewPatientsComponent }, 
  { path: 'services', component: ServicesProvidedComponent }, 
  { path: 'contact', component: ContactComponent }, 
  { path: '**', component: HomeComponent }];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
Run Code Online (Sandbox Code Playgroud)

我在想,根据我读过的其他解决方案,我需要以某种方式重定向到索引页面,以便 Angular 路由器启动,但我不确定我需要添加什么配置。我认为添加默认路由 ('**') 会解决这个问题,但显然我错了。

当我部署到 S3 时,我总是选择让所有文件都可以公开访问的选项,所以我认为这不是问题所在。

routing amazon-s3 amazon-web-services amazon-cloudfront angular

5
推荐指数
1
解决办法
2211
查看次数

在Liberty中创建EJB计时器

我需要创建一个EJB计时器(使用@Schedule),但是已经读过Websphere Liberty配置文件中不支持这个?根据之前在StackOverflow上发布的问题,截至2013年8月,它不受支持:

Websphere Liberty Profile中的Java EE-Timer/@Schedule

目前,当我尝试使用@Schedule注释时,我得到以下异常:

[ERROR   ] CWWKZ0004E: An exception occurred while starting the application 
<EAR>. The exception message was: com.ibm.ws.container.service.state.StateChangeException: com.ibm.ws.exception.RuntimeError: java.lang.IllegalStateException: The ejbPersistentTimer feature is enabled, but the defaultEJBPersistentTimerExecutor persistent executor cannot be resolved. The most likely cause is that the DefaultDataSource datasource has not been configured. Persistent EJB timers require a datasource configuration for persistence.
Run Code Online (Sandbox Code Playgroud)

问题是我确定了默认数据源.这是EJB代码 - 它非常简单,因为我只是试图测试计时器功能:

import javax.ejb.Schedule;
import javax.ejb.Stateless;

@Stateless
public class TimerBean {

    @Schedule(second="*/10", persistent=false)
    public void doSomething() {
        System.out.println("Hello World!"); …
Run Code Online (Sandbox Code Playgroud)

java ejb timer java-ee websphere-liberty

4
推荐指数
1
解决办法
3578
查看次数

Angular 6 - 在垫选择上动态设置[必需]

在我的 Angular v6 应用程序中,我尝试显示一个下拉列表并将其设置为required基于布尔值,它设置在复选框的值上。这是我的模板中的代码片段(includeModelVersion最初设置为false):

<mat-checkbox class='matCheckbox' (change)="includeModelVersion = !includeModelVersion">Run Model</mat-checkbox>&nbsp;&nbsp;&nbsp;&nbsp;
<mat-form-field *ngIf="includeModelVersion">
  <mat-select placeholder="Select Model Version" formControlName="modelVersionCtrl" [required]="includeModelVersion">
    <mat-option *ngFor="let model of modelData" [value]="model?.MODEL_VERSION">{{model.MODEL_VERSION}}</mat-option>
  </mat-select>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)

在我的 .ts 构造函数中,我定义了布尔值:

includeModelVersion: boolean = false;
Run Code Online (Sandbox Code Playgroud)

使用 *ngIf 可以正确显示下拉列表,但问题与[required]="includeModelVersion"内有关mat-select

如果我不选中该复选框,则表单可以正常提交,但如果我选中该复选框然后取消选中它,则下拉列表仍然是必需的,即使includeModelVersion=false.

我在这里遗漏了一些东西,还是我错误地定义了一些东西?

html typescript angular-material angular

2
推荐指数
1
解决办法
7259
查看次数